From 89f57db8a659c960a4c6bba052dc338267bf0438 Mon Sep 17 00:00:00 2001 From: Theo <theo.serralta@chu-dijon.fr> Date: Fri, 20 Oct 2023 15:54:24 +0200 Subject: [PATCH] Creation of a test to read bam with gpu --- exo_bam_gpu.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 exo_bam_gpu.py diff --git a/exo_bam_gpu.py b/exo_bam_gpu.py new file mode 100644 index 0000000..54c5c4b --- /dev/null +++ b/exo_bam_gpu.py @@ -0,0 +1,24 @@ +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) + -- 2.17.1