Convert sam file with no header to fastq
1
0
Entering edit mode
6 weeks ago
daewowo ▴ 10

I aligned to a genome using bowtie2 and saved unaligned reads to a sam file. That sam file has no header. I now want to align this 'unaligned' sam file to a genome but I cant convert to fastq using gatk SamToFastq as gatk needs a header. Any way I can get around this?

fastq sam gatk • 201 views
ADD COMMENT
0
Entering edit mode
6 weeks ago
GenoMax 104k

reformat.sh from BBMap suite should work.

reformat.sh in=your.sam out=reads.fq
ADD COMMENT
0
Entering edit mode

reformat doesnt like the headerless sam either

Input is being processed as unpaired

java.lang.AssertionError: Missing field 1: GGCAGCACGGAGCCAGGCCAATGAGGGGACCCCACCTGGACGCCATCGCCACCCAGGGCCAGACCATGGGGCGGGCTGCAGGGTGTGGGCCAGGTGCTGGGAGGGGCAGGGGCAGGGGCAGAGGAGGAAGTGAGGTCCTGGCTCCAATCC at stream.SamLine.<init>(SamLine.java:491) at stream.SamReadInputStream.toReadList(SamReadInputStream.java:119) at stream.SamReadInputStream.fillBuffer(SamReadInputStream.java:90) at stream.SamReadInputStream.hasMore(SamReadInputStream.java:54) at stream.ConcurrentGenericReadInputStream$ReadThread.readLists(ConcurrentGenericReadInputStream.java:667) at stream.ConcurrentGenericReadInputStream$ReadThread.run(ConcurrentGenericReadInputStream.java:656)

The actual first line of the sam file is

@SRAnumber.n.n followed by base sequence as shown in the error above

ADD REPLY
1
Entering edit mode

@SRAnumber.n.n followed by base sequence as shown in the error above

Can you post actual 2-3 lines from the file. Sounds like it is not in SAM format.

ADD REPLY
0
Entering edit mode

If actually looks like fastq already here is first read

@SRR12348370.1.8123509
GGCAGCACGGAGCCAGGCCAATGAGGGGACCCCACCTGGACGCCATCGCCACCCAGGGCCAGACCATGGGGCGGGCTGCAGGGTGTGGGCCAGGTGCTGGGAGGGGCAGGGGCAGGGGCAGAGGAGGA
AGTGAGGTCCTGGCTCCAATCC
+
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
:FFFFFFFFFFFFFFFFFFFFF
ADD REPLY
1
Entering edit mode

Correct. So no conversion needed.

ADD REPLY
1
Entering edit mode

In any case, I think you could just add any dummy header to that SAM file to make something like samtools fastq work. Afaik the header has (in sam>fastq conversion) basically no meaning despite satisfying the sanity check that the tools run up front. (untested)

ADD REPLY

Login before adding your answer.

Traffic: 2147 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6