Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to ensure dataframe indices still match after adjustments #551

Merged
merged 1 commit into from
Dec 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cnvlib/fix.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,29 @@ def load_adjust_coverages(cnarr, ref_cnarr, skip_low,
logging.warning("WARNING: most bins have no or very low coverage; "
"check that the right BED file was used")
else:
cnarr_index_reset = False
if fix_gc:
if 'gc' in ref_matched:
logging.info("Correcting for GC bias...")
cnarr = center_by_window(cnarr, .1, ref_matched['gc'])
cnarr_index_reset = True
else:
logging.warning("WARNING: Skipping correction for GC bias")
if fix_edge:
logging.info("Correcting for density bias...")
edge_bias = get_edge_bias(cnarr, params.INSERT_SIZE)
cnarr = center_by_window(cnarr, .1, edge_bias)
cnarr_index_reset = True
if fix_rmask:
if 'rmask' in ref_matched:
logging.info("Correcting for RepeatMasker bias...")
cnarr = center_by_window(cnarr, .1, ref_matched['rmask'])
cnarr_index_reset = True
else:
logging.warning("WARNING: Skipping correction for "
"RepeatMasker bias")
if cnarr_index_reset:
ref_matched.data.reset_index(drop=True, inplace=True)
return cnarr, ref_matched


Expand Down