News and Announcements » |
Description:
This script automates the construction of 3D plots (kinemage format) from the PCoA output file generated by principal_coordinates.py (e.g. P1 vs. P2 vs. P3, P2 vs. P3 vs. P4, etc., where P1 is the first component).
Usage: make_3d_plots.py [options]
Input Arguments:
Note
[REQUIRED]
[OPTIONAL]
Output:
By default, the script will plot the first three dimensions in your file. Other combinations can be viewed using the “Views:Choose viewing axes” option in the KiNG viewer (Chen, Davis, & Richardson, 2009), which may require the installation of kinemage software. The first 10 components can be viewed using “Views:Paralled coordinates” option or typing “/”. The mouse can be used to modify display parameters, to click and rotate the viewing axes, to select specific points (clicking on a point shows the sample identity in the low left corner), or to select different analyses (upper right window). Although samples are most easily viewed in 2D, the third dimension is indicated by coloring each sample (dot/label) along a gradient corresponding to the depth along the third component (bright colors indicate points close to the viewer).
Default Usage:
If you just want to use the default output, you can supply the principal coordinates file (i.e., resulting file from principal_coordinates.py) and a user-generated mapping file, where the default coloring will be based on the SampleID as follows:
make_3d_plots.py -i beta_div_coords.txt -m Mapping_file.txt
Additionally, the user can supply their mapping file (“-m”) and a specific category to color by (“-b”) or any combination of categories. When using the -b option, the user can specify the coloring for multiple mapping labels, where each mapping label is separated by a comma, for example: -b ‘mapping_column1,mapping_column2’. The user can also combine mapping labels and color by the combined label that is created by inserting an ‘&&’ between the input columns, for example: -b ‘mapping_column1&&mapping_column2’.
If the user would like to color all categories in their metadata mapping file, they can pass ‘ALL’ to the ‘-b’ option, as follows:
make_3d_plots.py -i beta_div_coords.txt -m Mapping_file.txt -b ALL
As an alternative, the user can supply a preferences (prefs) file, using the -p option. The prefs file allows the user to give specific samples their own columns within a given mapping column. This file also allows the user to perform a color gradient, given a specific mapping column.
If the user wants to color by using the prefs file (e.g. prefs.txt), they can use the following code:
make_3d_plots.py -i beta_div_coords.txt -m Mapping_file.txt -p prefs.txt
Output Directory:
If you want to give an specific output directory (e.g. “3d_plots”), use the following code:
make_3d_plots.py -i principal_coordinates-output_file --o 3d_plots/
Background Color Example:
If the user would like to color the background white they can use the ‘-k’ option as follows:
make_3d_plots.py -i beta_div_coords.txt -m Mapping_file.txt -b ALL -k white
Jackknifed Principal Coordinates (w/ confidence intervals):
If you have created jackknifed PCoA files, you can pass the folder containing those files, instead of a single file. The user can also specify the opacity of the ellipses around each point “–ellipsoid_opacity”, which is a value from 0-1. Currently there are two metrics “–ellipsoid_method” that can be used for generating the ellipsoids, which are ‘IQR’ and ‘sdev’. The user can specify all of these options as follows:
make_3d_plots.py -i jackknifed_pcoas/ -m Mapping_file.txt -b 'mapping_column1,mapping_column1&&mapping_column2' --ellipsoid_opacity=0.5 --ellipsoid_method=IQR
Bi-Plots:
If the user would like to see which taxa are more prevalent in different areas of the PCoA plot, they can generate Bi-Plots, by passing a principal coordinates file or folder “-i”, a mapping file “-m”, and a summarized taxa file “-t” from summarize_taxa.py. Can be combined with jacknifed principal coordinates.
make_3d_plots.py -i pcoa.txt -m Mapping_file.txt -t otu_table_level3.txt