KarrLab/bpforms

View on GitHub

Showing 397 of 397 total issues

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

                if monomer is None:
                    unsupported_codes.add(code)
                    monomer = bpforms.Monomer(id=code)
                else:
                    monomer_codes[code] = monomer
Severity: Major
Found in examples/modomics.py and 1 other location - About 1 hr to fix
examples/modomics.py on lines 118..122

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 44.

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 4 locations. Consider refactoring.
Open

            file.write(('{} monomers were merged into the alphabet because they have the same structures (SMILES):\n'
                        '  PDB-CCD ID\tRESID ID\tPDB Ligand RESID ID\n'
                        '  {}\n\n').format(
                len(same_structures), '\n  '.join(sorted('\t'.join(n) for n in same_structures))))
Severity: Major
Found in bpforms/alphabet/protein.py and 3 other locations - About 1 hr to fix
bpforms/alphabet/protein.py on lines 533..537
bpforms/alphabet/protein.py on lines 539..542
bpforms/alphabet/protein.py on lines 544..547

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 44.

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:
                        unsupported_codes.add(code)
                        monomer = bpforms.Monomer(id=code)
                    else:
                        monomer_codes[code] = monomer
Severity: Major
Found in examples/modomics.py and 1 other location - About 1 hr to fix
examples/modomics.py on lines 127..131

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 44.

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 4 locations. Consider refactoring.
Open

            file.write(('{} monomers were merged into the alphabet because they have the same names:\n'
                        '  PDB-CCD ID\tRESID ID\tName\n'
                        '  {}\n\n').format(
                len(same_names), '\n  '.join(sorted('\t'.join(n) for n in same_names))))
Severity: Major
Found in bpforms/alphabet/protein.py and 3 other locations - About 1 hr to fix
bpforms/alphabet/protein.py on lines 528..531
bpforms/alphabet/protein.py on lines 533..537
bpforms/alphabet/protein.py on lines 544..547

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 44.

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 4 locations. Consider refactoring.
Open

            file.write(('{} monomers were potentially merged incorrectly:\n'
                        '  PDB-CCD ID-1\tPDB-CCD ID-2\n'
                        '  {}\n\n').format(
                len(potential_incorrect_merges), '\n  '.join(sorted('\t'.join(n) for n in potential_incorrect_merges))))
