Thanks! In the post, they proposed to delete the duplicate lines on my own. However, I'm not sure which duplicates should I delete?
Hi there, after I sort and index my sam file by igvtools, I load my sam file into igv and got the following error: Error loading: Cannot add sequence that already exists in SAMSequenceDictionary Here is my sorted SAM file's header, any suggestion? Thanks!
1 answer
If the listing is correct then you seem to have several chromosomes listed in the header twice.
2 SN:chr1
2 SN:chr10
2 SN:chr11
2 SN:chr12
2 SN:chr13
2 SN:chr14
2 SN:chr15
2 SN:chr16
2 SN:chr17
2 SN:chr18
2 SN:chr19
2 SN:chr2
2 SN:chr3
2 SN:chr4
2 SN:chr5
2 SN:chr6
2 SN:chr7
2 SN:chr8
2 SN:chr9
2 SN:chrM
2 SN:chrX
2 SN:chrY
See the solution proposed in this samtools thread to address the error you are seeing.
I have shown you duplicate entries in my answer above.
For example, chr1 has @SQ SN:chr1 LN:249250621, @SQ SN:chr1_gl000191_random LN:106433, @SQ SN:chr1_gl000192_random LN:547496, etc. Which should I delete? Thanks!
Those are not duplicated. Main chromosome listings are e.g
@SQ SN:chr3 LN:198022430
@SQ SN:chr3 LN:198022430
Sorry, but I still don't know what to do with the header. do you have any suggestion? For example, I have @SQ SN:chr3 LN:198022430 and @SQ SN:chr3 LN:160039680. What should I do? Thanks!
Do you have any suggestion ? Thanks!
This is the solution posted in the link I had included above:
Use samtools view to convert your BAM to SAM, and then edit the SAM to remove the extraneous @SQ line in the header, and then convert back to BAM using either samtools or Picard.
I don't quite understand what is "extraneous @SQ line"? For example, I have @SQ SN:chr3 LN:198022430 and @SQ SN:chr3 LN:160039680. Should I remove both of them?
Hmm. I thought you had two lines that were identical. Like this example.
@SQ SN:chr3 LN:198022430
@SQ SN:chr3 LN:198022430
Where do you see that? I don't have the same two lines like that actually. Thanks!
When I had grabbed copies of data from two posts you had it contained duplications for the chromosome names I had originally posted in my answer.
Are you saying that you don't have any duplications in your @SQ lines and are still getting that error?
Do you have any suggestion ? Thanks!
Log in to answer this question.
Sorry I need to post the header separately, because the biostars system think it's in German rather than in English...
Please edit the original post to add new information.
Always use
ADD COMMENT/ADD REPLYwhen responding to existing posts to keep threads logically organized.