Skip to content

Commit

Permalink
fix parsing error for strand circularity in oat's new topology reader
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikPoppleton committed Oct 7, 2024
1 parent e753007 commit a168f8d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
13 changes: 13 additions & 0 deletions analysis/src/oxDNA_analysis_tools/UTILS/data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ class System:
strands (List[Strand]) : A list of Strand objects
"""

top_file: str
strands: List[Strand]

def __init__(self, top_file:str='', strands:List = []):
self.top_file = top_file
self.strands = strands
Expand Down Expand Up @@ -138,6 +141,12 @@ class Strand:
circular (bool) : Is this a circular strand? (default : False)
"""

__from_old: bool
id: int
monomers: List[Monomer]
type: str
circular: bool

def __init__(self, id, *initial_data, **kwargs):
self.__from_old = False
self.id = id
Expand All @@ -149,7 +158,11 @@ def __init__(self, id, *initial_data, **kwargs):
setattr(self, key, dictionary[key])
for key in kwargs:
setattr(self, key, kwargs[key])

# the initial values come in as strings, so ones with known types must be set.
self.id = int(self.id)
if isinstance(self.circular, str):
self.circular = self.circular.lower() == "true"

def __getitem__(self, key:int):
return self.monomers[key]
Expand Down
2 changes: 1 addition & 1 deletion analysis/src/oxDNA_analysis_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.4.0'
__version__ = '2.4.2'
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#see: https://dna.physics.ox.ac.uk/index.php/Documentation#External_Forces
# TODO: "group_name" and "id" need to be added as optional parameters to forces
from typing import Dict, List, Literal

def mutual_trap(particle:int, ref_particle:int, stiff:float, r0:float, PBC:bool, rate:float=0, stiff_rate:float=0) -> Dict:
Expand Down
4 changes: 2 additions & 2 deletions analysis/src/oxDNA_analysis_tools/oxDNA_PDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,12 @@ def oxDNA_PDB(conf:Configuration, system:System, out_basename:str, protein_pdb_f
if strand.is_old():
if nucleotide == strand.monomers[0] and not strand.is_circular():
residue_type = "3"
elif nucleotide == strand.monomers[-1]:
elif nucleotide == strand.monomers[-1] and not strand.is_circular():
residue_type = "5"
else:
if nucleotide == strand.monomers[0] and not strand.is_circular():
residue_type = "5"
elif nucleotide == strand.monomers[-1]:
elif nucleotide == strand.monomers[-1] and not strand.is_circular():
residue_type = "3"

nuc_data = {
Expand Down

0 comments on commit a168f8d

Please sign in to comment.