Commit 10bc30f8 authored by Ivan Vanat's avatar Ivan Vanat
Browse files

documentation; added forgotten typing

parent a0f1ba8b
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ class Executor:
        self.modules = modules
        self.sequence = sequence

    def run_main_loop(self):
    def run_main_loop(self) -> NoReturn:
        elements: List[BaseElement] = []

        for module in self.modules:
@@ -32,9 +32,11 @@ class Executor:
            else:
                module.output_generator.generate_output(module.tool.output_object)

    def _crop_sequence(self, elements):
    def _crop_sequence(self, elements: List[BaseElement]) -> NoReturn:
        for element in elements:
            self.sequence = self.sequence[:element.location[0]] + self.sequence[element.location[1]:]
            lower_bound = min(element.location)
            upper_bound = max(element.location)
            self.sequence = self.sequence[:lower_bound] + self.sequence[upper_bound:]

    def _recalculate_coordinates(self, nested_list: List[BaseElement]) -> NoReturn:
        for i in reversed(range(len(nested_list) - 1)):
+7 −6
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ class BaseElement:
    Class representing identified element in sequence.

        Attributes:
                location: coordinates of the element in format [lower, higher]
            location: coordinates of the element in format [from, to]
            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
@@ -44,6 +44,7 @@ class BaseElement:
                        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
+11 −12
Original line number Diff line number Diff line
@@ -8,18 +8,19 @@ from nested.entities.domain_dante import DomainDante
class TE(BaseElement):
    possible_domains: List[str] = ["GAG", "PROT", "INT", "RT", "RH", "aRH", "CHD", "CHDCR"]

    """Class representing TE. Every location is in format [from, to].
    """
    Class representing TE. Every location is in format [from, to].

    Attributes:
        ppt (list): location of ppt
        pbs (list): location of pbs
        location (list): position of TE in gene
        ltr_left_location (list): location of left ltr
        ltr_right_location (list): location of right ltr
        tsr_left (list): location of left tsr
        tsr_right (list): location of right tsr
        features (dict): dictionary of features assigned to TE (i.e. list of domains on the optimal path in graph)
        score (float): evaluated score of TE
        ppt: location of ppt
        pbs: location of pbs
        location: position of TE in gene
        ltr_left_location: location of left ltr
        ltr_right_location: location of right ltr
        tsr_left: location of left tsr
        tsr_right: location of right tsr
        features: dictionary of features assigned to TE (i.e. list of domains on the optimal path in graph)
        score: evaluated score of TE
    """

    def __init__(self, ppt: List[int], pbs: List[int], location: List[int],
@@ -35,10 +36,8 @@ class TE(BaseElement):
        self.try_add_feature("tsr_left", tsr_left)
        self.try_add_feature("tsr_right", tsr_right)

        # remove or turn into properties
        self.ppt = ppt
        self.pbs = pbs
        self.location = location
        self.ltr_left_location = ltr_left_location
        self.ltr_right_location = ltr_right_location
        self.tsr_left = tsr_left