Return artifact other than visualization with ANCOM

Is there a way to return a python object other than a visualization when running ANCOM with the qiime api?

for example the following command returns a visualization:
bar = composition.actions.ancom(table=pseudo_counts.composition_table, metadata=metadata)

What I would like is the table of W and f-statistics in a pandas dataframe or numpy array is this possible without writing the result to file, unzipping and then loading the .csv file back into python?


1 Like

I don’t believe the .csv is named index, otherwise you could use: .get_index_paths(relative=False) which is part of our (undocumented) public API.

Assuming that isn’t the case, you would need to use internal details like ._archiver.data_dir which is not a supported API.

What is your use-case at the moment? I feel like we may need to augment our “index.(ext)” concept a little here to allow arbitrary “entry-points” into the visualization for different representations. We definitely haven’t explored this territory deeply yet ( doesn’t even know there can be other kinds of index files other than html).

1 Like

I’m using ANCOM to get a list of feature IDs that are different between groups of a given category, and then using those IDs for further analyses such as feature selection or identifying marker features. I am attempting to do everything inline in a jupyter notebook. Does that answer your question about the use-case?

Because everything we do is exclusively with the API (unless it’s not possible) I would advocate for being able to access the data underlying any visualizations, though I’m unsure how common this type of thing would be in practice.

Right now, there is no Artifact returned from ANCOM. Like you suggested, there are output files that contain the results in case you need to access the underlying data.

However, you are welcome to submit a pull requests against q2-composition to improve this. That will require the creation of some types to allow for this result information to be uploaded into an Artifact.

1 Like

Thanks @mortonjt for the reply. We may have some bandwith to take care of this in the month or so. Otherwise the plugin is working great!

1 Like