actionable, usually focal, CNAs. Real and potentially informative but
lower-level CNAs will be merged together.
return segarr
@require_column("depth")
def bic(segarr):
After Change
actionable, usually focal, CNAs. Real and potentially informative but
lower-level CNAs will be merged together.
levels = pd.Series(np.zeros(len(segarr)))
levels[segarr["cn"] == 0] = -1
levels[segarr["cn"] >= 5] = 1
// or: segarr["log2"] >= np.log2(2.5)
// TODO - handle a/b allele amplifications separately
// i.e. don"t merge amplified segments if cn1, cn2 are not the same
groups = levels.diff().fillna(0).abs().cumsum().astype(int)
groups += enumerate_chroms(segarr["chromosome"])
squashed = (segarr.data.assign(group=groups)
.groupby("group", as_index=False, group_keys=False, sort=False)
.apply(squash_region))
return segarr.as_dataframe(squashed)
@require_column("depth")
def bic(segarr):