sjteresi / TE_Density

Python script calculating transposable element density for all genes in a genome. Publication: https://mobilednajournal.biomedcentral.com/articles/10.1186/s13100-022-00264-4
GNU General Public License v3.0
28 stars 4 forks source link

add one liner docstrings #50

Closed teresi closed 2 years ago

teresi commented 3 years ago

Each definition needs to have a one liner that explains the gist. A second paragraph under that is where additional info can be added.

20-40 lines of an explanation to your function indicates that your function is doing too much

Instead of

    def my_func(*args, **kwargs):
        """
        A callable, used on the thing, if you need that thing, that then does this
        thing but only after mutating this thing
        """

do this

    def my_func(*args, **kwargs):
        """Does the thing.

            Additional info.
        """

also

instead of (using an example from revise_annotation)

    def iterate_call_merge(self, modified_transposon_data, te_type_to_split):
        """
        This is an entry point, define self variables and initiate the search
        space functions.

        Create the updated TE annotation for each TE grouping. Concatenate all
        of them when done to produce the finalized version of the transposon
        annotation. Iterates over the separate TE frames.

        te_type_to_split (str): The TE identity to perform the merge on.

Do this

    def _reset(self):
        """Reinitialize instance variables."""

    def merge(self, modified_transposon_data, te_type_to_split):
         """Create the updated TE annotation for each TE grouping.

             Other stuff.

             Args:
                    modified_transposon_data(<type): <desc>
                    <etc.>
         """

    def _merge_subset(self, sub_chrom, progress):
        """Return one revised TE annoations."""