bioinformaticsdna-sequencefastqpicardbam

Picard SamToFastq only extracts one read, then throws an error


I'm trying to extract some FastQ files from bam files. Picard can do this with SamToFastq as it says in the documentation for this tool it accepts either a bam or sam file.

But when I run it, it only extracts one read, and then exits. Here is the error message. Any help is appreciated.

[davy@xxxx picard-tools-1.70]$ java -jar SamToFastq.jar I=/home/davy/xxx_trio_data/xxxx-1.bam F=/home/davy/xxx_trio_data/1005-1.fastq
[Wed Jun 20 14:14:21 BST 2012] net.sf.picard.sam.SamToFastq INPUT=/home/davy/xxx_trio_data/xxxx-1.bam FASTQ=/home/davy/xxxx_trio_data/xxxx-1.fastq    OUTPUT_PER_RG=false RE_REVERSE=true INCLUDE_NON_PF_READS=false READ1_TRIM=0 READ2_TRIM=0 INCLUDE_NON_PRIMARY_ALIGNMENTS=false VERBOSITY=INFO QUIET=false VALIDATION_STRINGENCY=STRICT COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false
[Wed Jun 20 14:14:21 BST 2012] Executing as davy@xxxxx.xxxx.xxxx.xx.xx on Linux 2.6.34.9-69.fc13.x86_64 amd64; OpenJDK 64-Bit Server VM 1.6.0_18-b18; Picard version: 1.70(1215)
[Wed Jun 20 14:14:21 BST 2012] net.sf.picard.sam.SamToFastq done. Elapsed time: 0.00 minutes.
Runtime.totalMemory()=2029715456
FAQ:  http://sourceforge.net/apps/mediawiki/picard/index.php?title=Main_Page
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
        at java.util.ArrayList.rangeCheck(ArrayList.java:571)
        at java.util.ArrayList.get(ArrayList.java:349)
        at net.sf.picard.sam.SamToFastq.doWork(SamToFastq.java:156)
        at net.sf.picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:177)
        at net.sf.picard.sam.SamToFastq.main(SamToFastq.java:118)

Solution

  • As it turns out, the data is paired end, not single read as I had initially thought, and picard require a second outfile in this instance specified with the SECOND_END_FASTQ option.