[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] KeyError in cooks replacement #237

Closed
chubukov opened this issue Feb 16, 2024 · 0 comments · Fixed by #239
Closed

[BUG] KeyError in cooks replacement #237

chubukov opened this issue Feb 16, 2024 · 0 comments · Fixed by #239
Labels
bug Something isn't working

Comments

@chubukov
Copy link

Describe the bug
KeyError from outlier replacement

To Reproduce

import pydeseq2
from pydeseq2.utils import load_example_data
from pydeseq2.dds import DeseqDataSet
from pydeseq2.ds import DeseqStats

print(f'version == {pydeseq2.__version__}')
counts_df = load_example_data(
    modality="raw_counts",
    dataset="synthetic",
    debug=False,
)

metadata = load_example_data(
    modality="metadata",
    dataset="synthetic",
    debug=False,
)
metadata=metadata.loc[[f'sample{i}' for i in [*range(1,11),*range(91,101)]]]
counts_df=counts_df.loc[metadata.index]

counts_df.loc[:,'geneX']=0
counts_df.loc['sample100','geneX']=100

dds = DeseqDataSet(
    counts=counts_df,
    metadata=metadata,
    design_factors="condition",
    refit_cooks=True,
)
dds.deseq2()

stat_res = DeseqStats(dds)
stat_res.summary()

version == 0.4.4

...[snipped traceback]
583 cooks_outlier = (
--> 584 (self.dds[use_for_max, :].layers["replace_cooks"] > cooks_cutoff)
585 .any(axis=0)
586 .copy()
587 )
589 else:
590 cooks_outlier = (
591 (self.dds[use_for_max, :].layers["cooks"] > cooks_cutoff)
592 .any(axis=0)
593 .copy()
594 )

KeyError: 'replace_cooks'

@chubukov chubukov added the bug Something isn't working label Feb 16, 2024
@chubukov chubukov changed the title [BUG] [BUG] KeyError in cooks replacement Feb 16, 2024
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

Successfully merging a pull request may close this issue.

1 participant