Thanks Devon Ryan, that was the problem. I check the contigs and there were two duplicates.
Hi,
I did an alignment with STAR, I got the sam file which I can open easily from the terminal:
samtools view -S STAR2Aligned.out.sam
Now I have to work with it in python, so I import the pysam module and try to open the file by:
file = pysam.AlignmentFile("/home/lpp/Desktop/Star_Results/STAR2Aligned.out.sam", "r")
It prints the following error:
[W::sam_hdr_parse] duplicated sequence 'NODE_4_length_21_cov_1.000000'
[W::sam_hdr_parse] duplicated sequence 'NODE_18_length_23_cov_1.000000'
I tried to find the error in different forums but the most similar one to my problem has no answer: http://seqanswers.com/forums/showthread.php?t=58219
Does anybody now where this error is coming from?
Thanks in advance!
1 answer
Samtools is correct, you have a duplicate header. I suspect that you actually have the same sequence twice, but you might want to double check that. You can use the -t option with samtools and give it a two column file with the deduplicated contig names and length and then you'll be able to get a BAM file. Alternatively, remove the duplicate fasta sequences and remap. I suspect that the former method will be both faster and easier.
Log in to answer this question.
If you do a
then do you get more than one line?
It says:
Oh, there should be an
-Sflag given to samtools as well, mea culpa.thankss,
Now It says:
I should add that it's likely that you have multiple contigs with the same name in your reference genome. This will simply not work, though STAR won't complain (its output, however, will be broken unless the duplicately-named entries also have duplicate sequence...though even then the MAPQ values and such will be wrong).