Skip to content

Commit

Permalink
[FIX](seqpos): replace seqpos
Browse files Browse the repository at this point in the history
  • Loading branch information
PauAndrio committed Nov 15, 2024
1 parent f87fd23 commit 728fb47
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 12 deletions.
10 changes: 7 additions & 3 deletions biobb_dna/backbone/bipopulations.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ def __init__(

self.properties = properties
self.sequence = properties.get("sequence")
# self.seqpos = properties.get("seqpos", None)
self.seqpos = [
int(item) for item in _from_string_to_list(properties.get("seqpos", None))
int(elem) for elem in _from_string_to_list(properties.get("seqpos", None))
]

print("seqpos::::::::")
print(self.seqpos)
# Check the properties
self.check_properties(properties)
self.check_arguments()
Expand All @@ -124,6 +126,8 @@ def launch(self) -> int:
)
if not (isinstance(self.seqpos, list) and len(self.seqpos) > 1):
raise ValueError("seqpos must be a list of at least two integers")
else:
self.seqpos = None # type: ignore

# read input files
epsilC = read_series(
Expand Down Expand Up @@ -192,7 +196,7 @@ def get_xlabels(self, strand1, strand2):
labelsC[-1] = f"{labelsC[-1]}3'"
labelsC = [f"{i}-{j}" for i, j in zip(labelsC, range(len(labelsC), 0, -1))]

if self.seqpos:
if self.seqpos is not None:
labelsC = [labelsC[i] for i in self.seqpos]
labelsW = [labelsW[i] for i in self.seqpos]
xlabels = labelsW + ["-"] + labelsC
Expand Down
2 changes: 2 additions & 0 deletions biobb_dna/backbone/canonicalag.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ def launch(self) -> int:
)
if not (isinstance(self.seqpos, list) and len(self.seqpos) > 1):
raise ValueError("seqpos must be a list of at least two integers")
else:
self.seqpos = None # type: ignore

# read input files
alphaC = read_series(
Expand Down
2 changes: 2 additions & 0 deletions biobb_dna/backbone/puckering.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ def launch(self) -> int:
)
if not (isinstance(self.seqpos, list) and len(self.seqpos) > 1):
raise ValueError("seqpos must be a list of at least two integers")
else:
self.seqpos = None # type: ignore

# read input files
phaseC = read_series(
Expand Down
2 changes: 2 additions & 0 deletions biobb_dna/dna/dna_averages.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ def launch(self) -> int:
)
if not (isinstance(self.seqpos, list) and len(self.seqpos) > 1):
raise ValueError("seqpos must be a list of at least two integers")
else:
self.seqpos = None # type: ignore

# read input .ser file
ser_data = read_series(
Expand Down
2 changes: 2 additions & 0 deletions biobb_dna/stiffness/average_stiffness.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ def launch(self) -> int:
)
if not (isinstance(self.seqpos, list) and len(self.seqpos) > 1):
raise ValueError("seqpos must be a list of at least two integers")
else:
self.seqpos = None # type: ignore

# read input .ser file
ser_data = read_series(
Expand Down
22 changes: 13 additions & 9 deletions biobb_dna/test/unitests/test_backbone/test_bipopulations.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
# type: ignore
import platform

from biobb_common.tools import test_fixtures as fx

from biobb_dna.backbone.bipopulations import bipopulations
import platform


class TestBIPopulations():
class TestBIPopulations:
def setup_class(self):
fx.test_setup(self, 'bipopulations')
fx.test_setup(self, "bipopulations")

def teardown_class(self):
fx.test_teardown(self)
pass

# fx.test_teardown(self)

def test_bipopulations(self):
returncode = bipopulations(properties=self.properties, **self.paths)
assert fx.not_empty(self.paths['output_csv_path'])
assert fx.not_empty(self.paths['output_jpg_path'])
assert fx.not_empty(self.paths["output_csv_path"])
assert fx.not_empty(self.paths["output_jpg_path"])
assert fx.exe_success(returncode)
if platform.system() == 'Darwin':
assert fx.equal(self.paths['output_csv_path'], self.paths['ref_csv_output'])
assert fx.equal(self.paths['output_jpg_path'], self.paths['ref_jpg_output'])
if platform.system() == "Darwin":
assert fx.equal(self.paths["output_csv_path"], self.paths["ref_csv_output"])
assert fx.equal(self.paths["output_jpg_path"], self.paths["ref_jpg_output"])

0 comments on commit 728fb47

Please sign in to comment.