Severity: Major
Found in bpforms/alphabet/protein.py and 3 other locations - About 1 hr to fix
bpforms/alphabet/protein.py on lines 528..531
bpforms/alphabet/protein.py on lines 533..537
bpforms/alphabet/protein.py on lines 539..542

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 44.

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 get_image has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def get_image(self, monomer_color=0x000000, backbone_color=0xff0000,
Severity: Major
Found in bpforms/core.py - About 1 hr to fix

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

                file.write(('{} monomers were merged into the alphabet because they have the same PDB ids (ligand / CCD), '
                            'but different structures (e.g., different stereochemistry or bond order):\n'
                            '  PDB-CCD ID\tPDB-CCD SMILES\tRESID SMILES\n'
                            '  {}\n\n').format(
                    len(same_pdb_ids), '\n  '.join(sorted('\t'.join(n) for n in same_pdb_ids))))
    Severity: Major
    Found in bpforms/alphabet/protein.py and 3 other locations - About 1 hr to fix
    bpforms/alphabet/protein.py on lines 528..531
    bpforms/alphabet/protein.py on lines 539..542
    bpforms/alphabet/protein.py on lines 544..547

    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 44.

    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 __init__ has 12 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, id=None, name=None, synonyms=None,
    Severity: Major
    Found in bpforms/core.py - About 1 hr to fix

      Function gen_html_viz_alphabet has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def gen_html_viz_alphabet(bpform_type, filename):
          """ Create and save an HTML document with images of the monomeric forms in an alphabet
      
          Args:
              bpform_type (:obj:`type`): subclass of :obj:`core.BpForm`
      Severity: Minor
      Found in bpforms/util.py - About 1 hr to fix

        Function liftover_mods has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        def liftover_mods(ref_seq, ref_nc_seq, seq, can_monomers=can_monomers):
            ref_form = bpforms.RnaForm().from_str(ref_nc_seq)
            form = bpforms.RnaForm()
            i_nc_nt = 0
            for i_nt, ref_monomer in enumerate(ref_seq):
        Severity: Minor
        Found in examples/homo_sapiens_rna/curate.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

        Function __str__ has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def __str__(self):
                """ Get a string representation of the biopolymer form
        
                Returns:
                    :obj:`str`: string representation of the biopolymer form
        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

        Function get_charge has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_charge(self, none_position=True):
                """ Get the charge
        
                Args:
                    none_position (:obj:`bool`, optional): include atoms whose position is :obj:`None`
        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 ((i_n_2 is not None) + (i_c_2 is not None)) > ((i_n is not None) + (i_c is not None)):
        Severity: Major
        Found in bpforms/alphabet/protein.py and 1 other location - About 1 hr to fix
        bpforms/alphabet/protein.py on lines 431..431

        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 43.

        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

            def run(self, ph=None, major_tautomer=False, dearomatize=False, path=filename):
                """ Build alphabet and, optionally, save to YAML file
        
                Args:
                    ph (:obj:`float`, optional): pH at which calculate major protonation state of each monomeric form
        Severity: Major
        Found in bpforms/alphabet/rna.py and 2 other locations - About 1 hr to fix
        bpforms/alphabet/dna.py on lines 103..115
        bpforms/alphabet/protein.py on lines 49..61

        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 43.

        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 get_image has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_image(self, monomer_color=0x000000, backbone_color=0xff0000,
                          left_right_bond_color=0x00ff00, crosslink_bond_color=0x0000ff,
                          include_all_hydrogens=True, show_atom_nums=False,
                          atom_label_font_size=0.6,
                          width=200, height=200, image_format='svg', include_xml_header=True):
        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

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

            def run(self, ph=None, major_tautomer=False, dearomatize=False, path=filename):
                """ Build alphabet and, optionally, save to YAML file
        
                Args:
                    ph (:obj:`float`, optional): pH at which calculate major protonation state of each monomeric form
        Severity: Major
        Found in bpforms/alphabet/protein.py and 2 other locations - About 1 hr to fix
        bpforms/alphabet/dna.py on lines 103..115
        bpforms/alphabet/rna.py on lines 46..58

        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 43.

        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 ((i_n_2 is not None) + (i_c_2 is not None)) > ((i_n is not None) + (i_c is not None)):
        Severity: Major
        Found in bpforms/alphabet/protein.py and 1 other location - About 1 hr to fix
        bpforms/alphabet/protein.py on lines 345..345

        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 43.

        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

            def run(self, ph=None, major_tautomer=False, dearomatize=False, path=filename):
                """ Build alphabet and, optionally, save to YAML file
        
                Args:
                    ph (:obj:`float`, optional): pH at which calculate major protonation state of each monomeric form
        Severity: Major
        Found in bpforms/alphabet/dna.py and 2 other locations - About 1 hr to fix
        bpforms/alphabet/protein.py on lines 49..61
        bpforms/alphabet/rna.py on lines 46..58

        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 43.

        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 2 locations. Consider refactoring.
        Open

        fig.savefig(os.path.join('examples', 'modomics.trna.analysis.svg'),
                    transparent=True,
                    bbox_inches=matplotlib.transforms.Bbox([[0.45, -0.31], [5.86, 1.35]]))
        Severity: Major
        Found in examples/modomics_analysis.py and 1 other location - About 1 hr to fix
        examples/modomics_analysis.py on lines 85..87

        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 42.

        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 2 locations. Consider refactoring.
        Open

        fig.savefig(os.path.join('examples', 'modomics.trna.analysis.pdf'),
                    transparent=True,
                    bbox_inches=matplotlib.transforms.Bbox([[0.45, -0.31], [5.86, 1.35]]))
        Severity: Major
        Found in examples/modomics_analysis.py and 1 other location - About 1 hr to fix
        examples/modomics_analysis.py on lines 82..84

        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 42.

        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

        Severity
        Category
        Status
        Source
        Language