If you happen to see a question you know the answer to, please do chime in and help your fellow community members. We appreciate your help!

Test-drive the GATK tools and Best Practices pipelines on Terra

Check out this blog post to learn how you can get started with GATK and try out the pipelines in preconfigured workspaces (with a user-friendly interface!) without having to install anything.

problem with picard

Hello, I have been running into an error that i can not figure out why.

Here is the error message:

Fatal error: Exit code 1 ()
Picked up _JAVA_OPTIONS: -Xmx7g -Xms256m
Exception in thread "main" htsjdk.samtools.SAMFormatException: For sequence 0, text and binary have different lengths in file /galaxy-repl/main/jobdir/017/962/17962822/working/RmDup_on_data_275
at htsjdk.samtools.BAMFileReader.readHeader(
at htsjdk.samtools.BAMFileReader.(
at htsjdk.samtools.BAMFileReader.(
at htsjdk.samtools.SamReaderFactory$
at htsjdk.samtools.SamReaderFactory$
at picard.sam.SortSam.doWork(
at picard.cmdline.CommandLineProgram.instanceMain(
at picard.cmdline.PicardCommandLine.instanceMain(
at picard.cmdline.PicardCommandLine.main(

Here is what i did:

      1. run BWA-MEM with a reference genome on Galaxy (all default settings for read group,  output settings: -M For Picard, defaults for others)

      2. try to sort the BAM with Picard->SortSam on Coordinates.  This will fail and generate the above errors.

Thank You!


  • Update: I run ValidateSamFile, the runs finished, but with empty result.

  • shleeshlee CambridgeMember, Broadie ✭✭✭✭✭

    Hi @eagle_009,

    Are you saying that ValidateSamFile validates your file? Just to be sure, can you post your ValidateSamFile command and standard out message (the message that prints to the screen)?

    I see you're using Galaxy to run SortSam. Did you also run ValidateSamFile on Galaxy? What I would suggest is you download the Picard program jar to run on your system directly. You can download the latest picard.jar from Be sure your Unix/Linux system is running Java 1.8.

    Assuming your SAM validates, then the sort command you would run will look something like:

    java -jar picard.jar SortSam I=input.bam O=sorted.bam SORT_ORDER=coordinate CREATE_INDEX=true

    I've not seen the error:

    For sequence 0, text and binary have different lengths in file

    before. Searching the web with your error, I find this thread. Did you by chance change the reference you are using at some point in your processing?

Sign In or Register to comment.