YeoLab / flotilla

Reproducible machine learning analysis of gene expression and alternative splicing data
http://yeolab.github.io/flotilla/docs
BSD 3-Clause "New" or "Revised" License
121 stars 26 forks source link

test_study.interactive_pca() does not display graphs. Displays errors. #112

Closed eliah-o closed 10 years ago

eliah-o commented 10 years ago

A fresh copy of flotilla was installed. %matplotlib inline, import flotilla, and test_study = flotilla.embark('http://sauron.ucsd.edu/flotilla_projects/neural_diff_chr22/datapackage.json') were all run. Then test_study.interactive_pca() and the following stack trace is printed:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/Users/eliah/anaconda/envs/flotilla_env/lib/python2.7/site-packages/flotilla/visualize/ipython_interact.pyc in do_interact(data_type, sample_subset, feature_subset, featurewise, list_link, x_pc, y_pc, show_point_labels, savefile)
    131                                 x_pc=x_pc, y_pc=y_pc,
    132                                 show_point_labels=show_point_labels,
--> 133                                 feature_subset=feature_subset)
    134             if savefile != '':
    135                 # Make the directory if it's not already there

/Users/eliah/anaconda/envs/flotilla_env/lib/python2.7/site-packages/flotilla/data_model/study.pyc in plot_pca(self, data_type, x_pc, y_pc, sample_subset, feature_subset, title, featurewise, show_point_labels, reduce_kwargs, **kwargs)
    810                 order=order, color=color,
    811                 featurewise=featurewise, show_point_labels=show_point_labels,
--> 812                 title=title, reduce_kwargs=reduce_kwargs, **kwargs)
    813         elif "splicing".startswith(data_type):
    814             reducer = self.splicing.plot_pca(

/Users/eliah/anaconda/envs/flotilla_env/lib/python2.7/site-packages/flotilla/data_model/base.pyc in plot_pca(self, **kwargs)
    377     def plot_pca(self, **kwargs):
    378         return self.plot_dimensionality_reduction(reducer=DataFramePCA,
--> 379                                                   **kwargs)
    380 
    381     @property

/Users/eliah/anaconda/envs/flotilla_env/lib/python2.7/site-packages/flotilla/data_model/base.pyc in plot_dimensionality_reduction(self, x_pc, y_pc, sample_ids, feature_ids, featurewise, reducer, label_to_color, label_to_marker, groupby, order, color, reduce_kwargs, title, **plotting_kwargs)
    360         reduced = self.reduce(sample_ids, feature_ids,
    361                               featurewise=featurewise,
--> 362                               reducer=reducer, **reduce_kwargs)
    363         visualized = DecompositionViz(reduced.reduced_space,
    364                                       reduced.components_,

/Users/eliah/anaconda/envs/flotilla_env/lib/python2.7/site-packages/flotilla/util.pyc in memoizer(*args, **kwargs)
     94         key = str(args) + str(kwargs)
     95         if key not in cache:
---> 96             cache[key] = obj(*args, **kwargs)
     97         return cache[key]
     98 

/Users/eliah/anaconda/envs/flotilla_env/lib/python2.7/site-packages/flotilla/data_model/base.pyc in reduce(self, sample_ids, feature_ids, featurewise, reducer, standardize, reducer_kwargs, bins)
    595             subset = subset.T
    596 
--> 597         reducer_object = reducer(subset, **reducer_kwargs)
    598         reducer_object.means = means
    599         return reducer_object

/Users/eliah/anaconda/envs/flotilla_env/lib/python2.7/site-packages/flotilla/compute/decomposition.pyc in __init__(self, df, n_components, **decomposer_kwargs)
     18         if df.shape[1] <= 3:
     19             raise ValueError(
---> 20                 "Too few features (n={}) to reduce".format(df.shape[1]))
     21         super(DataFrameReducerBase, self).__init__(n_components=n_components,
     22                                                    **decomposer_kwargs)

ValueError: Too few features (n=2) to reduce
olgabot commented 10 years ago

Try using "all genes" in the feature_subset dropdown. The default is "variant", which is too small for this tiny data subset

olgabot commented 10 years ago

Also can you reformat your comment using github flavored markdown? It makes the code much easier to read.

eliah-o commented 10 years ago

Using "all genes" works. Thanks!