Showing 46 of 167 total issues
Function __init__
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, filepath_or_object, mode="rb", max_cache=128, index_filename=None,
filename=None, check_header=False, check_sq=True, reference_filename=None,
filepath_index=None, require_index=False, duplicate_filehandle=None,
ignore_truncation=False):
"""Initialize the class.
- 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 __init__
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, _io):
"""Instantiating the read parser just needs access to the BGZF io.object
Args:
io (BgzfReader): parser for processing BGZF files
- 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 mate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def mate(self, AlignedSegment):
""" Gets the mate to a given AlignedSegment.
Note:
Slow, when compared to the C-API. Not meant for high-throughput analysis.
- 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 _range_popper
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _range_popper(self, interval_start, interval_stop=None, front=True):
"""Simple pop method that accepts a range instead of a single value. Modifies the original bytearray by removing items
Note:
Pops from the front of the list by default. If `front` is set to `False`, it
- 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 get_ref
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_ref(self, ref_id=None, idx=False):
"""Interatively unpacks all the bins, linear intervals, and chunks for a given reference
A reference is comprised of 2 things: 1) a series of bins that reference chunks of aligned
reads that are grouped within that bin. 2) a series of virtual offsets of the first read of a
- 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 _init_index
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _init_index(self):
"""Initialize the index file (BAI)"""
if self._check_idx:
# self._index = bamnostic.bai.Bai(self._index_path)
- 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 len(split_field) > 2:
tag = split_field[0]
value = split_field[2]
else:
tag, value = split_field
Avoid deeply nested control flow statements. Open
if seg_qual[index] >= base_qual_thresh:
yield base, start_pos
else:
Function _cross_check_header_refs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _cross_check_header_refs(reads, header="", referencenames = None, referencelengths = None):
"""Modified code from Peter Cock's [BamWriter](https://github.com/peterjc/biopython/blob/SamBam2015/Bio/Sequencing/SamBam/__init__.py#L1714)
"""
if not header:
# If the reads argument is a SamIterator or BamIterator this works:
- 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 start <= index < stop:
if base == 'A':
adenine[index - start if index-start > 0 else 0] += 1
elif base == 'G':
guanine[index - start if index-start > 0 else 0] += 1
Avoid deeply nested control flow statements. Open
if qualities is not None:
if seg_qual[index] >= base_qual_thresh:
yield base, start_pos
else:
yield base, start_pos
Function get_ref
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_ref(self, ref_id=None, idx=False):
"""Iteratively unpacks all the bins, linear intervals, and chunks for a given reference
A reference is comprised of 2 things: 1) a series of bins that reference chunks of aligned
reads that are grouped within that bin. 2) a series of virtual offsets of the first read of a
- 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 md_changes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def md_changes(seq, md_tag):
"""Recreates the reference sequence of a given alignment to the extent that the
MD tag can represent.
Note:
- 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 reg2bins
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def reg2bins(rbeg, rend):
"""Generates bin ids which overlap the specified region.
Args:
rbeg (int): inclusive beginning position of region
- 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 update
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update(self, others):
""" Same as a regular `dict.update`, however, since pypy's `dict.update`
doesn't go through `dict.__setitem__`, this is used to ensure it does
Args:
- 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 cigar_changes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def cigar_changes(seq, cigar):
"""Recreates the reference sequence to the extent that the CIGAR string can
represent.
Args:
- 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 too many return
statements within this function. Open
return
Avoid too many return
statements within this function. Open
return
Avoid too many return
statements within this function. Open
return data
Avoid too many return
statements within this function. Open
return