comparison defuse_results_to_vcf.py @ 34:3099cec648e7

Update tool_dependencies, add help
author Jim Johnson <jj@umn.edu>
date Tue, 15 Oct 2013 17:02:23 -0500
parents 8027fc53f3f9
children
comparison
equal deleted inserted replaced
33:3e3ebdecb0e1 34:3099cec648e7
95 ##source=defuse 95 ##source=defuse
96 ##reference=%s 96 ##reference=%s
97 ##INFO=<ID=SVLEN,Number=.,Type=Integer,Description="Difference in length between REF and ALT alleles"> 97 ##INFO=<ID=SVLEN,Number=.,Type=Integer,Description="Difference in length between REF and ALT alleles">
98 ##INFO=<ID=SVTYPE,Number=1,Type=String,Description="Type of structural variant"> 98 ##INFO=<ID=SVTYPE,Number=1,Type=String,Description="Type of structural variant">
99 ##INFO=<ID=MATEID,Number=1,Type=String,Description="ID of the BND mate"> 99 ##INFO=<ID=MATEID,Number=1,Type=String,Description="ID of the BND mate">
100 ##INFO=<ID=MATELOC,Number=1,Type=String,Description="The chrom:position of the BND mate">
101 ##INFO=<ID=GENESTRAND,Number=2,Type=String,Description="Strands">
100 ##INFO=<ID=DP,Number=1,Type=Integer,Description="Read Depth of segment containing breakend"> 102 ##INFO=<ID=DP,Number=1,Type=Integer,Description="Read Depth of segment containing breakend">
101 ##INFO=<ID=SPLITCNT,Number=1,Type=Integer,Description="number of split reads supporting the prediction"> 103 ##INFO=<ID=SPLITCNT,Number=1,Type=Integer,Description="number of split reads supporting the prediction">
102 ##INFO=<ID=SPANCNT,Number=1,Type=Integer,Description="number of spanning reads supporting the fusion"> 104 ##INFO=<ID=SPANCNT,Number=1,Type=Integer,Description="number of spanning reads supporting the fusion">
103 ##INFO=<ID=HOMLEN,Number=1,Type=Integer,Description="Length of base pair identical micro-homology at event breakpoints"> 105 ##INFO=<ID=HOMLEN,Number=1,Type=Integer,Description="Length of base pair identical micro-homology at event breakpoints">
104 ##INFO=<ID=SPLICESCORE,Number=1,Type=Integer,Description="number of nucleotides similar to GTAG at fusion splice"> 106 ##INFO=<ID=SPLICESCORE,Number=1,Type=Integer,Description="number of nucleotides similar to GTAG at fusion splice">
253 info.append('DELETION') 255 info.append('DELETION')
254 if eversion: 256 if eversion:
255 info.append('EVERSION') 257 info.append('EVERSION')
256 if inversion: 258 if inversion:
257 info.append('INVERSION') 259 info.append('INVERSION')
258 info1 = [svtype,'MATEID=%s' % mate_id2] + info 260 info1 = [svtype,'MATEID=%s;MATELOC=%s:%d' % (mate_id2,gene_chromosome2,genomic_break_pos2)] + info
259 info2 = [svtype,'MATEID=%s' % mate_id1] + info 261 info2 = [svtype,'MATEID=%s;MATELOC=%s:%d' % (mate_id1,gene_chromosome1,genomic_break_pos1)] + info
260 qual = int(float(fields[columns.index('probability')]) * 255) if columns.index('probability') else '.' 262 qual = int(float(fields[columns.index('probability')]) * 255) if columns.index('probability') else '.'
261 vcf1 = '%s\t%d\t%s\t%s\t%s\t%s\t%s\t%s'% (gene_chromosome1,genomic_break_pos1, mate_id1, ref1, alt1, qual, filt, ';'.join(info1) ) 263 vcf1 = '%s\t%d\t%s\t%s\t%s\t%s\t%s\t%s'% (gene_chromosome1,genomic_break_pos1, mate_id1, ref1, alt1, qual, filt, ';'.join(info1) )
262 vcf2 = '%s\t%d\t%s\t%s\t%s\t%s\t%s\t%s'% (gene_chromosome2,genomic_break_pos2, mate_id2, ref2, alt2, qual, filt, ';'.join(info2) ) 264 vcf2 = '%s\t%d\t%s\t%s\t%s\t%s\t%s\t%s'% (gene_chromosome2,genomic_break_pos2, mate_id2, ref2, alt2, qual, filt, ';'.join(info2) )
263 add_vcf_line(gene_chromosome1,genomic_break_pos1,mate_id1,vcf1) 265 add_vcf_line(gene_chromosome1,genomic_break_pos1,mate_id1,vcf1)
264 add_vcf_line(gene_chromosome2,genomic_break_pos2,mate_id2,vcf2) 266 add_vcf_line(gene_chromosome2,genomic_break_pos2,mate_id2,vcf2)
265 write_vcf() 267 write_vcf()
266 except Exception, e: 268 except Exception, e:
267 print >> sys.stderr, "failed: %s" % e 269 print >> sys.stderr, "failed: %s" % e
268 exit(1) 270 sys.exit(1)
269 271
270 if __name__ == "__main__" : __main__() 272 if __name__ == "__main__" : __main__()
271 273