Skip to content

Commit

Permalink
style: appease pc
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyWesthead committed Jul 17, 2024
1 parent 1376c07 commit 64ac2f6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions gnomonicus/gnomonicus_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ def getGenes(
# No catalogue, so just stick to genes in the sample
return sample.genes


def count_nucleotide_changes(ref: str | None, alt: str | None) -> int | None:
"""Count number of changes between ref and alt
Expand Down Expand Up @@ -498,7 +499,9 @@ def populateMutations(
mutations["amino_acid_number"].append(mutation.amino_acid_number)
mutations["amino_acid_sequence"].append(mutation.amino_acid_sequence)
mutations["number_nucleotide_changes"].append(
count_nucleotide_changes(mutation.ref_nucleotides, mutation.alt_nucleotides)
count_nucleotide_changes(
mutation.ref_nucleotides, mutation.alt_nucleotides
)
)
for mutation in gene_diff.minor_mutations:
mutations["gene"].append(gene_name)
Expand All @@ -514,7 +517,9 @@ def populateMutations(
mutations["amino_acid_number"].append(mutation.amino_acid_number)
mutations["amino_acid_sequence"].append(mutation.amino_acid_sequence)
mutations["number_nucleotide_changes"].append(
count_nucleotide_changes(mutation.ref_nucleotides, mutation.alt_nucleotides)
count_nucleotide_changes(
mutation.ref_nucleotides, mutation.alt_nucleotides
)
)

if len(mutations["gene"]) != 0:
Expand Down Expand Up @@ -1424,4 +1429,4 @@ def saveJSON(
with open(
os.path.join(path, f"{guid}.gnomonicus-out.json"), "w", encoding="utf-8"
) as f:
f.write(json.dumps({"meta": meta, "data": data}, indent=2))
f.write(json.dumps({"meta": meta, "data": data}, indent=2))

0 comments on commit 64ac2f6

Please sign in to comment.