Qiime1-14.利用监督学习进行分类

机器学习是一种目前流行且使用的生物信息分析方法。本节我们将基于菌群的丰度利用机器学习的方法建立分类器,对样本进行分类。

在运行命令之前,建议使用样本深度在1000左右的样本和稀疏表。此外,还可以使用多个不同的稀疏表来避免因仅采用单个稀疏表而引入的错误。选择一个包含多个样本的合适的稀疏深度非常重要,但通常来讲这样确定的稀疏深度值相对较高。所以,我们通常可以将中值作为采样深度。

稀疏表的生成

单个稀疏表(一个深度) Single Rarefaction

# Single Rarefaction
 single_rarefaction.py \
 -i otu_table.biom \
 -o otu_table_even100.biom \
 -d 1000

多个稀疏表(同一深度) Multiple rarefactions

# Multiple Rarefactions
multiple_rarefactions_even_depth.py \
-i otu_table.biom \
-o rarefied_otu_tables/ \
-d 100 \
-n 10

监督学习

supervised_learning.py \
-i otu_table.biom \
-o supervised_output \
-m mapping_file.txt \
-c SampleType \
--errortype oob \
--ntree 1000

部分参数讲解:
–category | -c metadata文件中用于对样本进行分组、最终绘图时作为x轴的变量名称

–errortype | -e在进行分类时错误估计的类型。有以下几种选择:oob, loo, cv5, cv10. oob: out-of-bag, fastest,默认为oob。
oob: 快速,用于只建立一个分类器的时候,需要快速计算错误估计值。
cv5-5-fold cross validation:提供错误的平均值和标准,适合大样本的估计,更为准确。
cv10-10-fold cross validation:会提供错误的平均值和标准差,最为准确。
loo-leave-one-out cross validation,:用于小样本(通常在30-50个样本左右)
–ntree | -n 用于建立分类器的树的树木。通常来讲越多分类器的效果越好,但是越多就需要更久的运算时间,所以需要选择一个合适的值。

生成文件
cv_probabilities.txt: the label probabilities for each of the given samples. (if available)
mislabeling.txt: A convenient presentation of cv_probabilities for mislabeling detection.
confusion_matrix.txt: confusion matrix for hold-out predictions.
summary.txt: a summary of the results, including the expected generalization error of the classifier
feature_importance_scores.txt: a list of discriminative OTUs with their associated importance scores (if available)

点赞