Open jolespin opened 5 years ago
I don't think there are any python tutorials on how to run optspace - it was designed to run in the command line.
But there are some unittests that may help you run it : see here
Thanks, I was basing it off of this tutorial here: https://github.com/biocore/DEICODE/blob/master/ipynb/introduction.ipynb
I vaguely remember trying out DEICODE (maybe it was named something different) in the past before it was integrated into QIIME2
We/I should add some docs on how to do this. @mortonjt The only problem I see with running optspace in this way is it would bypass the recentering done in the rpca script. However, you could run rpca as a python API and return a skbio OrdinationResults and DistanceMatrix.
Right, basically use the qiime2 function in python. That can be done via
from deicode.rpca import rpca
ord_res, dist_res = rpca(microbes_biom)
Is rpca
a preprocessing step for OptSpace
? Is it possible to run OptSpace
with the input as either a pandas dataframe or numpy array?
Hi @jolespin, You will still need to import your data into biom format (see example below on how to do that from a data frame) but I added a tutorial on how to do this. You can find that tutorial here. Hope this helps. (Note: the biplot function I used is just a helper for that tutorial and is not unit-tested, so use that with caution). Also, the version in that tutorial is not released yet so run pip install git+https://github.com/biocore/DEICODE
to get the right version installed.
import pandas as pd
from biom import Table
# a table where the index are features (i.e. ASVs) and columns are samples
table_df = pd.read_csv("path/to/table/table.tsv", sep="\t", index_col=0)
# make biom table
bt = Table(table_df.values, table_df.index, table_df.columns)
I'm trying to use
U,s,V = OptSpace().fit_transform(A_)
but there are no defaults forOptSpace
and there is also nofit_transform
method.How can I use your
DEICODE
Python package without usingqiime2
?Side question, is
OptSpace
only intended for aitchison transformed compositional data?