To celebrate the release of GATK 4.0, we are giving away free credits for running the GATK4 Best Practices pipelines in FireCloud, our secure online analysis portal. It’s first come first serve, so sign up now to claim your free credits worth $250. Sponsored by Google Cloud. Learn more at

Question about picard BuildBamIndex

sclee1sclee1 seoulMember
edited January 2015 in Ask the GATK team

Greeting all.

Currently, I have been using Picard's built-in library "BuildBamIndex" in order to index my bam files.

I have followed the manual described in Picard sites but I got error message.

Here is my command line that you can easily understand as below.

java -Xmx8g -XX:ParallelGCThreads=8 -jar $picard/BuildBamIndex.jar I=$RealignedBamDir/$output6

I tried different approach to avoid this error message so I used "samtools index" which i think is also same function as Picard BuildBamIndex.

After using samtools, I successfully got my bam index files.

I suppose that there are no major difference between Picard bamindex and samtools bam index.

I am confusing that why only samtools index procedure is working fine?

Below is my error message when run "BuildBamIndex" from Picard.

**[Sun Jan 18 22:15:42 KST 2015] picard.sam.BuildBamIndex INPUT=/DATA1/sclee1/data/URC_WES/U01/01U_N_Filtered_Sorted_Markdup_readgroup.bam VERBOSITY=INFO QUIET=false VALIDATION_STRINGENCY=STRICT COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false
[Sun Jan 18 22:15:42 KST 2015] picard.sam.BuildBamIndex done. Elapsed time: 0.00 minutes.
To get help, see
Exception in thread "main" htsjdk.samtools.SAMException: Exception creating BAM index for record HSQ-2K:530:C5PJAACXX:6:2109:18806:13902 1/2 101b aligned read.
at htsjdk.samtools.BAMIndexer.processAlignment(
at htsjdk.samtools.BAMIndexer.createIndex(
at htsjdk.samtools.BAMIndexer.createIndex(
at picard.sam.BuildBamIndex.doWork(
at picard.cmdline.CommandLineProgram.instanceMain(
at picard.cmdline.PicardCommandLine.instanceMain(
at picard.cmdline.PicardCommandLine.main(
Caused by: htsjdk.samtools.SAMException: BAM cannot be indexed without setting a fileSource for record HSQ-2K:530:C5PJAACXX:6:2109:18806:13902 1/2 101b aligned read.
at htsjdk.samtools.BAMIndexMetaData.recordMetaData(
at htsjdk.samtools.BAMIndexer$BAMIndexBuilder.processAlignment(
at htsjdk.samtools.BAMIndexer.processAlignment(
... 6 more

I look forward to hearing positive answers from you soon.



  • Geraldine_VdAuweraGeraldine_VdAuwera Cambridge, MAMember, Administrator, Broadie

    Hi there,

    I'm sorry, I don't know what is wrong here. You should ask this on the Picard/samtools mailing list (see the url indicated in the error message), they may be able to help you.

  • dvalenzudvalenzu HelsinkiMember

    Hi sclee1,
    it seems to be a bug in the last version of Picard. Can you confirm which version are you using?
    I just have the same problem (and fount your answer by googling the error) with Picard 128 (latest release),
    I have just tried with version 125 and it works fine.
    Good luck!
    p.s: We should report the bug to the Picard team :-)

Sign In or Register to comment.