Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pd.DataFrame(chromsizes).reset_index().rename(columns={"index": ck1})
)
elif isinstance(chromsizes, pd.DataFrame):
df_chroms = chromsizes.copy()
else:
raise ValueError("unknown input type for chromsizes")
if isinstance(midpoints, dict):
df_mids = pd.DataFrame.from_dict(midpoints, orient="index", columns=[sk2])
df_mids.reset_index(inplace=True)
df_mids.rename(columns={"index": ck2}, inplace=True)
elif isinstance(midpoints, pd.DataFrame):
df_mids = midpoints.copy()
ops._verify_columns(df_mids, [ck2, sk2])
ops._verify_columns(df_chroms, [ck1, sk1])
df_chroms["start"] = 0
df_chroms["end"] = df_chroms[sk1].values
df_chromarms = ops.split(
df_chroms,
df_mids,
add_names=True,
cols=(ck1, "start", "end"),
cols_points=(ck2, sk2),
suffixes=suffixes,
)
df_chromarms["name"].replace("[\:\[].*?[\)\_]", "", regex=True, inplace=True)
df_chromarms.drop(columns=["index_2", "length"], inplace=True)
return df_chromarms
df_chroms = (
pd.DataFrame(chromsizes).reset_index().rename(columns={"index": ck1})
)
elif isinstance(chromsizes, pd.DataFrame):
df_chroms = chromsizes.copy()
else:
raise ValueError("unknown input type for chromsizes")
if isinstance(midpoints, dict):
df_mids = pd.DataFrame.from_dict(midpoints, orient="index", columns=[sk2])
df_mids.reset_index(inplace=True)
df_mids.rename(columns={"index": ck2}, inplace=True)
elif isinstance(midpoints, pd.DataFrame):
df_mids = midpoints.copy()
ops._verify_columns(df_mids, [ck2, sk2])
ops._verify_columns(df_chroms, [ck1, sk1])
df_chroms["start"] = 0
df_chroms["end"] = df_chroms[sk1].values
df_chromarms = ops.split(
df_chroms,
df_mids,
add_names=True,
cols=(ck1, "start", "end"),
cols_points=(ck2, sk2),
suffixes=suffixes,
)
df_chromarms["name"].replace("[\:\[].*?[\)\_]", "", regex=True, inplace=True)
df_chromarms.drop(columns=["index_2", "length"], inplace=True)
return df_chromarms