mythos.input.topology ===================== .. py:module:: mythos.input.topology .. autoapi-nested-parse:: Topological information for DNA/RNA. Attributes ---------- .. autoapisummary:: mythos.input.topology.N_1ST_LINE_OXDNA_CLASSIC mythos.input.topology.N_1ST_LINE_OXDNA_NEW mythos.input.topology.VALID_NEIGHBOR_SECOND_DIM mythos.input.topology.ERR_TOPOLOGY_INVALID_NUMBER_NUCLEOTIDES mythos.input.topology.ERR_TOPOLOGY_INVALID_STRAND_COUNTS mythos.input.topology.ERR_TOPOLOGY_SEQ_NOT_MATCH_NUCLEOTIDES mythos.input.topology.ERR_TOPOLOGY_STRAND_COUNTS_NOT_MATCH mythos.input.topology.ERR_TOPOLOGY_BONDED_NEIGHBORS_INVALID_SHAPE mythos.input.topology.ERR_TOPOLOGY_UNBONDED_NEIGHBORS_INVALID_SHAPE mythos.input.topology.ERR_TOPOLOGY_INVALID_SEQUENCE_LENGTH mythos.input.topology.ERR_TOPOLOGY_INVALID_SEQUENCE_NUCLEOTIDES mythos.input.topology.ERR_TOPOLOGY_INVALID_DISCRETE_SEQUENCE_SHAPE mythos.input.topology.ERR_TOPOLOGY_INVALID_UNPAIRED_PSEQ_SHAPE mythos.input.topology.ERR_TOPOLOGY_MISMATCH_PSEQ_SHAPE_NUM_NUCLEOTIDES mythos.input.topology.ERR_TOPOLOGY_INVALID_BP_PSEQ_SHAPE mythos.input.topology.ERR_TOPOLOGY_INVALID_PROBABILITIES mythos.input.topology.ERR_TOPOLOGY_PSEQ_NOT_NORMALIZED mythos.input.topology.ERR_INVALID_OXDNA_FORMAT mythos.input.topology.ERR_STRAND_COUNTS_CIRCULAR_MISMATCH mythos.input.topology.ERR_FILE_NOT_FOUND mythos.input.topology.ERR_TOPOLOGY_INVALID_SEQUENCE_TYPE mythos.input.topology.WARN_CLASSIC_UNSPECIFIED_NT_TYPE mythos.input.topology.WARN_NEW_UNSPECIFIED_NT_TYPE Classes ------- .. autoapisummary:: mythos.input.topology.NucleotideType mythos.input.topology.Topology Functions --------- .. autoapisummary:: mythos.input.topology.check_valid_seq mythos.input.topology.from_oxdna_file mythos.input.topology._determine_oxdna_format mythos.input.topology._get_bonded_neighbors mythos.input.topology._get_unbonded_neighbors mythos.input.topology._from_file_oxdna_classic mythos.input.topology._from_file_oxdna_new Module Contents --------------- .. py:data:: N_1ST_LINE_OXDNA_CLASSIC :value: 2 .. py:data:: N_1ST_LINE_OXDNA_NEW :value: 3 .. py:data:: VALID_NEIGHBOR_SECOND_DIM :value: 2 .. py:data:: ERR_TOPOLOGY_INVALID_NUMBER_NUCLEOTIDES :value: 'Invalid number of nucleotides' .. py:data:: ERR_TOPOLOGY_INVALID_STRAND_COUNTS :value: 'Invalid strand counts' .. py:data:: ERR_TOPOLOGY_SEQ_NOT_MATCH_NUCLEOTIDES :value: 'Sequence does not match number of nucleotides' .. py:data:: ERR_TOPOLOGY_STRAND_COUNTS_NOT_MATCH :value: 'Strand counts do not match number of nucleotides' .. py:data:: ERR_TOPOLOGY_BONDED_NEIGHBORS_INVALID_SHAPE :value: 'Invalid bonded neighbors shape' .. py:data:: ERR_TOPOLOGY_UNBONDED_NEIGHBORS_INVALID_SHAPE :value: 'Invalid unbonded neighbors shape' .. py:data:: ERR_TOPOLOGY_INVALID_SEQUENCE_LENGTH :value: 'Invalid sequence length' .. py:data:: ERR_TOPOLOGY_INVALID_SEQUENCE_NUCLEOTIDES :value: 'Invalid sequence nucleotides' .. py:data:: ERR_TOPOLOGY_INVALID_DISCRETE_SEQUENCE_SHAPE :value: 'Invalid discrete sequence shape' .. py:data:: ERR_TOPOLOGY_INVALID_UNPAIRED_PSEQ_SHAPE :value: 'Invalid unpaired probabilistic sequence shape' .. py:data:: ERR_TOPOLOGY_MISMATCH_PSEQ_SHAPE_NUM_NUCLEOTIDES :value: 'Pseq shape does not match number of nucleotides' .. py:data:: ERR_TOPOLOGY_INVALID_BP_PSEQ_SHAPE :value: 'Invalid base-paired probabilistic sequence shape' .. py:data:: ERR_TOPOLOGY_INVALID_PROBABILITIES :value: 'Probabilities must be > 0' .. py:data:: ERR_TOPOLOGY_PSEQ_NOT_NORMALIZED :value: 'Probabilities must be normalized' .. py:data:: ERR_INVALID_OXDNA_FORMAT :value: 'Invalid oxDNA topology format. See... .. py:data:: ERR_STRAND_COUNTS_CIRCULAR_MISMATCH :value: 'Strand counts and cicularity do not match' .. py:data:: ERR_FILE_NOT_FOUND :value: 'Topology file not found' .. py:data:: ERR_TOPOLOGY_INVALID_SEQUENCE_TYPE :value: 'Invalid sequence type. Must be discrete or probabilistic' .. py:data:: WARN_CLASSIC_UNSPECIFIED_NT_TYPE :value: 'Type of strand {strand_idx} not specified, and did not find T/U for autodetect' .. py:data:: WARN_NEW_UNSPECIFIED_NT_TYPE :value: 'Type of strand {strand_idx} not specified' .. py:class:: NucleotideType Bases: :py:obj:`enum.IntEnum` Defines nucleotide types as integer enumerations. .. py:attribute:: UNSPECIFIED :value: 0 .. py:attribute:: DNA :value: 1 .. py:attribute:: RNA :value: 2 .. py:function:: check_valid_seq(seq: mythos.utils.types.Sequence, n_nucleotides: int) -> None Checks if a sequence is well-formed. .. py:class:: Topology Topology information for a RNA/DNA strand. .. py:attribute:: n_nucleotides :type: int .. py:attribute:: strand_counts :type: numpy.ndarray .. py:attribute:: bonded_neighbors :type: numpy.ndarray .. py:attribute:: unbonded_neighbors :type: numpy.ndarray .. py:attribute:: seq :type: mythos.utils.types.Sequence .. py:attribute:: is_end :type: numpy.ndarray .. py:attribute:: nt_type :type: numpy.ndarray .. py:method:: __post_init__() -> None Check that the topology is valid. .. py:function:: from_oxdna_file(path: mythos.utils.types.PathOrStr, *, return_format: bool = False) -> Topology | tuple[Topology, mythos.utils.types.oxDNAFormat] Read topology information from an oxDNA file. :param path: Path to the oxDNA topology file. :type path: typ.PathOrStr :param return_format: Whether to return the oxDNA format along with the topology as a tuple (top, fmt). Defaults to False. :type return_format: bool, optional :returns: The parsed topology, and optionally the format. :rtype: Topology or tuple[Topology, typ.oxDNAFormat] .. py:function:: _determine_oxdna_format(first_line: str) -> tuple[mythos.utils.types.oxDNAFormat, collections.abc.Callable[[list[str]], Topology]] Determine the format of an oxDNA file from the first line of the file. .. py:function:: _get_bonded_neighbors(strand_lengths: list[int], is_circular: list[bool]) -> list[tuple[int, int]] Convert 5' neighbors to bonded neighbors by index. .. py:function:: _get_unbonded_neighbors(n_nucleotides: int, bonded_neighbors: list[tuple[int, int]]) -> list[tuple[int, int]] Get unbonded neighbors. .. py:function:: _from_file_oxdna_classic(lines: list[str]) -> Topology 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. :param lines: lines from topology file :type lines: List[str] :returns: Topology object :rtype: Topology .. py:function:: _from_file_oxdna_new(lines: list[str]) -> Topology