FilterSamReads

Hello,
I have a problem to run FilterSamReads and I don't know exactly how to resolve it:
I have an input bam file (inputsorted.bam) and I want to filter it using this command:
java -jar picard.jar FilterSamReads I="inputsorted.bam", O="output.bam", READ_LIST_FILE="read_names.txt", FILTER="includeAligned"

However this message appear:
[Tue Nov 22 09:41:53 CET 2016] picard.sam.FilterSamReads INPUT=inputsorted.bam, FILTER=includeAligned [OUTPUT SAM/BAM will contain aligned reads only. INPUT SAM/BAM must be in queryname SortOrder. (Note that both first and second of paired reads must be aligned to be included in the OUTPUT SAM or BAM)] READ_LIST_FILE=read_names.txt, OUTPUT=output.bam, WRITE_READS_FILES=true VERBOSITY=INFO QUIET=false VALIDATION_STRINGENCY=STRICT COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false GA4GH_CLIENT_SECRETS=client_secrets.json
[Tue Nov 22 09:41:53 CET 2016] Executing as admin_viro@OptiPlex-390 on Linux 3.13.0-101-generic amd64; Java HotSpot(TM) 64-Bit Server VM 1.8.0_111-b14; Picard version: unspecified-SNAPSHOT
ERROR 2016-11-22 09:41:53 FilterSamReads Failed to filter inputsorted.bam,
htsjdk.samtools.SAMException: Cannot read non-existent file: /home/admin/Bureau/e/inputsorted.bam,
at htsjdk.samtools.util.IOUtil.assertFileIsReadable(IOUtil.java:338)
at htsjdk.samtools.util.IOUtil.assertFileIsReadable(IOUtil.java:325)
at picard.sam.FilterSamReads.doWork(FilterSamReads.java:210)
at picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:208)
at picard.cmdline.PicardCommandLine.instanceMain(PicardCommandLine.java:95)
at picard.cmdline.PicardCommandLine.main(PicardCommandLine.java:105)
[Tue Nov 22 09:41:53 CET 2016] picard.sam.FilterSamReads done. Elapsed time: 0,00 minutes.
Runtime.totalMemory()=62390272
To get help, see http://broadinstitute.github.io/picard/index.html#GettingHelp

I don't understand because I generated my bam and sorted it as usual.

To check what could be the problem:

java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

java -jar picard.jar ValidateSamFile I=inputsorted.bam,MODE=SUMMARY

[Tue Nov 22 09:43:57 CET 2016] picard.sam.ValidateSamFile INPUT=sel3ul54sorted.bam,MODE=SUMMARY MODE=VERBOSE MAX_OUTPUT=100 IGNORE_WARNINGS=false VALIDATE_INDEX=true INDEX_VALIDATION_STRINGENCY=EXHAUSTIVE IS_BISULFITE_SEQUENCED=false MAX_OPEN_TEMP_FILES=8000 VERBOSITY=INFO QUIET=false VALIDATION_STRINGENCY=STRICT COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false GA4GH_CLIENT_SECRETS=client_secrets.json
[Tue Nov 22 09:43:57 CET 2016] Executing as admin@OptiPlex-390 on Linux 3.13.0-101-generic amd64; Java HotSpot(TM) 64-Bit Server VM 1.8.0_111-b14; Picard version: unspecified-SNAPSHOT
[Tue Nov 22 09:43:57 CET 2016] picard.sam.ValidateSamFile done. Elapsed time: 0,00 minutes.
Runtime.totalMemory()=62390272
To get help, see http://broadinstitute.github.io/picard/index.html#GettingHelp

Thank you very much for your help

Arnaud

Best Answer

Answers

  • vmicrobiovmicrobio ParisMember
    edited November 2016

    using the correct path and command line: java -jar picard.jar FilterSamReads I=inputsorted.bam O=output.bam READ_LIST_FILE=read_names.txt FILTER="includeAligned"

    INFO 2016-11-22 17:10:03 FilterSamReads Filtering [presorted=true] inputsorted.bam -> OUTPUT=output.bam [sortorder=coordinate]
    ERROR 2016-11-22 17:10:03 FilterSamReads Failed to filter inputsorted.bam
    java.lang.IllegalStateException: Records ZUXCF:09931:13729 (AA_AD169:43) should come after ZUXCF:04851:08815 (AA_AD169:43) when sorting with htsjdk.samtools.SAMRecordQueryNameComparator
    at htsjdk.samtools.SamReader$AssertingIterator.next(SamReader.java:549)
    at htsjdk.samtools.SamReader$AssertingIterator.next(SamReader.java:519)
    at htsjdk.samtools.util.PeekableIterator.advance(PeekableIterator.java:68)
    at htsjdk.samtools.util.PeekableIterator.next(PeekableIterator.java:54)
    at htsjdk.samtools.filter.FilteringSamIterator.getNextRecord(FilteringSamIterator.java:131)
    at htsjdk.samtools.filter.FilteringSamIterator.next(FilteringSamIterator.java:106)
    at picard.sam.FilterSamReads.filterReads(FilterSamReads.java:169)
    at picard.sam.FilterSamReads.doWork(FilterSamReads.java:254)
    at picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:208)
    at picard.cmdline.PicardCommandLine.instanceMain(PicardCommandLine.java:95)
    at picard.cmdline.PicardCommandLine.main(PicardCommandLine.java:105)
    [Tue Nov 22 17:10:03 CET 2016] picard.sam.FilterSamReads done. Elapsed time: 0,00 minutes.
    Runtime.totalMemory()=62390272
    To get help, see http://broadinstitute.github.io/picard/index.html#GettingHelp

Sign In or Register to comment.