Comments (3)
Thank you for the feature request!
The reason I didn't include options like where
to the beta_2d_plot
function is because I was afraid the option might be abused by users, both intentionally and unintentionally. As you may already know, when presenting a PCoA plot you are supposed to show all samples that were used to calculate the original distance matrix. If a given PCoA plot is showing only a subset of samples, then it should not be used to make any definitive conclusions. For example, when you try to subset some samples in an emperor QZV file using QIIME 2 View, it will still do it for you but with a warning: "WARNING: hiding samples in an ordination can be misleading". Below you will see that I removed "left palm" samples (blue). The warning is displayed on the top left corner.
Therefore, if the goal is to see how PCoA looks in the absence of certain samples, then you should calculate a new distance matrix and plot it again. This can be easily done within Dokdo and an example of this is illustrated in the ordinate
function's documentation (compare the first and second figures). I will show the code example below:
import dokdo
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
sns.set()
qza_file = '/Users/sbslee/Desktop/dokdo/data/moving-pictures-tutorial/table.qza'
metadata_file = '/Users/sbslee/Desktop/dokdo/data/moving-pictures-tutorial/sample-metadata.tsv'
pcoa_results = dokdo.ordinate(qza_file)
dokdo.beta_2d_plot(
pcoa_results,
metadata=metadata_file,
hue='body-site',
figsize=(8, 8)
)
plt.tight_layout()
from qiime2 import Metadata
mf = dokdo.get_mf(metadata_file)
mf = mf[mf['body-site'].isin(['gut', 'left palm'])]
pcoa_results = dokdo.ordinate(qza_file, metadata=Metadata(mf))
dokdo.beta_2d_plot(
pcoa_results,
metadata=metadata_file,
hue='body-site',
figsize=(8, 8)
)
plt.tight_layout()
I think there could still be an argument to be made in the favor of adding options like where
to the beta_2d_plot
function. For example, the user may want to explore the PCoA space in greater depth. However, if that's the case the user should use QIIME 2 View because that's why the platform exists in the first place.
Hope this helps!
from dokdo.
Thanks @sbslee
This works perfectly.
I understand the concern for hiding some samples and was looking for something like this to recompute the distance matrix for the selected samples. Thanks for your excellent support with dokdo!
When I recompute using the function you suggested in the second part of the script I get a plot with warning message like this:
/home/rupesh/anaconda3/envs/qiime2-2022.8/lib/python3.8/site-packages/sklearn/metrics/pairwise.py:1776: DataConversionWarning: Data was converted to boolean for metric jaccard
warnings.warn(msg, DataConversionWarning)
What does this actually mean?
Again thanks for your support.
from dokdo.
Glad to know that Dokdo is helpful to you!
As for the warning, you don't have to worry about it. It simply means that numeric data was converted to boolean (e.g. 442 --> True, and 0 --> False). This conversion was needed because you are using the Jaccard distance as distance metrics, which computes distance between samples based on the presence/absence of microbiome instead of using their abundance. Hope this helps.
from dokdo.
Related Issues (20)
- Update `make-manifest` command to ignore `Undetermined.fastq.gz`
- `alpha_rarefaction_plot` apparently ignores 'N/A' values when plotting
- alpha and beta diversity without qiime file HOT 7
- correlation analysis HOT 11
- Plot options for `beta_2d/3d_plot` and `taxa_abundance_box_plot` methods HOT 13
- Implementing differential abundance analysis HOT 2
- dokdo `beta_parallel_plot` issue HOT 1
- taxa_abundance_bar_plot issue HOT 1
- Add the rank abundance curve plot
- exclude "others" from relative abundance and plot HOT 3
- ModuleNotFoundError: No module named 'skbio' HOT 8
- ImportError: libhdf5_cpp.so.200: cannot open shared object file: No such file or directory HOT 2
- Add taxon name in the pcoa biplot HOT 1
- Overlapping legends on clustermap HOT 3
- How to plot many species on a bar graph HOT 8
- [taxa_abundance_bar_plot] Customizing bar colors with using 'Seaborn palette' or 'Matplotlib colormap' HOT 2
- [taxa_abundance_box_plot] Deletion of notation of species not observed in samples HOT 2
- import process issue HOT 5
- ImportError: cannot import name 'diversity_lib' HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dokdo.