KarrLab/datanator

View on GitHub
datanator/data_source/rna_halflife/doi_10_1093_nar_gkt1150.py

Summary

Maintainability
D
2 days
Test Coverage
F
29%

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

    def __init__(self, cache_dir=None, server=None, src_db=None, protein_col=None,
Severity: Major
Found in datanator/data_source/rna_halflife/doi_10_1093_nar_gkt1150.py - About 1 hr to fix

    Function fill_rna_half_life has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def fill_rna_half_life(self, df, species):
            """Load df into rna_halflife collection
            
            Args:
                df (:obj:`pandas.DataFrame`): dataframe to be loaded
    Severity: Minor
    Found in datanator/data_source/rna_halflife/doi_10_1093_nar_gkt1150.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 5 locations. Consider refactoring.
    Open

        def __init__(self, cache_dir=None, server=None, src_db=None, protein_col=None,
                    authDB=None, readPreference=None, username=None, password=None,
                    verbose=None, max_entries=None, des_db=None, rna_col=None):
            """Init
            
    datanator/data_source/rna_halflife/doi_10_1016_j_cell_2013_12_026.py on lines 13..36
    datanator/data_source/rna_halflife/doi_10_1038_srep01318.py on lines 12..35
    datanator/data_source/rna_halflife/doi_10_1101_gr_131037_111.py on lines 14..37
    datanator/data_source/rna_halflife/doi_10_1371_journal_pone_0059059.py on lines 15..38

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

    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

                dic_0 = {'halflife': a, 'variation_coefficient': vc_a, 'species': species[0], 'ncbi_taxonomy_id': species[1],
                        'unit': 's', 'reference': [{'doi': '10.1093/nar/gkt1150'}], 'growth_medium': 'M9 minimal medium supplemented with glucose',
                        'ordered_locus_name': oln, 'doubling_time': {'value': 6.9, 'unit': 'h'}}
    datanator/data_source/rna_halflife/doi_10_1093_nar_gkt1150.py on lines 66..68
    datanator/data_source/rna_halflife/doi_10_1093_nar_gkt1150.py on lines 69..71
    datanator/data_source/rna_halflife/doi_10_1093_nar_gkt1150.py on lines 72..74

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

    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

                dic_3 = {'halflife': d, 'variation_coefficient': vc_d, 'species': species[0], 'ncbi_taxonomy_id': species[1],
                        'unit': 's', 'reference': [{'doi': '10.1093/nar/gkt1150'}], 'growth_medium': 'M9 minimal medium supplemented with glucose',
                        'ordered_locus_name': oln, 'doubling_time': {'value': 1.7, 'unit': 'h'}}
    datanator/data_source/rna_halflife/doi_10_1093_nar_gkt1150.py on lines 63..65
    datanator/data_source/rna_halflife/doi_10_1093_nar_gkt1150.py on lines 66..68
    datanator/data_source/rna_halflife/doi_10_1093_nar_gkt1150.py on lines 69..71

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

    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

                dic_1 = {'halflife': b, 'variation_coefficient': vc_b, 'species': species[0], 'ncbi_taxonomy_id': species[1],
                        'unit': 's', 'reference': [{'doi': '10.1093/nar/gkt1150'}], 'growth_medium': 'M9 minimal medium supplemented with glucose',
                        'ordered_locus_name': oln, 'doubling_time': {'value': 3.5, 'unit': 'h'}}
    datanator/data_source/rna_halflife/doi_10_1093_nar_gkt1150.py on lines 63..65
    datanator/data_source/rna_halflife/doi_10_1093_nar_gkt1150.py on lines 69..71
    datanator/data_source/rna_halflife/doi_10_1093_nar_gkt1150.py on lines 72..74

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

    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

                dic_2 = {'halflife': c, 'variation_coefficient': vc_c, 'species': species[0], 'ncbi_taxonomy_id': species[1],
                        'unit': 's', 'reference': [{'doi': '10.1093/nar/gkt1150'}], 'growth_medium': 'M9 minimal medium supplemented with glucose',
                        'ordered_locus_name': oln, 'doubling_time': {'value': 2.3, 'unit': 'h'}}
    datanator/data_source/rna_halflife/doi_10_1093_nar_gkt1150.py on lines 63..65
    datanator/data_source/rna_halflife/doi_10_1093_nar_gkt1150.py on lines 66..68
    datanator/data_source/rna_halflife/doi_10_1093_nar_gkt1150.py on lines 72..74

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

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

        src = Halflife(server=server, src_db=src_db,
            protein_col=protein_col, authDB='admin', readPreference='nearest',
            username=username, password=password, verbose=True, max_entries=float('inf'),
    datanator/data_source/rna_halflife/doi_10_1016_j_cell_2013_12_026.py on lines 91..93
    datanator/data_source/rna_halflife/doi_10_1038_srep01318.py on lines 122..124
    datanator/data_source/rna_halflife/doi_10_1091_mbc_e11_01_0028.py on lines 93..95
    datanator/data_source/rna_halflife/doi_10_1101_gr_131037_111.py on lines 144..146
    datanator/data_source/rna_halflife/doi_10_1371_journal_pone_0059059.py on lines 118..120

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

    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

                self.rna_hl_collection.update_one({'gene_name': gene_name},
                                            {'$addToSet': {'halflives': {'$each': halflives},
                                                            'protein_synonyms': protein_name}},
                                            collation=self.collation, upsert=True)
    datanator/data_source/rna_halflife/doi_10_1371_journal_pone_0059059.py on lines 88..91

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

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

                if i % 10 == 0 and self.verbose:
                    print("Processing locus {} out {}".format(i, row_count))
    Severity: Major
    Found in datanator/data_source/rna_halflife/doi_10_1093_nar_gkt1150.py and 13 other locations - About 35 mins to fix
    datanator/data_source/metabolite_concentration/doi_10_1038_nchembio_2077.py on lines 246..247
    datanator/data_source/metabolite_concentration/doi_10_1038_nchembio_2077.py on lines 307..308
    datanator/data_source/metabolites_meta_collection.py on lines 149..150
    datanator/data_source/rna_halflife/doi_10_1016_j_cell_2013_12_026.py on lines 48..49
    datanator/data_source/rna_halflife/doi_10_1038_srep01318.py on lines 49..50
    datanator/data_source/rna_halflife/doi_10_1091_mbc_e11_01_0028.py on lines 54..55
    datanator/data_source/rna_halflife/doi_10_1093_nar_gks1019.py on lines 58..59
    datanator/data_source/rna_halflife/doi_10_1093_nar_gks1019.py on lines 75..76
    datanator/data_source/rna_halflife/doi_10_1101_gr_131037_111.py on lines 72..73
    datanator/data_source/rna_halflife/doi_10_1186_gb_2012_13_4_r30.py on lines 61..62
    datanator/data_source/rna_halflife/doi_10_1371_journal_pone_0059059.py on lines 57..58
    datanator/data_source/rna_modification/rna_modification.py on lines 40..41
    datanator/data_source/rna_modification/rna_modification.py on lines 69..70

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

    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

    There are no issues that match your filters.

    Category
    Status