1433eb7ca0d16cbb0dcaf0a54de2eb06654c8749,src/pyscenic/rnkdb.py,InvertedRankingDatabase,load,#InvertedRankingDatabase#Any#,430
Before Change
def load(self, gs: Type[GeneSignature]) -> pd.DataFrame:
rank_unknown = np.iinfo(INVERTED_DB_DTYPE).max
features = self.df.index; n_features = len(features)
reference_identifiers = np.array([self.identifier2idx[identifier] for identifier in gs.genes])
ranked_identifiers = self.df.values
def gen_series(ranked_identifiers, reference_identifiers, name):
idx = np.nonzero(np.isin(ranked_identifiers, reference_identifiers))[0]
return pd.Series(index=ranked_identifiers[idx], data=idx, name=name, dtype=INVERTED_DB_DTYPE)
//return pd.DataFrame(data=build_rankings(ranked_identifiers, reference_identifiers),
// index=self.df.index,
// columns=gs.genes)
return pd.concat([gen_series(ranked_identifiers[idx, :], reference_identifiers, features[idx]) for idx in range(n_features)], axis=1).T\
.fillna(rank_unknown).astype(INVERTED_DB_DTYPE)\
.rename(columns=self.idx2identifier, inplace=False)
After Change
def load(self, gs: Type[GeneSignature]) -> pd.DataFrame:
rank_unknown = np.iinfo(INVERTED_DB_DTYPE).max
reference_identifiers = np.array([self.identifier2idx[identifier] for identifier in gs.genes])
return pd.concat([col.reindex(index=reference_identifiers, fill_value=rank_unknown) for col in self.features],
axis=1).T.astype(INVERTED_DB_DTYPE).rename(columns=self.idx2identifier)
//return pd.DataFrame(data=build_rankings(ranked_identifiers, reference_identifiers),
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: aertslab/pySCENIC
Commit Name: 1433eb7ca0d16cbb0dcaf0a54de2eb06654c8749
Time: 2018-04-05
Author: vandesande.bram@gmail.com
File Name: src/pyscenic/rnkdb.py
Class Name: InvertedRankingDatabase
Method Name: load
Project Name: biocore/scikit-bio
Commit Name: a2867db5d7e0804654dda2721ced35d227b3e3bb
Time: 2015-09-03
Author: jai.rideout@gmail.com
File Name: skbio/alignment/_tabular_msa.py
Class Name: TabularMSA
Method Name: __init__
Project Name: etal/cnvkit
Commit Name: aef8b785f1ee6882b768f80261019943bea64d7c
Time: 2016-05-19
Author: michael.p.schroeder@gmail.com
File Name: cnvlib/commands.py
Class Name:
Method Name: do_gainloss