Commit aef715bc authored by Ivan Vanat's avatar Ivan Vanat
Browse files

documentation

parent b71e4bcf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -39,4 +39,4 @@ class Executor:
    def _recalculate_coordinates(self, nested_list: List[BaseElement]) -> NoReturn:
        for i in reversed(range(len(nested_list) - 1)):
            for j in range(i + 1, len(nested_list)):
                nested_list[j].recalculate_offset(nested_list[i].location)
                nested_list[j].recalculate_coordinates(nested_list[i].location)
+2 −2
Original line number Diff line number Diff line
@@ -15,9 +15,9 @@ class DiscoveryToolInterface:
        Finds retrotransposons in sequence.
        Args:
            sequence_id: id of the sequence
            sequence: dna sequence
            sequence: DNA sequence

        Returns:
            List[TE]: list of identified retrotransposons
            List of identified retrotransposons
        """
        pass
+5 −2
Original line number Diff line number Diff line
@@ -16,7 +16,10 @@ class ToolInterface:

    def run(self, sequence: Seq) -> List[BaseElement]:
        """
        Runs selected tool, if any arguments are needed they are taken from config.yml or constructor
        Returns: List[BaseElement]
        Runs selected tool, if any arguments are needed they are taken from config.yml or class attributes.
        Args:
            sequence: sequence
        Returns:
            List of identified elements.
        """
        pass
+24 −1
Original line number Diff line number Diff line
@@ -7,6 +7,16 @@ from nested.utils import intervals


class BaseElement:
    """
        Class representing identified element in sequence.

            Attributes:
                location: coordinates of the element in format [lower, higher]
                score: score
                type: type of the element in string, should be used as a key in parent element features dictionary
                features: features of the element
    """

    def __init__(self, location: List[int], score: float,
                 element_type: str,
                 features: Optional[Dict[str, Union["BaseElement", List["BaseElement"]]]] = None):
@@ -15,7 +25,12 @@ class BaseElement:
        self.type = element_type
        self.features = features if features is not None else {}

    def recalculate_offset(self, other_location: List[int]) -> NoReturn:
    def recalculate_coordinates(self, other_location: List[int]) -> NoReturn:
        """
        Recalculates coordinates.
        Args:
            other_location: location of different element
        """
        self.location = intervals.expand(other_location, self.location)

        for feature in self.features.keys():
@@ -27,6 +42,14 @@ class BaseElement:

    def try_add_feature(self, name: str, location: List[int], score: float = 0,
                        feature_type: Type = None) -> NoReturn:
        """
        Tries to create new feature and add it to features dictionary.
        Args:
            name: key in features dictionary and type in created feature
            location: location
            score: score
            feature_type: class which should be instantiated
        """
        if location is None or math.isnan(location[0]):
            return

+10 −9
Original line number Diff line number Diff line
@@ -5,15 +5,16 @@ from nested.entities.base_element import BaseElement


class DomainDante(BaseElement):
    """Class representing domain parsed from blastx output.

    Atrributes:
        evalue (float): evalue (same as blastx output)
        frame (tuple): frame (same as blastx output)
        score (float): score (same as blastx output)
        title (str): title (same as blastx output)
        location (list): location [from, to] (from > to for negative strand)
        type (str): type of domain (AP, GAG, INT, ...)
    """
    Class representing domain parsed from blastx output.

    Attributes:
        evalue: evalue (same as blastx output)
        frame: frame (same as blastx output)
        score: score (same as blastx output)
        title: title (same as blastx output)
        location: location [from, to] (from > to for negative strand)
        type: type of domain (PROT, GAG, INT, ...)
    """

    def __init__(self, evalue: float = None, frame: Tuple[int] = None,
Loading