Plugin to Generate Feature Log Ratios By Textual Searching à la Qurro

Hi, all.

I’m fairly new to Qiime dev and right now I’m interested in writing/modifying a plugin to generate log ratios given numerator and denominator strings without having to run Qurro. Ideally, usage would look something like this:

qiime2 plugin-name log-ratio \
    --i-table feature_table.qza \
    --m-sample-metadata-file samples_to_use.tsv \
    --m-feature-metadata-file taxonomy.qza \
    --m-numerator-string o__Fusobacteriales \
    --m-denominator-string o__Pseudomonadales \
    --o-output-path Fuso_Pseudo_log_ratios.qza

where the output would look something like this:

Sample-ID       Log-Ratio
Sample1             1.543
Sample2            -2.337
Sample3             0.048

With a value listed for each sample as \ln(\sum \text{numerator features count}) - \ln(\sum \text{denominator features count})

I want to be able to generate these log-ratios programatically and without having to click “Export sample data” in Qurro to save the data for further visualization/analysis.

I already have the code to do this without Qiime, but I think it could be a useful plugin to others. So my question is, should this be its own plugin or perhaps folded into q2-feature-table or another plugin? Additionally, would this functionality require a new semantic type to be defined? My understanding is that Qiime does not (at the moment) support outputting metadata files.

Best,
Gibs

1 Like

For reference: we’re planning on rolling this into Qurro as a separate method (distinct from the visualizers). Along with allowing the computation of log-ratios without making the user use the interactive visualization, this would have the advantage of facilitating these computations in a way that gets around max number sizes in JavaScript, as discussed in this issue and in this forum post.

Sounds like this is going in qurro, and I think that would be a most appropriate home for this method :smile:

Sounds like a great method to have in there too, I agree it would be widely useful.

What QIIME 2 methods would consume this output? That may help you decide what the output semantic type should be and if an appropriate type already exists… but in general I think this may require a new semantic type, one that can be transformed to metadata. Would it be reasonable to output this as a feature table??? cc: @ebolyen

2 Likes

Not having thought about this very hard, it seems like a new SampleData[LogRatio] style type. A feature table could work if the denominator was fixed and we wanted to see all log-ratios of ASVs against that denominator (e.g., literally an ALR transform), but it seems the goal is to change both, and the combinatorics of that are not something we want in a table I think. It would be nice to be able to merge many of these into a table however (assuming the numerators did not overlap and the denominators were the same…)

Given that, it might be good store in this structure the numerator and denominator features, acting as a weird kind of OTU map for the new LogRatio feature.

2 Likes