Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
theosanderson committed Jul 24, 2023
1 parent ce32515 commit 3d27a39
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ taxonium_backend/latest_public.jsonl.gz.1
taxonium_component/dist
taxonium_component/storybook-static/**
.DS_Store
**/*.egg-info/**
**/*.pyc
**/_version.py
10 changes: 7 additions & 3 deletions taxoniumtools/src/taxoniumtools/ushertools.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,16 @@ def get_mutations(past_nuc_muts_dict,

for mutation in new_nuc_mutations_here:
zero_indexed_pos = mutation.one_indexed_position - 1
for codon in nuc_to_codon[zero_indexed_pos]:
by_codon[codon].append(mutation)
if zero_indexed_pos in nuc_to_codon:
for codon in nuc_to_codon[zero_indexed_pos]:
by_codon[codon].append(mutation)

mutations_here = []
for gene_codon, mutations in by_codon.items():

# For most of this function we ignore strand - so for negative strand we
# are actually collecting the reverse complement of the codon

initial_codon = [seq[gene_codon.positions[x]] for x in range(3)]

relevant_past_muts = [(x, past_nuc_muts_dict[x])
Expand Down Expand Up @@ -334,7 +336,7 @@ def load_genbank_file(self, genbank_file):

nucleotide_counter = 0
for part in feature.location.parts:
for genome_position in range(part.start, part.end + 1):
for genome_position in range(part.start, part.end ):

cur_codon_number = nucleotide_counter // 3
cur_pos_in_codon = nucleotide_counter % 3
Expand All @@ -349,6 +351,8 @@ def load_genbank_file(self, genbank_file):
for codon_index, codon_dict in codons.items():
codon_obj = Codon(feat_name, codon_index, codon_dict,
self.genes[feat_name].strand)

assert len(codon_dict)%3 == 0
for k, v in codon_dict.items():
nuc_to_codon[v].append(codon_obj)

Expand Down

0 comments on commit 3d27a39

Please sign in to comment.