Commit eeb9a1cf authored by Simon Verdez's avatar Simon Verdez

ajout profondeur et CNV

parent 6bc7cbaf
import sys
import subprocess
from pyexcel_ods import *
from pysam import VariantFile
import htmltag
......@@ -57,6 +57,7 @@ for record in vcf_reader_CNV.fetch():
for elm in record.alts:
if elm == "<DEL>":
ListeM = []
ListeD = []
body= body.append(htmltag.P("Deletion detectee par xHMM sur le gene "+record.info["GENE"]))
for i in range(len(data["hg19"])-1):
if not data["hg19"][i]:
......@@ -68,6 +69,26 @@ for record in vcf_reader_CNV.fetch():
ListeM.append(data["hg19"][i][0])
for Mol in ListeM:
body= body.append(htmltag.P("######Gene ayant une relation avec :"+Mol))
depth_ave = 0.0
pos_len = 0
depth_new = 0
p = subprocess.Popen(["samtools", 'depth', BAM_FILE, '-r', record.chrom + ':' + str(record.pos) + '-'\
+ str(record.stop)], stdout = subprocess.PIPE)
for line in p.stdout.readlines():
item = line.split()
if len(item) == 3:
ListeD.append(item[2])
for elm in ListeD:
depth_new = depth_new + int(elm)
depth_ave = depth_ave + float(item[2])
pos_len = pos_len + (int(record.stop) - int(record.pos) + 1)
depth_ave = depth_new/float(pos_len)
if depth_ave > 40:
body= body.append(htmltag.P("######Detecte heterozygote, profondeur moyenne :"+depth_ave))
if depth_ave < 10:
body= body.append(htmltag.P("######Detecte homozygote, profondeur moyenne :"+depth_ave))
else:
body= body.append(htmltag.P("######Detecte probablement heterozygote, profondeur moyenne :"+depth_ave))
if elm == "<DUP>":
ListeM = []
body= body.append(htmltag.P("Duplication detectee par xHMM sur le gene "+record.info["GENE"]))
......
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