Package: microformer-mgm
MGMMGM (Microbial General Model) is a large-scaled pretrained language model for interpretable microbiome data analysis. The program is designed to help you to fine-tune and evaluate MGM to other microbiome data analysis tasks.InstallationTo install the MGM package, you can use setup.py:pythonsetup.pyinstallUsageYou can use MGM in the command line interface (CLI) with different modes. The general usage is:mgm<mode>[options]The available modes are:construct: Convert input abundance data to countmatrix at Genus level and normalize the countmatrix using phylogeny. Then construct a microbiome corpus using the countmatrix. Each sample is represented by a sentence from high rank genus to low rank genus. Input: the input data in hdf5, csv or tsv format. Rows represent features and columns represent samples. Output: a pkl file containing the microbiome corpus.e.g.:mgmconstruct-iinfant_data/abundance.csv-oinfant_corpus.pklif you provide a hdf5 file, you need to specify the key of the input file using-koption. The default key isgenus.pretrain: Pretrain the MGM model using the microbiome corpus followed BERT style. Input: corpus constructed byconstructmode, Output: pretrained MGM model.e.g.:mgmpretrain-iinfant_corpus.pkl-oinfant_modeltrain: Train supervised MGM model without mask pretrained weights. A microbiome corpus and properly labeled data must be provided. Label file should be in csv format, with the first column as sample names, second column as labels. Input: corpus constructed byconstructmode. label file in csv format with the first column as sample names, second column as labels. Output: supervised MGM model.e.g.:mgmtrain-iinfant_corpus.pkl-linfant_data/meta_withbirth.csv-oinfant_model_clffinetune: Finetune MGM model to fit in a new ontology, A microbiome corpus and properly labeled data must be provided. Use-modeloption to indicate a customized MGM model. If not provided, the pretrained MGM model on MGnify data will be used. Input: corpus constructed byconstructmode. label file in csv format with the first column as sample names, second column as labels. Pretrained model directory (Optional): finetuned MGM model.e.g.:mgmfinetune-iinfant_corpus.pkl-linfant_data/meta_withbirth.csv-minfant_model-oinfant_model_clf_finetunepredict: Predict the label of input data using the expert model. If the label file is provided with-E,the prediction results will be compared with the ground truth across different metrics. We recommend to use this mode to evaluate the performance of MGM model. If you want to perform your own evaluation, please pay attention to the thresholds.Input: corpus constructed byconstructmode. label file (Optional) in csv format with the first column as sample names, second column as labels. Supervised MGM model. Output: prediction results in csv format.e.g.:mgmpredict-E-iinfant_corpus.pkl-linfant_data/meta_withbirth.csv-minfant_model_clf-oinfant_prediction.csvFor more detailed usage, please refer to the help message of each mode:mgm<mode>--helpMaintainersNameEmailOrganizationHaohong Zhanghaohongzh@gmail.comPhD student, School of Life Science and Technology, Huazhong University of Science & TechnologyKang Ningningkang@hust.edu.cnProfessor, School of Life Science and Technology, Huazhong University of Science & Technology