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

Scaling by pairs error #240

Open
DekkerBastiaan opened this issue May 9, 2024 · 1 comment
Open

Scaling by pairs error #240

DekkerBastiaan opened this issue May 9, 2024 · 1 comment

Comments

@DekkerBastiaan
Copy link

Hi,

While running scaling by pairs I ran into the following error.

File ~/miniconda3/envs/tools/lib/python3.10/site-packages/pairtools/lib/scaling.py:54, in (.0)
def assign_regs(chroms, pos, regs):
gb_regs = regs.sort_values(["chrom", "start", "end"]).groupby(["chrom"])
regs_dict = {
---> chrom.encode(): regs_per_chrom[["start", "end"]]
.values.flatten()
.astype(np.int64)
for chrom, regs_per_chrom in gb_regs
}
return assign_regs_c(np.asarray(chroms).astype("bytes"), np.asarray(pos), regs_dict)
AttributeError: 'tuple' object has no attribute 'encode'

Perhaps it is due to how my regions dataframe was constructed, but the following change at the groupby function did fix the issue.

regs.sort_values(["chrom", "start", "end"]).groupby(["chrom"])

regs.sort_values(["chrom", "start", "end"]).groupby("chrom")

Let me know if this this is due to my regions formatting or if others will have the same problem.

@golobor
Copy link
Member

golobor commented May 9, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants