Skip to content

Commit 73cd15c

Browse files
committed
adding translate table integer
1 parent 6703989 commit 73cd15c

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

microbiorust-py/benchmarks/bench_pipeline.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,17 @@ def _run_once(self, engine, context):
4343
if engine == 'rust':
4444
return gbk.gbk_to_faa_count(self.filepath)
4545
else:
46-
count = 0
47-
for record in SeqIO.parse(self.filepath, "genbank"):
48-
genome_seq = record.seq
49-
for feature in record.features:
50-
if feature.type == "CDS":
51-
parts = getattr(feature.location, 'parts', [feature.location])
52-
for part in parts:
53-
_ = str(part.extract(genome_seq).translate(table="standard")).split('*')[0]
46+
count = 0
47+
for record in SeqIO.parse(self.filepath, "genbank"):
48+
genome_seq = record.seq
49+
for feature in record.features:
50+
if feature.type == "CDS":
51+
parts = getattr(feature.location, 'parts', [feature.location])
52+
for part in parts:
53+
#translate, then convert to string
54+
_ = str(part.extract(genome_seq).translate(table=11)).split('*')[0]
5455
count += 1
55-
return count
56+
return count
5657
else: # pipeline context
5758
cli_cmd = self.rust_cli if engine == 'rust' else self.python_cli
5859
return subprocess.run(

microbiorust-py/benchmarks/bp_equivalent_gbktofaacount.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def main():
1616
if feature.type == "CDS":
1717
parts = getattr(feature.location, 'parts', [feature.location])
1818
for part in parts:
19-
_ = str(part.extract(genome_seq).translate(table="Standard")).split('*')[0]
19+
_ = str(part.extract(genome_seq).translate(table=11)).split('*')[0]
2020
count += 1
2121
# Minimal output to match Rust tool behavior
2222
output = open("rhiz_bp.txt", 'w')

0 commit comments

Comments
 (0)