KarrLab/bpforms

View on GitHub

Showing 397 of 397 total issues

Function run has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def run():
    # create dict of MODOMICS single character monomer codes
    modomics_short_code_to_monomer = {}
    for monomer in bpforms.rna_alphabet.monomers.values():
        for identifier in monomer.identifiers:
Severity: Minor
Found in examples/modomics.py - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

            if prev_horz and x_link['l_polymer_row'] == x_link['r_polymer_row'] and \
                    x_link['l_track'] == x_link['r_track'] and \
                    x_link['l_polymer_row'] == prev_row and \
                    x_link['l_track'] == prev_track and \
                    (x_link['l_polymer_col'] < prev_col or
    Severity: Critical
    Found in bpforms/util.py - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

              if prev_vert and x_link['l_polymer_col'] == x_link['r_polymer_col'] and \
                      x_link['l_pos'] == x_link['r_pos'] and \
                      x_link['l_polymer_col'] == prev_col and \
                      x_link['l_pos'] == prev_pos and \
                      (x_link['l_polymer_row'] < prev_row or
      Severity: Critical
      Found in bpforms/util.py - About 1 hr to fix

        Similar blocks of code found in 6 locations. Consider refactoring.
        Open

                    if i_left_p is not None:
                        i_left_p = atom_map_2[atom_map[i_left_p]]
                        assert mol.GetAtom(i_left_p).GetAtomicNum() == 15
        Severity: Major
        Found in bpforms/alphabet/dna.py and 5 other locations - About 1 hr to fix
        bpforms/alphabet/dna.py on lines 578..580
        bpforms/alphabet/dna.py on lines 581..583
        bpforms/alphabet/rna.py on lines 725..727
        bpforms/alphabet/rna.py on lines 728..730
        bpforms/alphabet/rna.py on lines 731..733

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 6 locations. Consider refactoring.
        Open

                    if i_left_p is not None:
                        i_left_p = atom_map_2[atom_map[i_left_p]]
                        assert mol.GetAtom(i_left_p).GetAtomicNum() == 15
        Severity: Major
        Found in bpforms/alphabet/rna.py and 5 other locations - About 1 hr to fix
        bpforms/alphabet/dna.py on lines 575..577
        bpforms/alphabet/dna.py on lines 578..580
        bpforms/alphabet/dna.py on lines 581..583
        bpforms/alphabet/rna.py on lines 728..730
        bpforms/alphabet/rna.py on lines 731..733

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 6 locations. Consider refactoring.
        Open

                    if i_left_o is not None:
                        i_left_o = atom_map_2[atom_map[i_left_o]]
                        assert mol.GetAtom(i_left_o).GetAtomicNum() == 8
        Severity: Major
        Found in bpforms/alphabet/rna.py and 5 other locations - About 1 hr to fix
        bpforms/alphabet/dna.py on lines 575..577
        bpforms/alphabet/dna.py on lines 578..580
        bpforms/alphabet/dna.py on lines 581..583
        bpforms/alphabet/rna.py on lines 725..727
        bpforms/alphabet/rna.py on lines 731..733

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 6 locations. Consider refactoring.
        Open

                    if i_right_o is not None:
                        i_right_o = atom_map_2[atom_map[i_right_o]]
                        assert mol.GetAtom(i_right_o).GetAtomicNum() == 8
        Severity: Major
        Found in bpforms/alphabet/rna.py and 5 other locations - About 1 hr to fix
        bpforms/alphabet/dna.py on lines 575..577
        bpforms/alphabet/dna.py on lines 578..580
        bpforms/alphabet/dna.py on lines 581..583
        bpforms/alphabet/rna.py on lines 725..727
        bpforms/alphabet/rna.py on lines 728..730

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            if alphabets is None or 'rna' in alphabets:
                rna.RnaAlphabetBuilder(_max_monomers=_max_monomers).run(ph=ph, major_tautomer=major_tautomer, dearomatize=dearomatize)
        Severity: Major
        Found in bpforms/util.py and 2 other locations - About 1 hr to fix
        bpforms/util.py on lines 99..100
        bpforms/util.py on lines 103..104

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 6 locations. Consider refactoring.
        Open

                    if i_right_o is not None:
                        i_right_o = atom_map_2[atom_map[i_right_o]]
                        assert mol.GetAtom(i_right_o).GetAtomicNum() == 8
        Severity: Major
        Found in bpforms/alphabet/dna.py and 5 other locations - About 1 hr to fix
        bpforms/alphabet/dna.py on lines 575..577
        bpforms/alphabet/dna.py on lines 578..580
        bpforms/alphabet/rna.py on lines 725..727
        bpforms/alphabet/rna.py on lines 728..730
        bpforms/alphabet/rna.py on lines 731..733

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            if alphabets is None or 'protein' in alphabets:
                protein.ProteinAlphabetBuilder(_max_monomers=_max_monomers).run(ph=ph, major_tautomer=major_tautomer, dearomatize=dearomatize)
        Severity: Major
        Found in bpforms/util.py and 2 other locations - About 1 hr to fix
        bpforms/util.py on lines 99..100
        bpforms/util.py on lines 101..102

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 6 locations. Consider refactoring.
        Open

                    if i_left_o is not None:
                        i_left_o = atom_map_2[atom_map[i_left_o]]
                        assert mol.GetAtom(i_left_o).GetAtomicNum() == 8
        Severity: Major
        Found in bpforms/alphabet/dna.py and 5 other locations - About 1 hr to fix
        bpforms/alphabet/dna.py on lines 575..577
        bpforms/alphabet/dna.py on lines 581..583
        bpforms/alphabet/rna.py on lines 725..727
        bpforms/alphabet/rna.py on lines 728..730
        bpforms/alphabet/rna.py on lines 731..733

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            if alphabets is None or 'dna' in alphabets:
                dna.DnaAlphabetBuilder(_max_monomers=_max_monomers).run(ph=ph, major_tautomer=major_tautomer, dearomatize=dearomatize)
        Severity: Major
        Found in bpforms/util.py and 2 other locations - About 1 hr to fix
        bpforms/util.py on lines 101..102
        bpforms/util.py on lines 103..104

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                        if include_annotations:
                            monomer2 = bpforms.Monomer().from_dict(
                                monomer.to_dict(
                                    alphabet=bpforms.protein_alphabet),
                                alphabet=bpforms.protein_alphabet)
        Severity: Major
        Found in examples/pro.py and 1 other location - About 1 hr to fix
        examples/pro.py on lines 671..677

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 45.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function _form_crosslink has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def _form_crosslink(self, mol, atoms, atom_map, order, stereo):
                """ Form bond(s) for a crosslink
        
                Args:
                    mol (:obj:`openbabel.OBMol`): molecule
        Severity: Minor
        Found in bpforms/core.py - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                        if include_annotations:
                            monomer2 = bpforms.Monomer().from_dict(
                                monomer.to_dict(
                                    alphabet=bpforms.protein_alphabet),
                                alphabet=bpforms.protein_alphabet)
        Severity: Major
        Found in examples/pro.py and 1 other location - About 1 hr to fix
        examples/pro.py on lines 698..704

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 45.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                    if monomer is None:
                        monomer = monomer_codes.get(pdb_monomer.id, None)
                        if monomer is not None:
                            same_ids.append(pdb_monomer.id)
        Severity: Major
        Found in bpforms/alphabet/rna.py and 1 other location - About 1 hr to fix
        bpforms/alphabet/dna.py on lines 651..654

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 45.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                    if monomer is None:
                        monomer = monomer_codes.get(pdb_monomer.id, None)
                        if monomer is not None:
                            same_ids.append(pdb_monomer.id)
        Severity: Major
        Found in bpforms/alphabet/dna.py and 1 other location - About 1 hr to fix
        bpforms/alphabet/rna.py on lines 801..804

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 45.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function parse_pdb_ccd_entry has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def parse_pdb_ccd_entry(xml_file, valid_types):
            """ Parse an entry of the PDB CCD
        
            Args:
                xml_file (:obj:`io.BufferedReader`): XML file
        Severity: Minor
        Found in bpforms/alphabet/core.py - About 1 hr to fix

          Function run has 12 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def run(in_obo_filename=IN_OBO_FILENAME, in_pkl_filename=IN_PKL_FILENAME, in_tsv_filename=IN_TSV_FILELANE,
          Severity: Major
          Found in examples/pro.py - About 1 hr to fix

            Function plot_codes has 12 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def plot_codes(code_freq, monomer_codes, axis, ignore_canonical=False, use_rel=True,
            Severity: Major
            Found in examples/modomics.py - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language