Skip to content

Commit

Permalink
Merge pull request #72 from gbouras13/dev
Browse files Browse the repository at this point in the history
v0.6.0
  • Loading branch information
gbouras13 authored Feb 1, 2024
2 parents 12f2603 + a296b9b commit 3bdd28a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 14 deletions.
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# History

# 0.6.0 (2024-01-31)

* Fixes bug where if the starting gene (dnaA/terL/repA) was on the reverse strand and the top BLAST hit did not find the start codon, it would reorient the replicon to begin at the end of the starting gene, not the start. Thanks @susiegriggo

# 0.5.2 (2024-01-24)

* Bumps version to include updated citation
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dnaapler"
version = "0.5.2" # change VERSION too
version = "0.6.0" # change VERSION too
description = "Reorients assembled microbial sequences"
authors = ["George Bouras <[email protected]>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion src/dnaapler/utils/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.2
0.6.0
21 changes: 19 additions & 2 deletions src/dnaapler/utils/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,19 @@ def reorient_sequence(
# Find the gene with the max overlap
closest_gene_index = max(overlap_dict, key=lambda key: overlap_dict[key])

start = genes[closest_gene_index].begin
# get strand
strand = genes[closest_gene_index].strand

# susie error 30-01-24 - misorienting on the negative strand
# 'begin' just gives the lowest value, not the start, so was putting the terL at the end i.e. reorienting from the end of terL
# therefore need to take end
if strand == 1:
start = genes[closest_gene_index].begin
elif strand == -1:
start = genes[closest_gene_index].end

start = genes[closest_gene_index].begin

if strand == 1:
strand_eng = "forward"
else:
Expand Down Expand Up @@ -405,9 +415,16 @@ def reorient_single_record_bulk(
# Find the gene with the max overlap
closest_gene_index = max(overlap_dict, key=lambda key: overlap_dict[key])

start = genes[closest_gene_index].begin
strand = genes[closest_gene_index].strand

# susie error 30-01-24 - misorienting on the negative strand
# 'begin' just gives the lowest value, not the start, so was putting the terL at the end i.e. reorienting from the end of terL
# therefore need to take end
if strand == 1:
start = genes[closest_gene_index].begin
elif strand == -1:
start = genes[closest_gene_index].end

####################
# reorientation
####################
Expand Down
20 changes: 10 additions & 10 deletions src/dnaapler/utils/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ def validate_fasta(input_fasta: Path) -> None:

def validate_fasta_bulk(input_fasta: Path) -> None:
"""
Validates FASTA input - that the input is a FASTA with > 1 sequence
Validates FASTA input - that the input is a FASTA with at least 1 sequence
"""
logger.info(
f"Checking that the input file {input_fasta} is in FASTA format and has more than 1 entry."
f"Checking that the input file {input_fasta} is in FASTA format and has at least 1 entry."
)
# to get extension
with open(input_fasta, "r") as handle:
Expand All @@ -83,14 +83,14 @@ def validate_fasta_bulk(input_fasta: Path) -> None:
f"Error: {input_fasta} file is not in the FASTA format. Please check your input file"
)

with open(input_fasta, "r") as handle:
# Check the number of records
if len(list(SeqIO.parse(handle, "fasta"))) == 1:
logger.error(
f"{input_fasta} has only one entry, but more than one was expected. Please check your input FASTA file!"
)
else:
logger.info(f"{input_fasta} has more than one entry.")
# with open(input_fasta, "r") as handle:
# # Check the number of records
# if len(list(SeqIO.parse(handle, "fasta"))) == 1:
# logger.error(
# f"{input_fasta} has only one entry, but more than one was expected. Please check your input FASTA file!"
# )
# else:
# logger.info(f"{input_fasta} has more than one entry.")


def validate_fasta_all(input_fasta: Path) -> None:
Expand Down

0 comments on commit 3bdd28a

Please sign in to comment.