From a77442b7687089a4bb698b9d9b9328fec6d5a7f7 Mon Sep 17 00:00:00 2001 From: Theo Sanderson Date: Sun, 30 Jul 2023 13:22:37 +0100 Subject: [PATCH 1/2] Cleanup debug print statements in taxoniumtools --- taxoniumtools/src/taxoniumtools/ushertools.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/taxoniumtools/src/taxoniumtools/ushertools.py b/taxoniumtools/src/taxoniumtools/ushertools.py index 1b3bede9..e79f61fd 100644 --- a/taxoniumtools/src/taxoniumtools/ushertools.py +++ b/taxoniumtools/src/taxoniumtools/ushertools.py @@ -86,7 +86,7 @@ def get_gene_name(cds): def get_genes_dict(cdses): genes = {} for cds in cdses: - print(get_gene_name(cds), cds.strand) + genes[get_gene_name(cds)] = Gene(get_gene_name(cds), cds.strand, cds.location.start, cds.location.end) @@ -341,7 +341,7 @@ def load_genbank_file(self, genbank_file): for feature in self.cdses: gene_name = get_gene_name(feature) - print(gene_name) + nucleotide_counter = 0 for part in feature.location.parts: @@ -350,9 +350,9 @@ def load_genbank_file(self, genbank_file): ) if part.strand == 1 else range( part.end - 1, part.start - 1, -1 ) #(honestly not sure why we need to subtract 1 here but we seem to?) - print(part) + for genome_position in ranger: - # print(part.start, part.end, part.strand, genome_position) + cur_codon_number = nucleotide_counter // 3 cur_pos_in_codon = nucleotide_counter % 3 @@ -363,13 +363,13 @@ def load_genbank_file(self, genbank_file): total_lengths[gene_name] = nucleotide_counter nuc_to_codon = defaultdict(list) - print(self.genes) + for feat_name, codons in by_everything.items(): for codon_index, codon_dict in codons.items(): codon_obj = Codon(feat_name, codon_index, codon_dict, self.genes[feat_name].strand) - print(codon_obj) + assert len(codon_dict) % 3 == 0 for k, v in codon_dict.items(): From 7b5f88c8510f1a3d32741a4ff05c10fb18806394 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 30 Jul 2023 12:22:50 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- taxoniumtools/src/taxoniumtools/ushertools.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/taxoniumtools/src/taxoniumtools/ushertools.py b/taxoniumtools/src/taxoniumtools/ushertools.py index e79f61fd..3b6c7b69 100644 --- a/taxoniumtools/src/taxoniumtools/ushertools.py +++ b/taxoniumtools/src/taxoniumtools/ushertools.py @@ -86,7 +86,6 @@ def get_gene_name(cds): def get_genes_dict(cdses): genes = {} for cds in cdses: - genes[get_gene_name(cds)] = Gene(get_gene_name(cds), cds.strand, cds.location.start, cds.location.end) @@ -341,7 +340,6 @@ def load_genbank_file(self, genbank_file): for feature in self.cdses: gene_name = get_gene_name(feature) - nucleotide_counter = 0 for part in feature.location.parts: @@ -350,9 +348,8 @@ def load_genbank_file(self, genbank_file): ) if part.strand == 1 else range( part.end - 1, part.start - 1, -1 ) #(honestly not sure why we need to subtract 1 here but we seem to?) - + for genome_position in ranger: - cur_codon_number = nucleotide_counter // 3 cur_pos_in_codon = nucleotide_counter % 3 @@ -363,13 +360,11 @@ def load_genbank_file(self, genbank_file): total_lengths[gene_name] = nucleotide_counter nuc_to_codon = defaultdict(list) - for feat_name, codons in by_everything.items(): 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():