[go: nahoru, domu]

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

[BUG] Impossible to generate de dds objtect with DeseqDataSet with this update #233

Closed
victorsanchezarevalo opened this issue Jan 31, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@victorsanchezarevalo
Copy link

Describe the bug
Impossible to create de DeseqDataSet object with this version. This problem occurs even with the loaded_example_data

To Reproduce
inference = DefaultInference(n_cpus=8)
dds = DeseqDataSet(
counts=counts_df,
metadata=metadata,
design_factors="Condition",
refit_cooks=True,
inference=inference,
# n_cpus=8, # n_cpus can be specified here or in the inference object
)

Expected behavior
Generation of the DeseqDataset dds object

Additional context

KeyError Traceback (most recent call last)
Cell In[279], line 2
1 inference = DefaultInference(n_cpus=8)
----> 2 dds = DeseqDataSet(
3 counts=counts_df,
4 metadata=metadata,
5 design_factors="Condition",
6 refit_cooks=True,
7 inference=inference,
8 # n_cpus=8, # n_cpus can be specified here or in the inference object
9 )

File ~/miniconda3/envs/rnaseq/lib/python3.10/site-packages/pydeseq2/dds.py:216, in DeseqDataSet.init(self, adata, counts, metadata, design_factors, continuous_factors, ref_level, min_mu, min_disp, max_disp, refit_cooks, min_replicates, beta_tol, inference, quiet)
211 self.design_factors = (
212 [design_factors] if isinstance(design_factors, str) else design_factors
213 )
214 self.continuous_factors = continuous_factors
--> 216 if self.obs[self.design_factors].isna().any().any():
217 raise ValueError("NaNs are not allowed in the design factors.")
218 self.obs[self.design_factors] = self.obs[self.design_factors].astype(str)

File ~/miniconda3/envs/rnaseq/lib/python3.10/site-packages/pandas/core/frame.py:4096, in DataFrame.getitem(self, key)
4094 if is_iterator(key):
4095 key = list(key)
...
-> 6248 raise KeyError(f"None of [{key}] are in the [{axis_name}]")
6250 not_found = list(ensure_index(key)[missing_mask.nonzero()[0]].unique())
6251 raise KeyError(f"{not_found} not in index")

KeyError: "None of [Index(['Condition'], dtype='object')] are in the [columns]"

@victorsanchezarevalo victorsanchezarevalo added the bug Something isn't working label Jan 31, 2024
@BorisMuzellec
Copy link
Collaborator

Hi @victorsanchezarevalo! I'm not able to reproduce this issue 🤔.

Are you sure that your metadata has a "Condition" column (with a capital "C")? The example data has a "condition" column with a lower-case "c".

@victorsanchezarevalo
Copy link
Author

Hi Boris,

Indeed, in this instance, the issue stemmed from capitalization, but we explored the example due to problems we encountered while analyzing an RNA-seq dataset. Ultimately, the problem was traced back to a variable name error—frustrating, yet resolved! Sorry for bother you with this and thansk a lot for your patience and assistance.

Best,

Victor

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