How to capture a value from a summary and pipe it?
In an effort to automate work, I would like to know how to capture a value from a summary visualization and feed that value to the next command. I searched and failed, and am running qiime2-2021.2 through conda.
I have run:
qiime tools import --type SampleData[PairedEndSequencesWithQuality] --input-path raw_data/ --output-path reads_qza/reads.qza --input-format CasavaOneEightSingleLanePerSampleDirFmt
qiime cutadapt trim-paired --i-demultiplexed-sequences reads_qza/reads.qza --p-cores $NCORES --p-front-f GTGYCAGCMGCCGCGGTAA --p-front-r CCGYCAATTYMTTTRAGTTT --p-discard-untrimmed --p-no-indels --o-trimmed-sequences reads_qza/reads_trimmed.qza
qiime vsearch join-pairs --i-demultiplexed-seqs reads_qza/reads_trimmed.qza --o-joined-sequences reads_qza/reads_trimmed_joined.qza
qiime quality-filter q-score --i-demux reads_qza/reads_trimmed_joined.qza --o-filter-stats filt_stats.qza --o-filtered-sequences reads_qza/reads_trimmed_joined_filt.qza
qiime demux summarize --i-data reads_qza/reads_trimmed_joined_filt.qza --o-visualization reads_qza/reads_trimmed_joined_filt_summary.qzv
and when I view reads_trimmed_joined_filt_summary.qzv, under the interactive quality tab, I see this:
I want a way to capture whatever number is in that 2% row of the Demultiplexed sequence length summary, which in this example I have highlighted in gray and is 368, and to insert it as the --p-trim-length parameter into my next qiime command, which here would be
qiime deblur denoise-16S --i-demultiplexed-seqs reads_qza/reads_trimmed_joined_filt.qza --p-trim-length 368 .... etc.
qiime tools export --input-path reads_qza/reads_trimmed_joined_filt_summary.qzv --output-path ., but none of its outputs easily gave me what I wanted. (Its outputs: data.jsonp, demultiplex-summary-forward.pdf, demultiplex-summary-forward.png, dist/, forward-seven-number-summaries.tsv, index.html, overview.html, per-sample-fastq-counts.tsv, q2templateassets/, quality-plot.html.)
Do I have what I want and just don’t see it? Or if I need to do more work now so I can do less work later, what’s next in my automating journey? I’m sure this is Python-soluble, but I have no Python-skill. Thanks to any who can help!