Question: Problem using picard reordersam
0
gravatar for mirza
2.8 years ago by
mirza80
India
mirza80 wrote:

Hi, I am working on variant calling with a fungal genome. When I am trying to reorder my .bam file (sorted) using picard ReorderSam (picard v2.9.0) to be used further in GATK realignment & BQSR, it throws this error:

Exception in thread "main" picard.PicardException: Discordant contig lengths: read scaffold1 LN=4751343, ref scaffold1 LN=4340956

Command I used,

java -jar /path/to/picard.jar ReorderSam I=myfile.bam O=reordered.bam R=myreference.fa

I checked my reference.fa file and found that the length of scaffold1 mention was incorrect (4751343), so I corrected it (LN=4340956) and created the .dict file again. But, I am still getting the same error.

reordersam picard • 1.8k views
ADD COMMENTlink modified 2.8 years ago by Pierre Lindenbaum126k • written 2.8 years ago by mirza80

... ound that the length of scaffold1 mention was incorrect (4751343), so I corrected it (LN=4340956) and created the .dict file again.

you're using the wrong reference file. You must use the very same reference file that was used to map the reads.

ADD REPLYlink written 2.8 years ago by Pierre Lindenbaum126k

I am using the same reference file that I used for mapping.

ADD REPLYlink written 2.8 years ago by mirza80

show me

samtools view -H myfile.bam

and

cat myreference.fa
ADD REPLYlink written 2.8 years ago by Pierre Lindenbaum126k

any command other than cat myreference.fa to view the reference coz' the reference has 2600 scaffolds! and I can see only the last few in my terminal. Anyhow, I am sure this is the same file.

ADD REPLYlink modified 2.8 years ago • written 2.8 years ago by mirza80
4
gravatar for Pierre Lindenbaum
2.8 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum126k wrote:

Use option ALLOW_CONTIG_LENGTH_DISCORDANCE=true

If true, then permits mapping from a read contig to a new reference contig with the same name but a different length. Highly dangerous, only use if you know what you are doing

ADD COMMENTlink written 2.8 years ago by Pierre Lindenbaum126k

thanks for the option, it worked. But, can you explain why is it highly dangerous ( & any related article or post you can direct me to)?

ADD REPLYlink modified 2.8 years ago • written 2.8 years ago by mirza80

it's dangerous because it's highly probable that the reference associated to the BAM is different from the fasta reference .

ADD REPLYlink written 2.8 years ago by Pierre Lindenbaum126k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1678 users visited in the last hour