Beispiel #1
0
 def _load_dimensionality_reduced_matrix_h5(self, group):
     if self.method == 'pca':
         for n_components, pca in analysis_io.load_h5_iter(group, PCA):
             self.dimensionality_reducted_matrix[int(n_components)] = pca
         return
     elif self.method == 'lsa':
         for n_components, lsa in analysis_io.load_h5_iter(group, LSA):
             self.dimensionality_reducted_matrix[int(n_components)] = lsa
         return
     elif self.method == 'plsa':
         for n_components, plsa in analysis_io.load_h5_iter(group, PLSA):
             self.dimensionality_reducted_matrix[int(n_components)] = plsa
         return
     raise ValueError('method {} not allowed'.format(self.method))
Beispiel #2
0
def load_pca_from_h5(filename):
    """ Load just the PCA info from an analysis h5 """
    with tables.open_file(filename, 'r') as f:
        group = f.root._v_groups[cr_constants.ANALYSIS_H5_PCA_GROUP]
        # Just take the first PCA object, assuming we never have multiple
        for _, pca in cr_io.load_h5_iter(group, PCA):
            return pca
Beispiel #3
0
def load_lsa_from_h5(filename):
    """ Load just the LSA info from an analysis h5 """
    with tables.open_file(filename, 'r') as f:
        group = f.root._v_groups[analysis_constants.ANALYSIS_H5_LSA_GROUP]
        # Just take the first LSA object, assuming we never have multiple
        for _, lsa in analysis_io.load_h5_iter(group, LSA):
            return lsa
Beispiel #4
0
def load_graphclust_from_h5(filename):
    with tables.open_file(filename, 'r') as f:
        group = f.root._v_groups[cr_constants.ANALYSIS_H5_CLUSTERING_GROUP]

        # Take the first entry
        for key, clustering in cr_io.load_h5_iter(group,
                                                  cr_clustering.CLUSTERING):
            clustering_type, _ = cr_clustering.parse_clustering_key(key)
            if clustering_type == cr_clustering.CLUSTER_TYPE_GRAPHCLUST:
                return clustering
Beispiel #5
0
 def _load_tsne_h5(self, group):
     for _, tsne in analysis_io.load_h5_iter(group, TSNE):
         self.tsne[tsne.key] = tsne
Beispiel #6
0
 def _load_differential_expression_h5(self, group):
     for clustering_key, de in analysis_io.load_h5_iter(
             group, DIFFERENTIAL_EXPRESSION):
         self.differential_expression[clustering_key] = de
Beispiel #7
0
 def _load_clustering_h5(self, group):
     for clustering_key, clustering in analysis_io.load_h5_iter(
             group, cr_clustering.CLUSTERING):
         self.clusterings[clustering_key] = clustering