Skip to content

Commit 786ef10

Browse files
committed
updating for post-hoc p.3
1 parent c55e988 commit 786ef10

File tree

4 files changed

+58
-1
lines changed

4 files changed

+58
-1
lines changed

pangolin/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
_program = "pangolin"
2-
__version__ = "2.3.5"
2+
__version__ = "2.3.6"

pangolin/command.py

+3
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ def main(sysargs = sys.argv[1:]):
269269
variants_file = pkg_resources.resource_filename('pangolin', 'data/config_p.2.csv')
270270
config["p2_variants"] = variants_file
271271

272+
variants_file = pkg_resources.resource_filename('pangolin', 'data/config_p.3.csv')
273+
config["p3_variants"] = variants_file
274+
272275
variants_file = pkg_resources.resource_filename('pangolin', 'data/config_b.1.214.2.csv')
273276
config["b12142_variants"] = variants_file
274277

pangolin/data/config_p.3.csv

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
aa:orf1a:D1554G
2+
aa:orf1a:L3201P
3+
aa:orf1a:D3681E
4+
aa:orf1b:L1203F
5+
aa:S:H1101Y
6+
aa:S:K417T
7+
aa:S:E484K
8+
aa:S:N501Y
9+
aa:S:P681H
10+
aa:S:E1092K
11+
aa:orf8:K2Q
12+
aa:N:P80R

pangolin/scripts/pangolearn.smk

+42
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,24 @@ rule type_variants_p1:
207207
--append-genotypes
208208
"""
209209

210+
rule type_variants_p3:
211+
input:
212+
fasta = rules.align_to_reference.output.fasta,
213+
variants = config["p3_variants"],
214+
reference = config["reference_fasta"]
215+
output:
216+
variants = os.path.join(config["tempdir"],"variants_p3.csv")
217+
shell:
218+
"""
219+
type_variants.py \
220+
--fasta-in {input.fasta:q} \
221+
--variants-config {input.variants:q} \
222+
--reference {input.reference:q} \
223+
--variants-out {output.variants:q} \
224+
--append-genotypes
225+
"""
226+
227+
210228
rule type_variants_b12142:
211229
input:
212230
fasta = rules.align_to_reference.output.fasta,
@@ -230,6 +248,7 @@ rule overwrite:
230248
csv = os.path.join(config["tempdir"],"pangolearn_assignments.csv"),
231249
b117_variants = rules.type_variants_b117.output.variants,
232250
b1351_variants = rules.type_variants_b1351.output.variants,
251+
p3_variants = rules.type_variants_p3.output.variants,
233252
p2_variants = rules.type_variants_p2.output.variants,
234253
p1_variants = rules.type_variants_p1.output.variants,
235254
b12142_variants = rules.type_variants_b12142.output.variants
@@ -260,6 +279,12 @@ rule overwrite:
260279
for row in reader:
261280
if int(row["alt_count"]) > 4 and int(row["ref_count"])<4:
262281
p2[row["query"]] = row["alt_count"]
282+
p3 = {}
283+
with open(input.p3_variants, "r") as f:
284+
reader = csv.DictReader(f)
285+
for row in reader:
286+
if int(row["alt_count"]) > 8 and int(row["ref_count"])<4:
287+
p3[row["query"]] = row["alt_count"]
263288
b12142 = {}
264289
with open(input.b12142_variants, "r") as f:
265290
reader = csv.DictReader(f)
@@ -349,6 +374,23 @@ rule overwrite:
349374
new_row["probability"] = "1.0"
350375
new_row["lineage"] = "B.1.1.28"
351376

377+
writer.writerow(new_row)
378+
elif row["taxon"] in p3:
379+
new_row = row
380+
snps = p3[row["taxon"]]
381+
note = f"{snps}/12 P.3 (B.1.1.28.3) SNPs"
382+
383+
new_row["note"] = note
384+
new_row["probability"] = "1.0"
385+
new_row["lineage"] = "P.3"
386+
387+
writer.writerow(new_row)
388+
elif row["lineage"] =="P.3" and row["taxon"] not in p3:
389+
new_row = row
390+
391+
new_row["probability"] = "1.0"
392+
new_row["lineage"] = "B.1.1.28"
393+
352394
writer.writerow(new_row)
353395
elif row["lineage"] == "B.1.214":
354396
new_row = row

0 commit comments

Comments
 (0)