Skip to content

Seems not to be working with Python 3.X and newer version of pandas #190

Description

@gfbischof

"from gdsctools import ANOVA, ic50_test
gdsc = ANOVA(ic50_test)
gdsc.set_cancer_type('breast')
df = gdsc.anova_one_drug_one_feature(1047, 'TP53_mut', show=True)"

-->

"ImportError Traceback (most recent call last)
Input In [1], in <cell line: 1>()
----> 1 from gdsctools import ANOVA, ic50_test
2 gdsc = ANOVA(ic50_test)
3 gdsc.set_cancer_type('breast')

File ~/opt/anaconda3/lib/python3.9/site-packages/gdsctools/init.py:54, in
51 return filename
53 from gdsctools.readers import IC50, GenomicFeatures, DrugDecode, Reader
---> 54 from gdsctools.anova import ANOVA
55 from gdsctools.anova_report import ANOVAReport
56 from gdsctools.anova_results import ANOVAResults

File ~/opt/anaconda3/lib/python3.9/site-packages/gdsctools/anova.py:24, in
21 import pylab
22 import numpy as np
---> 24 from statsmodels.formula.api import OLS
26 from easydev import Progress, AttrDict, do_profile
28 from gdsctools.models import BaseModels

ImportError: cannot import name 'OLS' from 'statsmodels.formula.api' (/Users/xxxx/opt/anaconda3/lib/python3.9/site-packages/statsmodels/formula/api.py)
"

Even renamen OSL to osl in the file won't work -->

"Input In [6], in <cell line: 2>()
1 from gdsctools import ANOVA, ic50_test
----> 2 gdsc = ANOVA(ic50_test)
3 gdsc.set_cancer_type('breast')
4 df = gdsc.anova_one_drug_one_feature(1047, 'TP53_mut', show=True)

File ~/opt/anaconda3/lib/python3.9/site-packages/gdsctools/anova.py:124, in ANOVA.init(self, ic50, genomic_features, drug_decode, verbose, set_media_factor)
103 def init(self, ic50, genomic_features=None,
104 drug_decode=None, verbose=True,
105 set_media_factor=False):
106 """.. rubric:: Constructor
107
108 :param DataFrame IC50: a dataframe with the IC50. Rows should be
(...)
122 to the ANOVA analysis or visualisation.
123 """
--> 124 super(ANOVA, self).init(ic50, genomic_features,
125 drug_decode=drug_decode, verbose=verbose,
126 set_media_factor=set_media_factor)
128 self.sampling = 0
129 self.pvalues_features = {}

File ~/opt/anaconda3/lib/python3.9/site-packages/gdsctools/models.py:109, in BaseModels.init(self, ic50, genomic_features, drug_decode, verbose, set_media_factor)
102 if len(unknowns) > 0 and self.verbose:
103 print("WARNING: " +
104 "%s cosmic identifiers in your IC50 " % len(unknowns) +
105 "could not be found in the genomic feature matrix. " +
106 "They will be dropped. Consider using a user-defined " +
107 "genomic features matrix")
--> 109 self.ic50.drop_cosmic(list(unknowns))
110 self.features.cosmicIds = self.ic50.cosmicIds
111 #self.cosmicIds = self.ic50.cosmicIds
112
113 #: an instance of :class:~gdsctools.settings.ANOVASettings

File ~/opt/anaconda3/lib/python3.9/site-packages/gdsctools/readers.py:325, in CosmicRows.drop_cosmic(self, cosmics)
323 cosmics = easydev.to_list(cosmics)
324 tokeep = [x for x in self.cosmicIds if x not in cosmics]
--> 325 self.cosmicIds = tokeep

File ~/opt/anaconda3/lib/python3.9/site-packages/gdsctools/readers.py:317, in CosmicRows._set_cosmic(self, cosmics)
315 if cosmic not in self.cosmicIds:
316 raise ValueError('Unknown cosmic identifier')
--> 317 self.df = self.df.ix[cosmics]

File ~/opt/anaconda3/lib/python3.9/site-packages/pandas/core/generic.py:5575, in NDFrame.getattr(self, name)
5568 if (
5569 name not in self._internal_names_set
5570 and name not in self._metadata
5571 and name not in self._accessors
5572 and self._info_axis._can_hold_identifiers_and_holds_name(name)
5573 ):
5574 return self[name]
-> 5575 return object.getattribute(self, name)

AttributeError: 'DataFrame' object has no attribute 'ix'"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions