comparison mut2sscs.py @ 75:6ccff403db8a draft

planemo upload for repository https://github.com/Single-Molecule-Genetics/VariantAnalyzerGalaxy/tree/master/tools/variant_analyzer commit ee4a8e6cf290e6c8a4d55f9cd2839d60ab3b11c8
author mheinzl
date Tue, 23 Mar 2021 15:18:17 +0000
parents d21960b45a6b
children fdfe9a919ff7
comparison
equal deleted inserted replaced
74:5023186c2061 75:6ccff403db8a
64 ref_pos_dict = {} 64 ref_pos_dict = {}
65 65
66 for variant in VCF(file1): 66 for variant in VCF(file1):
67 chrom = variant.CHROM 67 chrom = variant.CHROM
68 stop_pos = variant.start 68 stop_pos = variant.start
69 #chrom_stop_pos = str(chrom) + "#" + str(stop_pos)
70 ref = variant.REF 69 ref = variant.REF
71 if len(variant.ALT) == 0: 70 if len(variant.ALT) == 0:
72 continue 71 continue
73 else: 72 else:
74 alt = variant.ALT[0] 73 alt = variant.ALT[0]
75 chrom_stop_pos = str(chrom) + "#" + str(stop_pos) + "#" + ref + "#" + alt 74 chrom_stop_pos = str(chrom) + "#" + str(stop_pos) + "#" + ref + "#" + alt
76
77 if len(ref) == len(alt): 75 if len(ref) == len(alt):
78
79 for pileupcolumn in bam.pileup(chrom, stop_pos - 1, stop_pos + 1, max_depth=1000000000): 76 for pileupcolumn in bam.pileup(chrom, stop_pos - 1, stop_pos + 1, max_depth=1000000000):
80 if pileupcolumn.reference_pos == stop_pos: 77 if pileupcolumn.reference_pos == stop_pos:
81 count_alt = 0 78 count_alt = 0
82 count_ref = 0 79 count_ref = 0
83 count_indel = 0 80 count_indel = 0
135 json.dump((mut_pos_dict, ref_pos_dict), f) 132 json.dump((mut_pos_dict, ref_pos_dict), f)
136 133
137 134
138 if __name__ == '__main__': 135 if __name__ == '__main__':
139 sys.exit(mut2sscs(sys.argv)) 136 sys.exit(mut2sscs(sys.argv))
140