Error samtools: AssertionError: chromosome not in SAM references:
1
0
Entering edit mode
5.1 years ago
vellryba • 0

Hello,

I have an error when running my code: AssertionError: chromosome not in SAM references: >gi|11|ref|E1E2J6

However, when I opened the sam file the reference is clearly there:

@SQ SN:gi|11|ref|E1E2J6 LN:1677

@PG ID:bwa  PN:bwa  VN:0.7.17-r1188 CL:bwa mem -t 4 -v 1 E1E2J6.fasta HCV-19-108_S7_L001_R1_001_val_1.fq.gz HCV-19-108_S7_L001_R2_001_val_2.fq.gz

This is my code:

import pysam
import pysamstats

bamfile = pysam.AlignmentFile('picared.bam')
print("P"),
print ("A"),
print ("C"),
print ("G"),
print ("T"),
print ("I"),
print ("D")
for record in pysamstats.stat_variation(bamfile, chrom='>gi|11|ref|E1E2J6', fafile="E1E2J6.fasta"):
    print(record['pos']),
    print(record['A']),
    print(record['C']),
    print(record['G']),
    print(record['T']),
    print(record['insertions']),
    print(record['deletions'])

Does anyone have an experience with this?

Thank you

next-gen • 897 views
ADD COMMENT
1
Entering edit mode
5.1 years ago

I think you want

 chrom='gi|11|ref|E1E2J6'

not

 chrom='>gi|11|ref|E1E2J6'
ADD COMMENT

Login before adding your answer.

Traffic: 2352 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6