Hey Ceres,
"chr1" is not the same as "1". What is the first chromosome in your FASTA
file? If it is "1" then the BAM and FASTA are mismatched. You can run
CreateSequenceDictionary on the FASTA file and see what the header looks
like in the resulting ".dict" file.
N
On Wed, Feb 4, 2015 at 11:53 AM, Ceres Fernandez Rozadilla <
ce...@well.ox.ac.uk> wrote:
> Hi,
>
> I am trying to reorder the reads in my BAM file to match the ordering
> contigs of the reference file and get this error:
>
> *ceres@wensleydale /WTCHG_162322_201_tophat/ *java -jar
> /apps/well/picard-tools/1.111/ReorderSam.jar INPUT=accepted_hits.bam
> OUTPUT=ceresC2.bam REFERENCE=../../REFERENCE_SEQUENCES/human_g1k_v37.fasta
> [Wed Feb 04 16:41:01 GMT 2015] net.sf.picard.sam.ReorderSam
> INPUT=accepted_hits.bam OUTPUT=ceresC2.bam
> REFERENCE=../../REFERENCE_SEQUENCES/human_g1k_v37.fasta
> ALLOW_INCOMPLETE_DICT_CONCORDANCE=false
> ALLOW_CONTIG_LENGTH_DISCORDANCE=false VERBOSITY=INFO QUIET=false
> VALIDATION_STRINGENCY=STRICT COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000
> CREATE_INDEX=false CREATE_MD5_FILE=false
> [Wed Feb 04 16:41:01 GMT 2015] Executing as
> ce...@wensleydale.well.ox.ac.uk on Linux 2.6.32-431.29.2.el6.x86_64
> amd64; Java HotSpot(TM) 64-Bit Server VM 1.7.0_51-b13; Picard version:
> 1.111(1901) IntelDeflater
> INFO 2015-02-04 16:41:02 ReorderSam SAM/BAM file
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchr1249250621
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchr10135534747
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchr11135006516
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchr12133851895
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchr13115169878
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchr14107349540
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchr15102531392
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchr1690354753
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchr1781195210
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchr1878077248
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchr1959128983
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchr2243199373
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchr2063025520
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchr2148129895
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchr2251304566
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchr3198022430
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchr4191154276
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchr5180915260
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchr6171115067
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchr7159138663
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchr8146364022
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchr9141213431
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchrM16571
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchrX155270560
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nchrY59373566
> INFO 2015-02-04 16:41:02 ReorderSam Reference
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%n1249250621
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%n2243199373
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%n3198022430
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%n4191154276
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%n5180915260
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%n6171115067
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%n7159138663
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%n8146364022
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%n9141213431
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%n10135534747
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%n11135006516
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%n12133851895
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%n13115169878
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%n14107349540
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%n15102531392
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%n1690354753
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%n1781195210
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%n1878077248
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%n1959128983
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%n2063025520
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%n2148129895
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%n2251304566
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nX155270560
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nY59373566
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nMT16569
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000207.14262
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000226.115008
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000229.119913
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000231.127386
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000210.127682
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000239.133824
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000235.134474
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000201.136148
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000247.136422
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000245.136651
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000197.137175
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000203.137498
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000246.138154
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000249.138502
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000196.138914
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000248.139786
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000244.139929
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000238.139939
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000202.140103
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000234.140531
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000232.140652
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000206.141001
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000240.141933
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000236.141934
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000241.142152
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000243.143341
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000242.143523
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000230.143691
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000237.145867
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000233.145941
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000204.181310
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000198.190085
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000208.192689
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000191.1106433
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000227.1128374
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000228.1129120
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000214.1137718
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000221.1155397
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000209.1159169
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000218.1161147
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000220.1161802
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000213.1164239
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000211.1166566
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000199.1169874
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000217.1172149
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000216.1172294
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000215.1172545
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000205.1174588
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000219.1179198
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000224.1179693
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000223.1180455
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000195.1182896
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000212.1186858
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000222.1186861
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000200.1187035
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000193.1189789
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000194.1191469
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000225.1211173
> INFO 2015-02-04 16:41:02 ReorderSam SN=%s LN=%d%nGL000192.1547496
> INFO 2015-02-04 16:41:02 ReorderSam Reordering SAM/BAM file:
> [Wed Feb 04 16:41:02 GMT 2015] net.sf.picard.sam.ReorderSam done. Elapsed
> time: 0,00 minutes.
> Runtime.totalMemory()=2058354688
> To get help, see http://picard.sourceforge.net/index.shtml#GettingHelp
> Exception in thread "main" net.sf.picard.PicardException: New reference
> sequence does not contain a matching contig for chr1
> at
> net.sf.picard.sam.ReorderSam.buildSequenceDictionaryMap(ReorderSam.java:217)
> at net.sf.picard.sam.ReorderSam.doWork(ReorderSam.java:98)
> at
> net.sf.picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:179)
> at
> net.sf.picard.cmdline.CommandLineProgram.instanceMainWithExit(CommandLineProgram.java:120)
> at net.sf.picard.sam.ReorderSam.main(ReorderSam.java:77)
>
>
> Which is very confusing because I know my bam file contains chromosome 1
> samtools view -H accepted_hits.bam
> @HD VN:1.0 SO:coordinate
> @SQ SN:chr1 LN:249250621
>
> And the reference sequence has been downloaded from 1KG as is, plus the
> .fai contains the exactly same contig as the bam
>
> less ../../REFERENCE_SEQUENCES/human_g1k_v37.fasta.fai
>
> 1 249250621 52 60 61
> 2 243199373 253404903 60 61
>
> Any clues so as to how to solve this?
>
>
> Many thanks
>
> Ceres
>
>
>
> Dr. Ceres Fernandez-Rozadilla
> Molecular and Population Genetics
> Wellcome Trust Centre for Human Genetics, University of Oxford
> Roosevelt Drive, Oxford
> OX3 7BN
> +44 01865 287580
>
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is
> your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Samtools-help mailing list
> Samtools-help@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/samtools-help
>
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Samtools-help mailing list
Samtools-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/samtools-help