Mercurial > repos > greg > lrn_risk
comparison lrn_risk.py @ 4:8fe04662585c draft
Uploaded
author | greg |
---|---|
date | Tue, 29 Aug 2023 01:23:22 +0000 |
parents | 5a27ac020c9e |
children | 5aa8560d9d91 |
comparison
equal
deleted
inserted
replaced
3:5a27ac020c9e | 4:8fe04662585c |
---|---|
80 | 80 |
81 | 81 |
82 def gene_dist(f, blast, gtdb): | 82 def gene_dist(f, blast, gtdb): |
83 # get within-species prevalence of genes | 83 # get within-species prevalence of genes |
84 # for virulence factors (VFs): uses VFDB VFs detected via ABRicate's VFDB db | 84 # for virulence factors (VFs): uses VFDB VFs detected via ABRicate's VFDB db |
85 # for AMR genes: uses AMR genes detected via ABRicate's ResFinder db | 85 # for AMR genes: uses AMR genes detected via ABRicate + PIMA db |
86 # for VFs and AMR genes: genes were detected via ABRicate XXX | 86 # for VFs and AMR genes: genes were detected via ABRicate XXX |
87 # minimum nucleotide identity and coverage values >=80% | 87 # minimum nucleotide identity and coverage values >=80% |
88 # total of 61,161 genomes queried | 88 # total of 61,161 genomes queried |
89 # takes VFDB or AMR gene distribution file as input (f) | 89 # takes VFDB or AMR gene distribution file as input (f) |
90 # BLAST file of VFDB or AMR genes (blast) | 90 # BLAST file of VFDB or AMR genes (blast) |
130 perc = items[4] | 130 perc = items[4] |
131 perc = str(round(float(perc), 2)) | 131 perc = str(round(float(perc), 2)) |
132 ann = items[-1] | 132 ann = items[-1] |
133 freetext = '{0}/{1} ({2}%)'.format(pres, denom, perc) | 133 freetext = '{0}/{1} ({2}%)'.format(pres, denom, perc) |
134 elif gtdb != '(Unknown Species)': | 134 elif gtdb != '(Unknown Species)': |
135 ann = annd[key] | 135 ann = 'NA' |
136 denom = gtdbd[gtdb] | 136 denom = gtdbd[gtdb] |
137 freetext = "*WARNING" | 137 freetext = "*WARNING" |
138 warnings.append("*WARNING: This gene has never been detected in this species! Interpret with caution!") | 138 warnings.append("*WARNING: This gene has never been detected in this species! Interpret with caution!") |
139 else: | 139 else: |
140 ann = annd[key] | 140 ann = 'NA' |
141 freetext = "**WARNING" | 141 freetext = "**WARNING" |
142 warnings.append("**WARNING: This genome belongs to an undescribed species. Interpret with caution!") | 142 warnings.append("**WARNING: This genome belongs to an undescribed species. Interpret with caution!") |
143 finallines.append('%s\t%s\t%s' % (bv, ann, freetext)) | 143 finallines.append('%s\t%s\t%s' % (bv, ann, freetext)) |
144 return [finallines, warnings] | 144 return [finallines, warnings] |
145 | 145 |