Commit 89f57db8 authored by Theo Serralta's avatar Theo Serralta

Creation of a test to read bam with gpu

parent 040df464
No related merge requests found
import pysam
seq_inf= {}
samfile = pysam.AlignmentFile("/home/theo/Documents/alternance/Projet Alternance/dijex8000.bam", "rb")
for read in samfile.fetch(until_eof=True):
seq_id=read.query_name
chro=read.reference_name
start=read.reference_start
lenght=read.query_length
end =read.reference_end
seq_inf[chro]={}
seq_inf[chro].append({"seq_id" : seq_id, "start" : start, "end" : end, "lenght" : lenght, })
samfile.close()
def depth_function(data):
for chro, data in seq_inf.items():
depth = [0] * [-1]["end"] +1 #on crée une liste qui stock la profondeur de chaque chromosome. On prend la dernière position lue de chaque dictionnaire. On rajoute +1 parce que ça compte à partir de 0.
for position in range(start, end +1):
depth[position] += 1
depth_function(seq_info)
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