Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions gdsctools/gdsc.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,11 +460,9 @@ def create_data_packages_for_companies(self, companies=None):
# again but to hold various information
an = ANOVA(self.ic50, gf_filename, drug_decode_company, verbose=False)

def drug_to_keep(drug):
to_keep = drug in drug_decode_company.df.index
return to_keep
to_remove = set(an.ic50.drugIds).difference(set(drug_decode_company.df.index.tolist()))

an.ic50.df = an.ic50.df[drug_decode_company.df.index]
an.ic50.drop_drugs(list(to_remove))

an.settings = ANOVASettings(**self.settings)

Expand Down
13 changes: 13 additions & 0 deletions gdsctools/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,19 @@ def __init__(
self.features.cosmicIds = self.ic50.cosmicIds
# self.cosmicIds = self.ic50.cosmicIds

# Also drop drugs (columns) where all matrix entries are NA
drugs_to_drop = self.ic50.df.isna().all()
number_kept = len(drugs_to_drop[~drugs_to_drop].index.tolist())
drugs_to_drop = drugs_to_drop[drugs_to_drop].index.tolist()
if len(drugs_to_drop) > 0 and self.verbose:
print(
"INFO: "
+ "%s drugs in your IC50 matrix" % len(drugs_to_drop)
+ " have no data. They will be dropped."
+ " %s drugs now in ANOVA analysis." % number_kept
)
self.ic50.drop_drugs(drugs_to_drop)

#: an instance of :class:`~gdsctools.settings.ANOVASettings`
self.settings = ANOVASettings()

Expand Down