Mercurial > repos > iuc > medaka_variant_pipeline
comparison convert_VCF_info_fields.py @ 7:08e0d74aac22 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/medaka commit ed5a3aadbecc0decf9a797447f3ac7700683ea9a"
author | iuc |
---|---|
date | Mon, 22 Feb 2021 19:58:33 +0000 |
parents | ea1833858055 |
children | 1040a307be0c |
comparison
equal
deleted
inserted
replaced
6:ea1833858055 | 7:08e0d74aac22 |
---|---|
13 | 13 |
14 from scipy.stats import fisher_exact | 14 from scipy.stats import fisher_exact |
15 | 15 |
16 | 16 |
17 def pval_to_phredqual(pval): | 17 def pval_to_phredqual(pval): |
18 return round(-10 * log10(pval)) | 18 try: |
19 ret = round(-10 * log10(pval)) | |
20 except ValueError: | |
21 ret = 2147483647 # transform pval of 0.0 to max signed 32 bit int | |
22 return ret | |
19 | 23 |
20 | 24 |
21 def parseInfoField(info): | 25 def parseInfoField(info): |
22 info_fields = info.split(';') | 26 info_fields = info.split(';') |
23 info_dict = OrderedDict() | 27 info_dict = OrderedDict() |
31 in_vcf = open(in_vcf_filepath, 'r') | 35 in_vcf = open(in_vcf_filepath, 'r') |
32 out_vcf = open(out_vcf_filepath, 'w') | 36 out_vcf = open(out_vcf_filepath, 'w') |
33 to_skip = set(['SC', 'SR']) | 37 to_skip = set(['SC', 'SR']) |
34 for i, line in enumerate(in_vcf): | 38 for i, line in enumerate(in_vcf): |
35 if i == 1: | 39 if i == 1: |
36 out_vcf.write("##convert_VCF_info_fields=0.1\n") | 40 out_vcf.write("##convert_VCF_info_fields=0.2\n") |
37 if line[0:2] == "##": | 41 if line[0:2] == "##": |
38 if line[0:11] == "##INFO=<ID=": | 42 if line[0:11] == "##INFO=<ID=": |
39 id_ = line[11:].split(',')[0] | 43 id_ = line[11:].split(',')[0] |
40 if id_ in to_skip: | 44 if id_ in to_skip: |
41 continue | 45 continue |