annotate README.md @ 8:e9677425c6c3 default tip

Updated the structure of the libraries
author george.weingart@gmail.com
date Mon, 09 Feb 2015 12:17:40 -0500
parents e0b5980139d9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
1 MaAsLin User Guide v3.1
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
2 =======================
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
3
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
4 September 2013 - Updated April 2014 for Galaxy
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
5
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
6 Timothy Tickle and Curtis Huttenhower
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
7
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
8 Table of Contents
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
9 -----------------
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
10
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
11 A. Introduction to MaAsLin
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
12 B. Related Projects and Scripts
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
13 C. Installing MaAsLin
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
14 D. MaAsLin Inputs
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
15 E. Process Flow Overview
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
16 D. Process Flow Detail
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
17 G. Expected Output Files
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
18 H. Troubleshooting
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
19 I. Installation as an Automated Pipeline
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
20 J. Commandline Options (Modifying Process and Figures)
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
21
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
22 # A. Introduction to MaAsLin
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
23
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
24 MaAsLin is a multivariate statistical framework that finds
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
25 associations between clinical metadata and potentially
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
26 high-dimensional experimental data. MaAsLin performs boosted additive
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
27 general linear models between one group of data (metadata/the
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
28 predictors) and another group (in our case relative taxonomic
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
29 abundances/the response). In our context we use it to discover
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
30 associations between clinical metadata and microbial community
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
31 relative abundance or function; however, it is applicable to other
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
32 data types.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
33
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
34 Metagenomic data are sparse, and boosting is used to select metadata
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
35 that show some potential to be useful in a linear model between the
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
36 metadata and abundances. In the context of metadata and community
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
37 abundance, a sample's metadata is boosted for one Operational
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
38 Taxonomic Unit (OTU) (Yi). The metadata that are selected by boosting
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
39 are then used in a general linear model, with each combination of
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
40 metadata (as predictors) and OTU abundance (as response
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
41 variables). This occurs for every OTU and metadata combination. Given
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
42 we work with proportional data, the Yi (abundances) are
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
43 `arcsin(sqrt(Yi))` transformed. A final formula is as follows:
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
44
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
45 ![](https://bitbucket.org/biobakery/maaslin/downloads/maaslinformula2.png)
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
46
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
47 For more information about maaslin please visit
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
48 [http://huttenhower.sph.harvard.edu/maaslin](http://huttenhower.sph.harvard.edu/maaslin).
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
49
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
50
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
51 # B. Related Projects and Scripts
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
52
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
53 Other projects exist at www.bitbucket.com that may help in your
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
54 analysis:
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
55
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
56 * **QiimeToMaAsLin** is a project that reformats abundance files from
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
57 Qiime for MaAsLin. Several formats of Qiime consensus lineages are
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
58 supported for this project. To download please visit
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
59 [https://bitbucket.org/timothyltickle/qiimetomaaslin](https://bitbucket.org/timothyltickle/qiimetomaaslin).
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
60
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
61 * **merge_metadata.py** is a script included in the MaAsLin project to
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
62 generically merge a metadata file with a table of microbial (or
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
63 other) measurements. This script is located in `maaslin/src` and
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
64 is documented in `maaslin/doc/ Merge_Metadata_Read_Me.txt`.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
65
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
66
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
67 # C. Installing MaAsLin
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
68
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
69 R Libraries: Several libraries need to be installed in R these are
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
70 the following:
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
71
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
72 * agricolae, gam, gamlss, gbm, glmnet, inlinedocs, logging, MASS, nlme, optparse, outliers, penalized, pscl, robustbase, testhat, vegan
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
73
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
74 You can install them by typing R in a terminal and using the
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
75 install.packages command:
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
76
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
77 install.packages(c('agricolae', 'gam', 'gamlss', 'gbm', 'glmnet', 'inlinedocs', 'logging', 'MASS', 'nlme', 'optparse', 'outliers', 'penalized', 'pscl', 'robustbase', 'testthat'))
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
78
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
79 # D. MaAsLin Inputs
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
80
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
81 There are 3 input files for each project, the "\*.read.config" file, the "\*.pcl" file, and the "\*.R" script. (If using the sfle automated pipeline, the "\*" in the file names can be anything but need to be identical for all three files. All three files need to be in the `../sfle/input/maasalin/input` folder only if using sfle). Details of each file follow:
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
82
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
83 ### 1\. "\*.pcl"
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
84
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
85 Required input file. A PCL file is the file that contains all the data
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
86 and metadata. This file is formatted so that metadata/data (otus or
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
87 bugs) are rows and samples are columns. All metadata rows should come
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
88 first before any abundance data. The file should be a tab delimited
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
89 text file with the extension ".pcl".
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
90
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
91 ### 2\. "\*.read.config"
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
92
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
93 Required input file. A read config file allows one to indicate what data is read from a PCL file without having to change the pcl file or change code. This means one can have a pcl file which is a superset of metadata and abundances which includes data you are not interested in for the run. This file is a text file with ".read.config" as an extension. This file is later described in detail in section **F. Process Flow Overview** subsection **4. Create your read.config file**.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
94
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
95 ### 3\. "\*.R"
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
96
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
97 Optional input file. The R script file is using a call back programming pattern that allows one to add/modify specific code to customize analysis without touching the main MaAsLin engine. A generic R script is provided "maaslin_demo2.R" and can be renamed and used for any study. The R script can be modified to add quality control or formatting of data, add ecological measurements, or other changes to the underlying data before MaAsLin runs on it. This file is not required to run MaAsLin.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
98
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
99 # E. Process Flow Overview
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
100
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
101 1. Obtain your abundance or relative function table.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
102 2. Obtain your metadata.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
103 3. Format and combine your abundance table and metadata as a pcl file for MaAsLin.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
104 4. Create your read.config file.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
105 5. Create your R script or use the default.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
106 6. Place .pcl, .read.config, .R files in `../sfle/input/maaslin/input/` (sfle only)
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
107 7. Run
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
108 8. Discover amazing associations in your results!
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
109
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
110 # F. Process Flow Detail
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
111
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
112 ### 1\. Obtain your abundance or relative function table.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
113
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
114 Abundance tables are normally derived from sequence data using
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
115 *Mothur*, *Qiime*, *HUMAnN*, or *MetaPhlAn*. Please refer to their documentation
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
116 for further details.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
117
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
118 ### 2\. Obtain your metadata.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
119
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
120 Metadata would be information about the samples in the study. For
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
121 instance, one may analyze a case / control study. In this study, you
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
122 may have a disease and healthy group (disease state), the sex of the
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
123 patents (patient demographics), medication use (chemical treatment),
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
124 smoking (patient lifestyle) or other types of data. All aforementioned
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
125 data would be study metadata. This section can have any type of data
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
126 (factor, ordered factor, continuous, integer, or logical
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
127 variables). If a particular data is missing for a sample for a
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
128 metadata please write NA. It is preferable to write NA so that, when
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
129 looking at the data, it is understood the metadata is missing and it's
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
130 absence is intentional and not a mistake. Often investigators are
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
131 interested in genetic measurements that may also be placed in the
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
132 metadata section to associate to bugs.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
133
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
134 If you are not wanting to manually add metadata to your abundance
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
135 table, you may be interested in associated tools or scripts to help
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
136 combine your abundance table and metadata to create your pcl
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
137 file. Both require a specific format for your metadata file. Please
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
138 see the documentation for *QiimeToMaaslin* or *merge_metadata.py* (for
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
139 more details see section B).
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
140
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
141 ### 3\. Format and combine your abundance table and metadata as a pcl
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
142 file for *MaAsLin*.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
143
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
144 Please note two tools have been developed to help you! If you are
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
145 working from a Qiime OTU output and have a metadata text file try using
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
146 *QiimeToMaaslin* found at bitbucket. If you have a tab delimited file
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
147 which matches the below .pcl description (for instance MetaPhlAn
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
148 output) use the merge_metadata.py script provided in this project
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
149 (`maaslin/src/merge_metadata.py`) and documented in
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
150 `maaslin/doc/Merge_Metadata_Read_Me.txt`.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
151
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
152 ###PCL format description:
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
153
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
154 i. Row 1 is expected to be sample IDs beginning the first column with a feature name to identify the row, for example "ID".
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
155
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
156 ii. Rows of metadata. Each row is one metadata, the first column entry
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
157 being the name of the metadata and each following column being the
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
158 metadata value for that each sample.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
159
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
160 iii. Row of taxa/otu abundance. Each row is one taxa/otu, the first
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
161 column entry being the name of the taxa/otu followed by abundances of
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
162 the taxa/otu per sample.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
163
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
164 iv. Abundances should be normalized by dividing each abundance measurement by the sum of the column (sample) abundances.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
165
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
166 v. Here is an example of the contents of an extremely small pcl file;
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
167 another example can be found in this project at
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
168 `maaslin/input/maaslin_demo.pcl`.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
169
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
170
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
171 ID Sample1 Sample2 Sample3 Sample4
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
172 metadata1 True True False False
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
173 metadata2 1.23 2.34 3.22 3.44
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
174 metadata3 Male Female Male Female
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
175 taxa1 0.022 0.014 0.333 0.125
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
176 taxa2 0.406 0.029 0.166 0.300
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
177 taxa3 0.571 0.955 0.500 0.575
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
178
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
179
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
180 ### 4\. Create your read.config file.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
181
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
182 A *.read.config file is a structured text file used to indicate which
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
183 data in a *.pcl file should be read into MaAsLin and used for
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
184 analysis. This allows one to keep their *.pcl file intact while
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
185 varying analysis. Hopefully, this avoids errors that may be introduced
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
186 while manipulating the pcl files.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
187
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
188 Here is an example of the contents of a *.read.config file.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
189
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
190 Matrix: Metadata
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
191 Read_PCL_Columns: Sample2-Sample15
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
192 Read_PCL_Rows: Age-Height,Weight,Sex,Cohort-Profession
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
193
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
194 Matrix: Abundance
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
195 Read_PCL_Columns: Sample2-Sample15
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
196 Read_PCL_Rows: Bacteria-Bug100
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
197
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
198 The minimal requirement for a MaAsLin .read.config file is as
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
199 follows. The Matrix: should be specified. Metadata needs to be named
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
200 "Metadata" for the metadata section and "Abundance" for the abundance
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
201 section. “Read\_PCL\_Rows:” is used to indicate which rows are data or
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
202 metadata to be analyzed. Rows can be identified by their metadata/data
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
203 id. Separate ids by commas. If there is a consecutive group of
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
204 metadata/data a range of rows can be defined by indicating the first
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
205 and last id separated by a “-“. If the beginning or ending id is
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
206 missing surrounding an “–“, the rows are read from the beginning or to
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
207 the end of the pcl file, respectively.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
208
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
209 A minimal example is shown here:
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
210
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
211 Matrix: Metadata
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
212 Read\_PCL\_Rows: -Weight
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
213
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
214 Matrix: Abundance
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
215 Read_PCL_Rows: Bacteria-
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
216
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
217 With this minimal example, the delimiter of the file is assumed to be
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
218 a tab, all columns are read (since they are not indicated
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
219 here). Metadata are read as all rows from the beginning of the pcl
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
220 file (skipping the first Sample ID row) to Weight; all data are read
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
221 as all rows from Bacteria to the end of the pcl file. This example
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
222 refers to the default input files given in the MaAsLin download as
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
223 maaslin_demo2.\*.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
224
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
225 ### 5\. Optionally, create your R script.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
226
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
227 The R script is used to add code that manipulates your data before
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
228 analysis, and for manipulating the multifactoral analysis figure. A
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
229 default “*.R” script is available with the default MaAsLin project at
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
230 maaslin/input/maaslin_demo2.R. This is an expert option and should
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
231 only be used by someone very comfortable with the R language.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
232
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
233 ###6. Optional step if using the sfle analysis pipeline. Place .pcl, .read.config, and optional .R files in `../sfle/input/maasalin/input`
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
234
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
235 ###7. Run.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
236
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
237 By running the commandline script:
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
238 On the commandline call the Maaslin.R script. Please refer to the help (-h, --help) for command line options. If running from commandline, the PCL file will need to be transposed. A script is included in Maaslin for your convenience (src/transpose.py). The following example will have such a call included. An example call from the Maaslin folder for the demo data could be as follows.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
239
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
240 ./src/transpose.py < input/maaslin_demo2.pcl > maaslin_demo2.tsv
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
241 ./src/Maaslin.R -i input/maaslin_demo2.read.config demo.text maaslin_demo2.tsv
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
242
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
243 When using sfle:
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
244 Go to ../sfle and type the following: scons output/maaslin
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
245
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
246 ###8. Discover amazing associations in your results!
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
247
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
248
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
249 #G. Expected Output Files
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
250
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
251 The following files will be generated per MaAsLin run. In the
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
252 following listing the term projectname refers to what you named your "\*.pcl" file without the extension.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
253
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
254 ###Output files that are always created:
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
255
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
256 **projectname_log.txt**
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
257
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
258 This file contains the detail for the statistical engine. This can be
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
259 useful for detailed troubleshooting.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
260
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
261 **projectname-metadata.txt**
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
262
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
263 Each metadata will have a file of associations. Any associations
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
264 indicated to be performed after initial variable selection (boosting)
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
265 is recorded here. Included are the information from the final general
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
266 linear model (performed after the boosting) and the FDR corrected
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
267 p-value (q-value). Can be opened as a text file or spreadsheet.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
268
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
269 **projectname-metadata.pdf**
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
270
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
271 Any association that had a q-value less than or equal to the given
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
272 significance threshold will be plotted here (default is 0.25; can be
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
273 changed using the commandline argument -d). If this file does not
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
274 exist, the projectname-metadata.txt should not have an entry that is
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
275 less than or equal to the threshold. Factor data is plotted as
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
276 knotched box plots; continuous data is plotted as a scatter plot with
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
277 a line of best fit. Two plots are given for MaAslin Methodology; the
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
278 left being a raw data plot, the right being a corresponding partial
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
279 residual plot.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
280
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
281 **projectname.pdf**
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
282
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
283 Contains the biplot visualization. This visualization is presented as a build and can be affected by modifications in the R.script or by using commandline.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
284
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
285 **projectname.txt**
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
286
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
287 A collection of all entries in the projectname-metadata.pdf. Can be
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
288 opened as a text file or spreadsheet.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
289
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
290 ###Additional troubleshooting files when the commandline:
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
291
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
292 **data.tsv**
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
293
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
294 The data matrix that was read in (transposed). Useful for making sure
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
295 the correct data was read in.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
296
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
297 **data.read.config**
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
298
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
299 Can be used to read in the data.tsv.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
300
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
301 **metadata.tsv**
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
302
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
303 The metadata that was read in (transposed). Useful for making sure the
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
304 correct metadata was read in.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
305
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
306 **metadata.read.config**
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
307
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
308 Can be used to read in the data.tsv.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
309
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
310 **read_merged.tsv**
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
311
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
312 The data and metadata merged (transposed). Useful for making sure the
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
313 merging occurred correctly.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
314
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
315 **read_merged.read.config**
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
316
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
317 Can be used to read in the read_merged.tsv.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
318
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
319 **read_cleaned.tsv**
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
320
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
321 The data read in, merged, and then cleaned. After this process the
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
322 data is written to this file for reference if needed.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
323
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
324 **read_cleaned.read.config**
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
325
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
326 Can be used to read in read_cleaned.tsv.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
327
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
328 **ProcessQC.txt**
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
329
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
330 Contains quality control for the MaAsLin analysis. This includes
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
331 information on the magnitude of outlier removal.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
332
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
333 **Run_Parameters.txt**
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
334 Contains an account of all the options used when running MaAsLin so the exact methodology can be recreated if needed.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
335
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
336 #H. Other Analysis Flows
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
337
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
338 ###1. All verses All
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
339 The all verses all analysis flow is a way of manipulating how metadata are used. In this method there is a group of metadata that are always evaluated, as well there are a group that are added to this one at a time. To give a more concrete example: You may have metadata cage, diet, and treatment. You may always want to have the association of abundance evaluated controlling for cage but otherwise looking at the metadata one at a time. In this way the cage metadata is the \D2forced\D3 part of the evaluation while the others are not forced and evaluated in serial. The appropriate commandline to indicate this follows (placed in your args file if using sfle, otherwise added in the commandline call):
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
340
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
341 > -a -F cage
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
342
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
343 -a indicates all verses all is being used, -F indicates which metadata are forced (multiple metadata can be given comma delimited as shown here -F metadata1,metadata2,metadata3). This does not bypass the feature selection method so the metadata that are not forced are subject to feature selection and may be removed before coming to the evaluation. If you want all the metadata that are not forced to be evaluated in serial you will need to turn off feature selection and will have a final combined commandline as seen here:
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
344
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
345 > -a -F cage -s none
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
346
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
347 #I. Troubleshooting
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
348
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
349 ###1\. (Only valid if using Sfle) ImportError: No module named sfle
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
350
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
351 When using the command "scons output/maaslin/..." to run my projects I
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
352 get the message:
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
353
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
354 ImportError: No module named sfle:
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
355 File "/home/user/sfle/SConstruct", line 2:
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
356 import sfle
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
357
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
358 **Solution:** You need to update your path. On a linux or MacOS terminal
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
359 in the sfle directory type the following.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
360
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
361 export PATH=/usr/local/bin:`pwd`/src:$PATH
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
362 export PYTHONPATH=$PATH
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
363
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
364
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
365 ###2\. When trying to run a script I am told I do not have permission
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
366 even though file permissions have been set for myself.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
367
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
368 **Solution:** Most likely, you need to set the main MaAsLin script
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
369 (Maaslin.R) to executable.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
370
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
371 #J. Installation as an Automated Pipeline
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
372
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
373 SflE (pronounced souffle), is a framework for automation and
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
374 parallelization on a multiprocessor machine. MaAsLin has been
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
375 developed to be compatible with this framework. More information can
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
376 be found at
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
377 [http://huttenhower.sph.harvard.edu/sfle](http://huttenhower.sph.harvard.edu/sfle). If
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
378 interested in installing MaAsLin in a SflE environment. After
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
379 installing SflE, download or move the complete maaslin directory into
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
380 `sfle/input`. After setting up, one places all maaslin input files in
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
381 `sfle/input/maaslin/input`. To run the automated pipeline and analyze
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
382 all files in the `sfle/input/maaslin/input` directory, type: `scons output/maaslin`
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
383 in a terminal in the sfle directory. This will produce
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
384 output in the `sfle/output/maaslin` directory.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
385
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
386 #K. Commandline Options (Modifying Process and Figures)
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
387
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
388 Although we recommend the use of default options, commandline
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
389 arguments exist to modify both MaAsLin methodology and figures. To see
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
390 an up-to-date listing of argument usage, in a terminal in the
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
391 `maaslin/src` directory type `./Maaslin.R -h`.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
392
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
393 An additional input file (the args file) can be used to apply
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
394 commandline arguments to a MaAsLin run. This is useful when using
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
395 MaAsLin as an automated pipeline (using SflE) and is a way to document
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
396 what commandline are used for different projects. The args file should
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
397 be named the same as the *.pcl file except using the extension .args
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
398 . This file should be placed in the `maaslin/input` directory with the
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
399 other matching project input files. In this file please have one line
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
400 of arguments and values (if needed; some arguments are logical flags
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
401 and do not require a value), each separated by a space. The contents
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
402 of this file will be directly added to the commandline call for
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
403 Maaslin.R. An example of the contents of an args file is given here.
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
404
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
405 **Example.args:**
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
406
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
407 -v DEBUG -d 0.1 -b 5
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
408
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
409 In this example MaAsLin is modified to produce verbose output for
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
410 debugging (-v DEBUG), to change the threshold for making pdfs to a
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
411 q-value equal to or less than 0.1 (-d 0.1), and to plot
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
412 5 data (bug) features in the biplot (-b 5).
e0b5980139d9 maaslin
george-weingart
parents:
diff changeset
413