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.

Question about Picard ReorderSam: New reference sequence does not contain a matching contig for ..

Hi Picard team,

I encountered a problem when trying to reorder downloaded bam files (mapped to hg38) according to my own hg38 reference. There are many contigs that are unique to either fa reference or the bam file, but the chromosomes interested: e.g., chr1, chr2 .. all have the same name (the header lines of bam and id lines of fa reference were attached to the last of this question).

I created a dict file for the fa reference, and then used the following command to reorder bam file.
java -Xmx8G -jar picard.jar ReorderSam I=${filein}.bam O=${fileout}.bam R=hg38.fa S=T CREATE_INDEX=T

I got the following message and no reordered bam file. The problem seems to be that the fa reference does not contain contigs that are included in the bam file. But shouldn't ReorderSam be able to handle this problem by removing reads that were mapped to these bam-unique contigs? I changed Picard version from v2.9.0 to v2.10.6, but the error message was the same.

Thanks in advance for you help.
BW,
Meng

Error message:

[Tue Aug 01 10:10:41 GMT-05:00 2017] picard.sam.ReorderSam INPUT=04732300-a896-4c46-9c59-43b84ea93315_gdc_realn_rehead.bam OUTPUT=reordeed.bam REFERENCE=hg38.fa ALLOW_INCOMPLETE_DICT_CONCORDANCE=false TMP_DIR=[.] CREATE_INDEX=false ALLOW_CONTIG_LENGTH_DISCORDANCE=false VERBOSITY=INFO QUIET=false VALIDATION_STRINGENCY=STRICT COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_MD5_FILE=false GA4GH_CLIENT_SECRETS=client_secrets.json USE_JDK_DEFLATER=false USE_JDK_INFLATER=false
[Tue Aug 01 10:10:41 GMT-05:00 2017] Executing as XXX on Linux 2.6.32-642.6.2.el6.x86_64 amd64; Java HotSpot(TM) 64-Bit Server VM 1.8.0_45-b14; Deflater: Intel; Inflater: Intel; Picard version: 2.10.6-SNAPSHOT.
INFO 2017-08-01 10:10:42 ReorderSam SAM/BAM file
INFO 2017-08-01 10:10:42 ReorderSam SN=%s LN=%d%nchr1248956422
INFO 2017-08-01 10:10:42 ReorderSam SN=%s LN=%d%nchr2242193529
INFO 2017-08-01 10:10:42 ReorderSam SN=%s LN=%d%nchr3198295559
INFO 2017-08-01 10:10:42 ReorderSam SN=%s LN=%d%nchr4190214555
INFO 2017-08-01 10:10:42 ReorderSam SN=%s LN=%d%nchr5181538259
INFO 2017-08-01 10:10:42 ReorderSam SN=%s LN=%d%nchr6170805979
INFO 2017-08-01 10:10:42 ReorderSam SN=%s LN=%d%nchr7159345973
INFO 2017-08-01 10:10:42 ReorderSam SN=%s LN=%d%nchr8145138636
INFO 2017-08-01 10:10:42 ReorderSam SN=%s LN=%d%nchr9138394717
INFO 2017-08-01 10:10:42 ReorderSam SN=%s LN=%d%nchr10133797422
.............
.............
INFO 2017-08-01 10:10:45 ReorderSam Reordering read contig chrUn_GL000214v1 [index=190] to => ref contig chrUn_GL000214v1 [index=448]

INFO 2017-08-01 10:10:45 ReorderSam Reordering read contig chrUn_KI270742v1 [index=191] to => ref contig chrUn_KI270742v1 [index=449]

INFO 2017-08-01 10:10:45 ReorderSam Reordering read contig chrUn_GL000216v2 [index=192] to => ref contig chrUn_GL000216v2 [index=450]

INFO 2017-08-01 10:10:45 ReorderSam Reordering read contig chrUn_GL000218v1 [index=193] to => ref contig chrUn_GL000218v1 [index=451]

INFO 2017-08-01 10:10:45 ReorderSam Reordering read contig chrX [index=22] to => ref contig chrX [index=452]

INFO 2017-08-01 10:10:45 ReorderSam Reordering read contig chrY [index=23] to => ref contig chrY [index=453]

INFO 2017-08-01 10:10:45 ReorderSam Reordering read contig chrY_KI270740v1_random [index=66] to => ref contig chrY_KI270740v1_random [index=454]

[Tue Aug 01 10:10:45 GMT-05:00 2017] picard.sam.ReorderSam done. Elapsed time: 0.10 minutes.
Runtime.totalMemory()=2058354688
To get help, see http://broadinstitute.github.io/picard/index.html#GettingHelp
Exception in thread "main" picard.PicardException: New reference sequence does not contain a matching contig for chrEBV
at picard.sam.ReorderSam.buildSequenceDictionaryMap(ReorderSam.java:229)
at picard.sam.ReorderSam.doWork(ReorderSam.java:112)
at picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:228)
at picard.cmdline.PicardCommandLine.instanceMain(PicardCommandLine.java:94)
at picard.cmdline.PicardCommandLine.main(PicardCommandLine.java:104)

#
The header lines of the bam file:

@HD VN:1.4 SO:coordinate
@SQ SN:chr1 LN:248956422
@SQ SN:chr2 LN:242193529
@SQ SN:chr3 LN:198295559
@SQ SN:chr4 LN:190214555
@SQ SN:chr5 LN:181538259
@SQ SN:chr6 LN:170805979
@SQ SN:chr7 LN:159345973
@SQ SN:chr8 LN:145138636
@SQ SN:chr9 LN:138394717
@SQ SN:chr10 LN:133797422
@SQ SN:chr11 LN:135086622
@SQ SN:chr12 LN:133275309
@SQ SN:chr13 LN:114364328
@SQ SN:chr14 LN:107043718
@SQ SN:chr15 LN:101991189
@SQ SN:chr16 LN:90338345
@SQ SN:chr17 LN:83257441
@SQ SN:chr18 LN:80373285
@SQ SN:chr19 LN:58617616
@SQ SN:chr20 LN:64444167
@SQ SN:chr21 LN:46709983
@SQ SN:chr22 LN:50818468
@SQ SN:chrX LN:156040895
@SQ SN:chrY LN:57227415
@SQ SN:chrM LN:16569
@SQ SN:chr1_KI270706v1_random LN:175055
@SQ SN:chr1_KI270707v1_random LN:32032
@SQ SN:chr1_KI270708v1_random LN:127682
@SQ SN:chr1_KI270709v1_random LN:66860
.............

#
The header id lines of my reference hg38.fa files:

chr1
chr10
chr11
chr11_KI270721v1_random
chr12
chr13
chr14
chr14_GL000009v2_random
chr14_GL000225v1_random
chr14_KI270722v1_random
chr14_GL000194v1_random
chr14_KI270723v1_random
chr14_KI270724v1_random
chr14_KI270725v1_random
chr14_KI270726v1_random
chr15
chr15_KI270727v1_random
chr16
chr16_KI270728v1_random
chr17
chr17_GL000205v2_random
chr17_KI270729v1_random
chr17_KI270730v1_random
chr18
chr19

............

#

Answers

Sign In or Register to comment.