Function run
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def run(self, data_file: Optional[str] = None) -> None:
"""Perform transformations to process protein-protein interactions.
Args:
data_file: data file to parse
- Read upRead up
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 load_mapping
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def load_mapping(
self, input_dir: str, output_dir: str, species_id: Optional[List] = None
) -> None:
"""Load Ensembl Gene to Protein mapping from NCBI gene2ensembl (gene2ensembl.gz).
- Read upRead up
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
Avoid deeply nested control flow statements. Open
if protein in string_to_uniprot_id_map:
uniprot_curie = (
f"UniProtKB:{string_to_uniprot_id_map[protein]}"
)
uniprot_curie = collapse_uniprot_curie(uniprot_curie)
Avoid deeply nested control flow statements. Open
if gene not in seen_genes:
seen_genes.add(gene)
ensemble_gene = f"ENSEMBL:{gene}"
gene_informations = self.gene_info_map[
self.ensembl2ncbi_map[gene]
Function load_gene_info
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def load_gene_info(
self, input_dir: str, output_dir: str, species_id: Optional[List] = None
) -> None:
"""Load mappings from NCBI gene_info (gene_info.gz).
- Read upRead up
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"