Commit fe83e33a authored by Theo Serralta's avatar Theo Serralta

Created a program for unaligned sequences

parent c7b394b5
import pysam
samfile = pysam.AlignmentFile("/home/theo/dev/git/cnvCallerGPU/3544.bam", "rb")
non_align = pysam.AlignmentFile("non_align.bam", "wb", header = samfile.header)
for read in samfile:
if read.is_unmapped:
non_align.write(read)
samfile.close()
non_align.close()
non_align_file = pysam.AlignmentFile("/home/theo/non_align.bam", "rb")
total = 0
for read in non_align_file:
#print(read)
#print(f"Chromosome: {read.reference_name}")
#print(f"Position: {read.reference_start}")
#print(f"Non aligné: {read.is_unmapped}")
total += 1
print(f"Total de sequences non alignées : {total}")
non_align_file.close()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment