mythos.input.topology

Topological information for DNA/RNA.

Attributes

N_1ST_LINE_OXDNA_CLASSIC

N_1ST_LINE_OXDNA_NEW

VALID_NEIGHBOR_SECOND_DIM

ERR_TOPOLOGY_INVALID_NUMBER_NUCLEOTIDES

ERR_TOPOLOGY_INVALID_STRAND_COUNTS

ERR_TOPOLOGY_SEQ_NOT_MATCH_NUCLEOTIDES

ERR_TOPOLOGY_STRAND_COUNTS_NOT_MATCH

ERR_TOPOLOGY_BONDED_NEIGHBORS_INVALID_SHAPE

ERR_TOPOLOGY_UNBONDED_NEIGHBORS_INVALID_SHAPE

ERR_TOPOLOGY_INVALID_SEQUENCE_LENGTH

ERR_TOPOLOGY_INVALID_SEQUENCE_NUCLEOTIDES

ERR_TOPOLOGY_INVALID_DISCRETE_SEQUENCE_SHAPE

ERR_TOPOLOGY_INVALID_UNPAIRED_PSEQ_SHAPE

ERR_TOPOLOGY_MISMATCH_PSEQ_SHAPE_NUM_NUCLEOTIDES

ERR_TOPOLOGY_INVALID_BP_PSEQ_SHAPE

ERR_TOPOLOGY_INVALID_PROBABILITIES

ERR_TOPOLOGY_PSEQ_NOT_NORMALIZED

ERR_INVALID_OXDNA_FORMAT

ERR_STRAND_COUNTS_CIRCULAR_MISMATCH

ERR_FILE_NOT_FOUND

ERR_TOPOLOGY_INVALID_SEQUENCE_TYPE

WARN_CLASSIC_UNSPECIFIED_NT_TYPE

WARN_NEW_UNSPECIFIED_NT_TYPE

Classes

NucleotideType

Defines nucleotide types as integer enumerations.

Topology

Topology information for a RNA/DNA strand.

Functions

check_valid_seq(→ None)

Checks if a sequence is well-formed.

from_oxdna_file(→ Topology | tuple[Topology, ...)

Read topology information from an oxDNA file.

_determine_oxdna_format(...)

Determine the format of an oxDNA file from the first line of the file.

_get_bonded_neighbors(→ list[tuple[int, int]])

Convert 5' neighbors to bonded neighbors by index.

_get_unbonded_neighbors(→ list[tuple[int, int]])

Get unbonded neighbors.

_from_file_oxdna_classic(→ Topology)

Read topology information from a file in the classix oxDNA format.

_from_file_oxdna_new(→ Topology)

Module Contents

mythos.input.topology.N_1ST_LINE_OXDNA_CLASSIC = 2
mythos.input.topology.N_1ST_LINE_OXDNA_NEW = 3
mythos.input.topology.VALID_NEIGHBOR_SECOND_DIM = 2
mythos.input.topology.ERR_TOPOLOGY_INVALID_NUMBER_NUCLEOTIDES = 'Invalid number of nucleotides'
mythos.input.topology.ERR_TOPOLOGY_INVALID_STRAND_COUNTS = 'Invalid strand counts'
mythos.input.topology.ERR_TOPOLOGY_SEQ_NOT_MATCH_NUCLEOTIDES = 'Sequence does not match number of nucleotides'
mythos.input.topology.ERR_TOPOLOGY_STRAND_COUNTS_NOT_MATCH = 'Strand counts do not match number of nucleotides'
mythos.input.topology.ERR_TOPOLOGY_BONDED_NEIGHBORS_INVALID_SHAPE = 'Invalid bonded neighbors shape'
mythos.input.topology.ERR_TOPOLOGY_UNBONDED_NEIGHBORS_INVALID_SHAPE = 'Invalid unbonded neighbors shape'
mythos.input.topology.ERR_TOPOLOGY_INVALID_SEQUENCE_LENGTH = 'Invalid sequence length'
mythos.input.topology.ERR_TOPOLOGY_INVALID_SEQUENCE_NUCLEOTIDES = 'Invalid sequence nucleotides'
mythos.input.topology.ERR_TOPOLOGY_INVALID_DISCRETE_SEQUENCE_SHAPE = 'Invalid discrete sequence shape'
mythos.input.topology.ERR_TOPOLOGY_INVALID_UNPAIRED_PSEQ_SHAPE = 'Invalid unpaired probabilistic sequence shape'
mythos.input.topology.ERR_TOPOLOGY_MISMATCH_PSEQ_SHAPE_NUM_NUCLEOTIDES = 'Pseq shape does not match number of nucleotides'
mythos.input.topology.ERR_TOPOLOGY_INVALID_BP_PSEQ_SHAPE = 'Invalid base-paired probabilistic sequence shape'
mythos.input.topology.ERR_TOPOLOGY_INVALID_PROBABILITIES = 'Probabilities must be > 0'
mythos.input.topology.ERR_TOPOLOGY_PSEQ_NOT_NORMALIZED = 'Probabilities must be normalized'
mythos.input.topology.ERR_INVALID_OXDNA_FORMAT = 'Invalid oxDNA topology format. See...
mythos.input.topology.ERR_STRAND_COUNTS_CIRCULAR_MISMATCH = 'Strand counts and cicularity do not match'
mythos.input.topology.ERR_FILE_NOT_FOUND = 'Topology file not found'
mythos.input.topology.ERR_TOPOLOGY_INVALID_SEQUENCE_TYPE = 'Invalid sequence type. Must be discrete or probabilistic'
mythos.input.topology.WARN_CLASSIC_UNSPECIFIED_NT_TYPE = 'Type of strand {strand_idx} not specified, and did not find T/U for autodetect'
mythos.input.topology.WARN_NEW_UNSPECIFIED_NT_TYPE = 'Type of strand {strand_idx} not specified'
class mythos.input.topology.NucleotideType[source]

Bases: enum.IntEnum

Defines nucleotide types as integer enumerations.

UNSPECIFIED = 0
DNA = 1
RNA = 2
mythos.input.topology.check_valid_seq(seq: mythos.utils.types.Sequence, n_nucleotides: int) None[source]

Checks if a sequence is well-formed.

class mythos.input.topology.Topology[source]

Topology information for a RNA/DNA strand.

n_nucleotides: int
strand_counts: numpy.ndarray
bonded_neighbors: numpy.ndarray
unbonded_neighbors: numpy.ndarray
seq: mythos.utils.types.Sequence
is_end: numpy.ndarray
nt_type: numpy.ndarray
__post_init__() None[source]

Check that the topology is valid.

mythos.input.topology.from_oxdna_file(path: mythos.utils.types.PathOrStr, *, return_format: bool = False) Topology | tuple[Topology, mythos.utils.types.oxDNAFormat][source]

Read topology information from an oxDNA file.

Parameters:
  • path (typ.PathOrStr) – Path to the oxDNA topology file.

  • return_format (bool, optional) – Whether to return the oxDNA format along with the topology as a tuple (top, fmt). Defaults to False.

Returns:

The parsed topology, and

optionally the format.

Return type:

Topology or tuple[Topology, typ.oxDNAFormat]

mythos.input.topology._determine_oxdna_format(first_line: str) tuple[mythos.utils.types.oxDNAFormat, collections.abc.Callable[[list[str]], Topology]][source]

Determine the format of an oxDNA file from the first line of the file.

mythos.input.topology._get_bonded_neighbors(strand_lengths: list[int], is_circular: list[bool]) list[tuple[int, int]][source]

Convert 5’ neighbors to bonded neighbors by index.

mythos.input.topology._get_unbonded_neighbors(n_nucleotides: int, bonded_neighbors: list[tuple[int, int]]) list[tuple[int, int]][source]

Get unbonded neighbors.

mythos.input.topology._from_file_oxdna_classic(lines: list[str]) Topology[source]

Read topology information from a file in the classix oxDNA format.

See https://lorenzo-rovigatti.github.io/oxDNA/configurations.html#topology-file for more information.

Parameters:

lines (List[str]) – lines from topology file

Returns:

Topology object

Return type:

Topology

mythos.input.topology._from_file_oxdna_new(lines: list[str]) Topology[source]