Commit 6bc7cbaf authored by Yannis Duffourd's avatar Yannis Duffourd

Initial commit

parents
#!/bin/bash
if [ ! -e /work/gad/sv347413/epilepsie/vcf_tmp/$i*.vcf ]
then
for i in $(cat /work/gad/sv347413/HLAscan/liste_patients_epileptiques.txt)
do
cp /work/gad/shared/vcf/individu/$i/*.raw.vcf /work/gad/sv347413/epilepsie/vcf_tmp/.
done
fi
if [ ! -e /work/gad/sv347413/epilepsie/tsv_tmp/$i*.tsv ]
then
for i in $(cat /work/gad/sv347413/HLAscan/liste_patients_epileptiques.txt)
do
cp /work/gad/shared/vcf/individu/$i/*.cnv.annot.tsv /work/gad/sv347413/epilepsie/tsv_tmp/.
done
fi
#!/bin/bash
set -e;
true;
i=$1
if [ ! -d /work/gad/sv347413/epilepsie/tmp_res/$i ]
then
mkdir /work/gad/sv347413/epilepsie/tmp_res/$i
fi
if [ ! -e /work/gad/sv347413/epilepsie/tmp_res/$i/$i.SNP.vcf ]
then
echo "SNP"
/work/gad/sv347413/jdk1.8.0_111/bin/java -jar /work/gad/shared/bin/snpEff/SnpSift.jar annotate pharmgkb_v2.vcf /work/gad/sv347413/epilepsie/vcf_tmp/$i.* > /work/gad/sv347413/epilepsie/tmp_res/$i/$i.SNP.vcf
fi
if [ ! -e /work/gad/sv347413/epilepsie/tmp_res/$i/header_CNV.vcf ]
then
echo "CNV"
cp /work/gad/sv347413/epilepsie/Pipeline/header_CNV.vcf /work/gad/sv347413/epilepsie/tmp_res/$i/header_CNV.vcf
fi
if [ ! -e /work/gad/sv347413/epilepsie/tmp_res/$i/$i.CNV.vcf ]
then
echo "CNV2"
python2.7 tsv2vcf.py /work/gad/sv347413/epilepsie/tsv_tmp/$i* /work/gad/sv347413/epilepsie/tmp_res/$i/header_CNV.vcf
mv /work/gad/sv347413/epilepsie/tmp_res/$i/header_CNV.vcf /work/gad/sv347413/epilepsie/tmp_res/$i/$i.CNV.vcf
fi
if [ ! -e /work/gad/sv347413/epilepsie/results_html/$i.html ]
then
echo "html"
python2.7 create_html_v2.py /work/gad/sv347413/epilepsie/tmp_res/$i/$i.SNP.vcf /work/gad/sv347413/epilepsie/tmp_res/$i/$i.CNV.vcf /work/gad/sv347413/HLAscan/results/$i/Report > /work/gad/sv347413/epilepsie/results_html/$i.html
fi
class VCF_CNV:
def __init__(self):
self.CHROM = 0
self.POS = 0
self.ID = "."
self.REF = "."
self.ALT = "."
self.QUAL = 6
self.FILTER = "PASS"
self.SVTYPE = None
self.END = 0
self.SVLEN = 0
self.CIPOS = "0,0"
self.CIEND = "0,0"
self.GENE = "."
self.FORMAT = "GT:GQ"
self.SAMPLE = ".:0"
def __repr__(self):
vcf = "{}\t{}\t{}\t{}\t{}\t{}\t{}\tSVTYPE={};END={};SVLEN={};CIPOS={};CIEND={};GENE={}\t{}\t{}".format(self.CHROM,self.POS,self.ID,self.REF,self.ALT,self.QUAL,self.FILTER,self.SVTYPE,self.END,self.SVLEN,self.CIPOS,self.CIEND,self.GENE,self.FORMAT,self.SAMPLE)
return vcf
This diff is collapsed.
#!/bin/bash
set -e;
true;
for i in $(cat /work/gad/sv347413/HLAscan/liste_patients_epileptiques.txt)
do
echo $i
qsub -V -q batch /work/gad/sv347413/epilepsie/Pipeline/Master.sh ${i}
done
import os
import sys
import vcf
import csv
from pyexcel_ods import *
from VCF_tools import *
import subprocess
from operator import *
"""extraction du tableau """
data = get_data("/work/gad/sv347413/epilepsie/Pipeline/tableau pharmgkb.ods")
data2 = get_data("/work/gad/sv347413/epilepsie/Pipeline/tableau OMIM.ods")
"""Liste contenant les genes d'interets"""
ListeG = []
"""recuperation des genes dans le fichier"""
for i in range(len(data["hg19"])-1):
if not data["hg19"][i]:
pass
else:
if data["hg19"][i][1] != "gene":
"""remplissage de la liste"""
if data["hg19"][i][1] not in ListeG:
ListeG.append((data["hg19"][i][1]))
for i in range(len(data2["hg19"])-1):
if not data2["hg19"][i]:
pass
else:
if data2["hg19"][i][1] != "GENE":
if data2["hg19"][i][1] not in ListeG:
ListeG.append((data2["hg19"][i][1]))
#print(ListeG)
"""ecriture des lignes CNV dans le vcf"""
ListeVCF=[]
for gene in ListeG:
with open(sys.argv[1]) as tsvfile:
reader = csv.DictReader(tsvfile, dialect='excel-tab')
for row in reader:
if gene in row['GeneList'] and gene != "":
line_vcf = VCF_CNV()
line_vcf.CHROM = row["#CHR"]
line_vcf.POS = row["START"]
p = subprocess.Popen(["samtools", 'faidx',"index/hg19_essential.fa", row["#CHR"]+":"+row["START"]+"-"+row["START"]], stdout = subprocess.PIPE)
line_vcf.REF = p.stdout.readlines()[1].strip("\n")
line_vcf.ALT = "<"+row["CNV"]+">"
line_vcf.QUAL = "6"
line_vcf.SVTYPE = row["CNV"]
line_vcf.END = row["END"]
if row["CNV"] == "DEL":
line_vcf.SVLEN = "-"+row["CNVLength"]
else :
line_vcf.SVLEN =row["CNVLength"]
line_vcf.GENE = str(gene)
ListeVCF.append(line_vcf)
ListeVCF = sorted(ListeVCF,key=attrgetter('POS'))
#print ListeVCF
for line in ListeVCF:
with open (sys.argv[2],'a') as vcf_out:
vcf_out.write(repr(line)+"\n")
#test = vcf.Reader(filename = "header_CNV.vcf")
#for record in test:
# print record
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