Hey all,
I am new to using Pysam module in vs code. I am having issues getting my code to work. So I have two files: first is a CSV that I imported as pandas df and it has two columns: chromosome and coordinate. The second file is a sorted, indexed BAM file that contains reads that I imported as Pysam.AlignmentFile [I had to set sq to false in order for the code to work].
Since I want to check reads that contain the coordinates from file1, I wanted to fetch relevant reads, but this is where I run into the:
File "pysam/libcalignmentfile.pyx", line 1087, in pysam.libcalignmentfile.AlignmentFile.fetch
File "pysam/libchtslib.pyx", line 686, in pysam.libchtslib.HTSFile.parse_region
ValueError: invalid contig chr1
error. Can anyone help me please?
For additional info, all I do is
for i in range(DF - 1):
x = DF.iloc[i]['CHROM']
y = DF.iloc[i]['POS']
for read in Bamfile.fetch(x, y - 2000, y):
I appreciate any help!