Dear all,
I am trying to write a fastq file (to be more exact a fastq sanger) from a bam file. I tried to install bam2fastq (https://github.com/jts/bam2fastq) but I seem to be unable to install it correctly (which bam2fastq on my command line returns nothing). In addition, I tried picard tools, which returns an empty file, even though my bam file is not empty.
1) So I tried to write it via command line, but I have no experience with it, so I am at a loss.
2) In addition to this, I don't understand what the second part of the identifier is. I mean the identifier starts with @ and goes on and then there is a space and there is for example a 1:N:0:ACTTGA. So I wonder, what this 1:N:0:ACTTGA is.
I want something of the form
@HWI-ST999:169:C3001ACXX:2:1101:1193:2063 1:N:0:ACTTGA
NTCCAAAACACTAACCAAGCTTCTTCTTGCTTCTCAAAGCTTTGATGGTTT
+
#1=DDFFFHHHHHJJJJJJJJJJJJIJJJJJJJJJGJJJJJIJJFHIJGHJ
So far I have this:
samtools view input.bam | cut -f1,10 | sed 's/^/@/' | sed 's/\t/\n/' > out.fastq
@HWI-ST999:169:C3001ACXX:2:1101:13677:2145 GATCGGAAGAGCACACGTCTGAACTCCAGTCACACTTGAATCTCGTATGCC
I have been trying this:
samtools view /Users/Mela/Downloads/Galaxy102Unmapped.bam | cut -f1,10 | sed 's/^/@/' | sed 's/\n/\ /+/\ \n/' | head -n 20
Useful post: C: How To Filter Mapped Reads With Samtools