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

pp.pad_seqs_sdata error #44

Open
treblegaia opened this issue Dec 13, 2023 · 1 comment
Open

pp.pad_seqs_sdata error #44

treblegaia opened this issue Dec 13, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@treblegaia
Copy link

pp.pad_seqs_sdata(sdata, length=1000,seq_var="hg38")
Run the above line and I got this error:
---> [97] padded_seqs = sp.pad_seqs(seqs=sdata["seq"].values, pad=pad, pad_value=pad_value, length=length)
[98] sdata[f"{seq_var}_padded"] = xr.DataArray(padded_seqs, dims=["_sequence", "length"])
--> [185] raise KeyError(key)
KeyError: 'seq'
https://github.com/ML4GLand/EUGENe/blob/13db749d9a639d8baf0a92f536b6dcca02e9c838/eugene/preprocess/_seqdata.py#L97C101-L97C101
Does it mean seq_var of the sdata have to be ”seq“

@adamklie adamklie added the bug Something isn't working label Dec 13, 2023
@adamklie adamklie self-assigned this Dec 13, 2023
@adamklie
Copy link
Collaborator

Thanks for raising this issue!

Yes, pad_seqs_sdata will need updated to actually use the seq_var. For now you can run:

import seqpro as sp
import xarray as xr
padded_seqs = sp.pad_seqs(seqs=sdata["hg38"].values, length=1000)
sdata["hg38_padded"] = xr.DataArray(padded_seqs, dims=["_sequence", "length"])

or you can change the variable name to "seq" using:

sdata.rename_vars({"hg38", "seq")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants