thanks krobison! And disclaimer duly noted!
Unconfigured Ad
Collapse
X
-
Using Picard's tool is probably better, but it's worth studying the line below as an example as an example of a very quick-and-dirty SAM-to-FASTA generator
Code:samtools view myalign.bam | perl -n -e 'if (/^\@/) { @f=split(/\t/); print ">$f[0]|$f[1] $f[2]:$f[3]\n$f[9]\n"; }'
I used the flag field to disambiguate the two ends of a read
(any bugs were clearly deliberate attempts to educate the student! :-)
Leave a comment:
-
Look at Picard's SamToFastq.jar. That will get you to FASTQ and then smooth sailing to FASTA. Alternatively, you can use the many APIs (PERL, Python, C, Java, etc.) to natively read in SAM/BAM. I have personally used all of them successfully.Originally posted by veena View PostThanks so much again Nils! The scary thought is I'm the "local bioinformatician" and I've googled my fingers silly trying to figure out how to get a fasta (thats all I really need!) from the publicly available .bam file. Nobody else around me cares to work with .bam files (yet). Is it best to convert from bam to sam and then format read name and sequence into fasta? Or is there a better way?
Leave a comment:
-
Thanks so much again Nils! The scary thought is I'm the "local bioinformatician" and I've googled my fingers silly trying to figure out how to get a fasta (thats all I really need!) from the publicly available .bam file. Nobody else around me cares to work with .bam files (yet). Is it best to convert from bam to sam and then format read name and sequence into fasta? Or is there a better way?
Leave a comment:
-
The SAM format has support for reads that are not aligned. For example, if one end of a paired end read does not map, it can be flagged as unmapped and given the co-ordinate of the other end. I would study the SAM spec carefully. By filtering on the FLAG field, you can pull out reads that are unmapped (assuming that the aligner was kind enough to include unmapped reads).Originally posted by veena View PostThanks Nils!
Another newbie question, I'm trying to get a subset of reads from publicly available unmapped data that align to my sequence of interest.
I'm told that a read's sequence should be available in a BAM file. But isnt a BAM file by definition an alignment file (as in aligned-to-something file) to begin with? Can I run another alignment program (say Blast) on a pre-existing BAM file with a completely different query? Very confused and would appreciate any help!
To run BLAST on a BAM file, you would have to convert the BAM file into whatever format (FASTA?) BLAST requires. This can be done with a quick script or bugging your local bioinformatician.
Leave a comment:
-
Also, any help on how to run BLAST on a BAM file would be much appreciated!
Leave a comment:
-
Thanks Nils!
Another newbie question, I'm trying to get a subset of reads from publicly available unmapped data that align to my sequence of interest.
I'm told that a read's sequence should be available in a BAM file. But isnt a BAM file by definition an alignment file (as in aligned-to-something file) to begin with? Can I run another alignment program (say Blast) on a pre-existing BAM file with a completely different query? Very confused and would appreciate any help!
Leave a comment:
-
Your fine as it is just a warning. The new implementations of samtools and picard add an EOF marker. Earlier BAMs did not have these.Originally posted by veena View PostHi,
I downloaded a bam file from NCBI and am unable to index it. Here is what I've done:
samtools index file.bam
Error message:
[bam_header_read] EOF marker is absent.
I haven't really found anything in thread archives that give this error with a bam file so am pretty sure I'm doing something fundamentally wrong. I'm a samtools and bam file newbie so any help would be much appreciated!
Thanks!
Nils
Leave a comment:
-
Error indexing BAM file using samtools
Hi,
I downloaded a bam file from NCBI and am unable to index it. Here is what I've done:
samtools index file.bam
Error message:
[bam_header_read] EOF marker is absent.
I haven't really found anything in thread archives that give this error with a bam file so am pretty sure I'm doing something fundamentally wrong. I'm a samtools and bam file newbie so any help would be much appreciated!
Thanks!
Latest Articles
Collapse
-
by SEQadmin2
Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?
Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating...-
Channel: Articles
10-14-2026, 09:55 AM -
-
by SEQadmin2
Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.
We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing...-
Channel: Articles
-
ad_right_rmr
Collapse
News
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by SEQadmin2, Yesterday, 11:13 AM
|
0 responses
17 views
0 reactions
|
Last Post
by SEQadmin2
Yesterday, 11:13 AM
|
||
|
Started by SEQadmin2, Yesterday, 10:48 AM
|
0 responses
18 views
0 reactions
|
Last Post
by SEQadmin2
Yesterday, 10:48 AM
|
||
|
Started by SEQadmin2, 10-15-2026, 10:52 AM
|
0 responses
36 views
0 reactions
|
Last Post
by SEQadmin2
10-15-2026, 10:52 AM
|
||
|
Started by SEQadmin2, 10-14-2026, 05:39 AM
|
0 responses
42 views
0 reactions
|
Last Post
by SEQadmin2
10-14-2026, 05:39 AM
|
Leave a comment: