Question: Samtools 1.3 bam to fastq
1
gravatar for skbrimer
2.9 years ago by
skbrimer530
United States
skbrimer530 wrote:

Hi group,

Just a quick question, how to I properly use the fastq command in samtools 1.3? According to the documentation I should be doing this:

samtools fastq -On -s ion36_nohost.fastq ion36_nohost.bam

but the result is this:

[M::bam2fq_mainloop_singletontrack] discarded 0 singletons

[M::bam2fq_mainloop_singletontrack] processed 0 reads

I'm trying to get the unmapped reads. My bam file does contain the reads in question but I'm doing something wrong since they switched to fastq from bam2fq

Any idea?

software error • 5.6k views
ADD COMMENTlink modified 2.5 years ago by Biostar ♦♦ 20 • written 2.9 years ago by skbrimer530
5
gravatar for skbrimer
2.9 years ago by
skbrimer530
United States
skbrimer530 wrote:

I must have misunderstood the docs becasue this was at the top and works

samtools fastq input.bam > output.fastq

but the detail doc is different here:

samtools fastq [options] in.bam samtools fasta [options] in.bam

Converts a BAM or CRAM into either FASTQ or FASTA format depending on the command invoked.

OPTIONS:

-n By default, either '/1' or '/2' is added to the end of read names where the corresponding BAM_READ1 or BAM_READ2 flag is set. Using -n causes read names to be left as they are.

-O Use quality values from OQ tags in preference to standard quality string if available.

-s FILE Write singleton reads in FASTQ format to FILE instead of outputting them.

-t Copy RG, BC and QT tags to the FASTQ header line, if they exist.

-1 FILE Write reads with the BAM_READ1 flag set to FILE instead of outputting them.

-2 FILE Write reads with the BAM_READ2 flag set to FILE instead of outputting them.

-0 FILE Write reads with both or neither of the BAM_READ1 and BAM_READ2 flags set to FILE instead of outputting them.

-f INT Only output alignments with all bits set in INT present in the FLAG field. INT can be specified in hex by beginning with 0x' (i.e. /^0x[0-9A-F]+/) or in octal by beginning with0' (i.e. /^0[0-7]+/) [0].

-F INT Do not output alignments with any bits set in INT present in the FLAG field. INT can be specified in hex by beginning with 0x' (i.e. /^0x[0-9A-F]+/) or in octal by beginning with0' (i.e. /^0[0-7]+/) [0].

ADD COMMENTlink written 2.9 years ago by skbrimer530

Can you get points for figuring out our own question?

ADD REPLYlink written 2.9 years ago by skbrimer530
1

Hell yeah you can - I just gave you an upvote for exactly that :)

ADD REPLYlink written 2.9 years ago by John12k

That's great thanks John!

ADD REPLYlink written 2.9 years ago by skbrimer530
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1781 users visited in the last hour