Converting BAM to fastq
# sort paired read alignment .bam file (sort by name -n)
# save fastq reads in separate R1 and R2 files
# Using bam2fq
paired-end reads: '/1' or '/2' is added to the end of read names
How to split a single .fastq file of paired-end reads into two separated files?
# extracting reads ending with '/1' or '/2'
converting a SAMPLE.bam file into paired end SAMPLE_r1.fastq and SAMPLE_r2.fastq files
-Xmx2g allows a maximum use of 2GB memory for the JVM