├── examples
├── README.md
└── corediv
│ ├── table_mc500.biom.gz
│ ├── table_even500.biom.gz
│ ├── taxa_plots
│ ├── table_mc500_sorted.biom
│ ├── table_mc500_sorted_L2.biom
│ ├── table_mc500_sorted_L3.biom
│ ├── table_mc500_sorted_L4.biom
│ ├── table_mc500_sorted_L5.biom
│ ├── table_mc500_sorted_L6.biom
│ └── taxa_summary_plots
│ │ ├── charts
│ │ ├── 2dgFy60JCUtHFAKy2iyUyRDZjtZtg7.png
│ │ ├── 302jgYT05Yr0nW4hQciTzCAa1ZwxaN.png
│ │ ├── 42WEmTdgLMKOHKK5Qx68Lx2BpjCNzU.png
│ │ ├── 8eOmunI0zrrllZUOJbYY58F40kZw3C.png
│ │ ├── CiDj7ioZEW5QzHAhesBiEgzzZ8rPQU.pdf
│ │ ├── GNRpHfWNeFYK02jCYjgJlxYZ7t08cx.png
│ │ ├── Hx5zCzhhDZUpUUaPppZXCS77WClTYx.png
│ │ ├── LOiZh59UiXO6kUN5HXiBBfZyddpc2o.pdf
│ │ ├── MHNlQLcLeLlPrgzssEzBBiW6YIHdHl.pdf
│ │ ├── NfaG0lzaeJy1ZRYO53scPTfkZztggP.pdf
│ │ ├── duIRn0ISGZMYMZoIQmH248wCKPmAwE.png
│ │ ├── fCmmkgADiqbPhFhjkpTQQdOsDKxppn.pdf
│ │ ├── k20PLgMqfdHqoyC5g7DczoZ0JQ02be.pdf
│ │ ├── oJs09z4uyBAhQ8OctdTdsjOsf5D0AY.pdf
│ │ ├── pKhKhGAJzUX9YaSaZwaxanaQQRkRIr.pdf
│ │ ├── r6BSPpElEzBJ0p2e6mOK0F0Xm6Zr0c.png
│ │ ├── sRMcA6z9WsqwwzFY70l6SXyRo1BB1F.pdf
│ │ ├── ywMuS4FF9bOI0BI1bXTyDsPrEmOZ3R.png
│ │ ├── z3ps0IGZhzCY2yOWi6KDcXjMwTpsHg.png
│ │ ├── zsHQzLWKFu3jdGSLiUsZLrMlR5HoUR.pdf
│ │ ├── 2dgFy60JCUtHFAKy2iyUyRDZjtZtg7_legend.pdf
│ │ ├── 302jgYT05Yr0nW4hQciTzCAa1ZwxaN_legend.pdf
│ │ ├── 42WEmTdgLMKOHKK5Qx68Lx2BpjCNzU_legend.pdf
│ │ ├── 8eOmunI0zrrllZUOJbYY58F40kZw3C_legend.pdf
│ │ ├── GNRpHfWNeFYK02jCYjgJlxYZ7t08cx_legend.pdf
│ │ ├── Hx5zCzhhDZUpUUaPppZXCS77WClTYx_legend.pdf
│ │ ├── duIRn0ISGZMYMZoIQmH248wCKPmAwE_legend.pdf
│ │ ├── r6BSPpElEzBJ0p2e6mOK0F0Xm6Zr0c_legend.pdf
│ │ ├── ywMuS4FF9bOI0BI1bXTyDsPrEmOZ3R_legend.pdf
│ │ └── z3ps0IGZhzCY2yOWi6KDcXjMwTpsHg_legend.pdf
│ │ └── css
│ │ └── qiime_style.css
│ ├── arare_max500
│ └── alpha_rarefaction_plots
│ │ └── average_plots
│ │ ├── chao1AGE.png
│ │ ├── chao1RUN.png
│ │ ├── chao1SEX.png
│ │ ├── chao1REGION.png
│ │ ├── chao1AGE_GROUP.png
│ │ ├── chao1BODY_SITE.png
│ │ ├── chao1COUNTRY.png
│ │ ├── chao1ELEVATION.png
│ │ ├── chao1LATITUDE.png
│ │ ├── chao1LONGITUDE.png
│ │ ├── chao1RUN_DATE.png
│ │ ├── chao1RUN_LANE.png
│ │ ├── chao1SampleID.png
│ │ ├── PD_whole_treeAGE.png
│ │ ├── PD_whole_treeRUN.png
│ │ ├── PD_whole_treeSEX.png
│ │ ├── chao1Description.png
│ │ ├── chao1PCR_PRIMERS.png
│ │ ├── chao1RUN_CENTER.png
│ │ ├── observed_otusAGE.png
│ │ ├── observed_otusRUN.png
│ │ ├── observed_otusSEX.png
│ │ ├── PD_whole_treeREGION.png
│ │ ├── chao1STUDY_ABSTRACT.png
│ │ ├── observed_otusREGION.png
│ │ ├── PD_whole_treeCOUNTRY.png
│ │ ├── PD_whole_treeLATITUDE.png
│ │ ├── PD_whole_treeRUN_DATE.png
│ │ ├── PD_whole_treeRUN_LANE.png
│ │ ├── PD_whole_treeSampleID.png
│ │ ├── chao1BarcodeSequence.png
│ │ ├── chao1HOST_COMMON_NAME.png
│ │ ├── chao1HOST_SUBJECT_ID.png
│ │ ├── observed_otusCOUNTRY.png
│ │ ├── observed_otusLATITUDE.png
│ │ ├── observed_otusRUN_DATE.png
│ │ ├── observed_otusRUN_LANE.png
│ │ ├── observed_otusSampleID.png
│ │ ├── PD_whole_treeAGE_GROUP.png
│ │ ├── PD_whole_treeBODY_SITE.png
│ │ ├── PD_whole_treeDescription.png
│ │ ├── PD_whole_treeELEVATION.png
│ │ ├── PD_whole_treeLONGITUDE.png
│ │ ├── PD_whole_treePCR_PRIMERS.png
│ │ ├── PD_whole_treeRUN_CENTER.png
│ │ ├── chao1FAMILY_RELATIONSHIP.png
│ │ ├── observed_otusAGE_GROUP.png
│ │ ├── observed_otusBODY_SITE.png
│ │ ├── observed_otusDescription.png
│ │ ├── observed_otusELEVATION.png
│ │ ├── observed_otusLONGITUDE.png
│ │ ├── observed_otusPCR_PRIMERS.png
│ │ ├── observed_otusRUN_CENTER.png
│ │ ├── chao1LinkerPrimerSequence.png
│ │ ├── PD_whole_treeBarcodeSequence.png
│ │ ├── PD_whole_treeHOST_COMMON_NAME.png
│ │ ├── PD_whole_treeHOST_SUBJECT_ID.png
│ │ ├── PD_whole_treeSTUDY_ABSTRACT.png
│ │ ├── observed_otusBarcodeSequence.png
│ │ ├── observed_otusHOST_COMMON_NAME.png
│ │ ├── observed_otusHOST_SUBJECT_ID.png
│ │ ├── observed_otusSTUDY_ABSTRACT.png
│ │ ├── PD_whole_treeFAMILY_RELATIONSHIP.png
│ │ ├── PD_whole_treeLinkerPrimerSequence.png
│ │ ├── chao1EXPERIMENT_DESIGN_DESCRIPTION.png
│ │ ├── observed_otusFAMILY_RELATIONSHIP.png
│ │ ├── observed_otusLinkerPrimerSequence.png
│ │ ├── PD_whole_treeEXPERIMENT_DESIGN_DESCRIPTION.png
│ │ └── observed_otusEXPERIMENT_DESIGN_DESCRIPTION.png
│ ├── bdiv_even500
│ ├── unweighted_unifrac_emperor_pcoa_plot
│ │ └── emperor_required_resources
│ │ │ ├── img
│ │ │ ├── play.png
│ │ │ ├── pause.png
│ │ │ ├── reset.png
│ │ │ ├── emperor.png
│ │ │ └── favicon.ico
│ │ │ ├── css
│ │ │ ├── images
│ │ │ │ ├── ui-icons_222222_256x240.png
│ │ │ │ ├── ui-icons_2e83ff_256x240.png
│ │ │ │ ├── ui-icons_454545_256x240.png
│ │ │ │ ├── ui-icons_888888_256x240.png
│ │ │ │ ├── ui-icons_cd0a0a_256x240.png
│ │ │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png
│ │ │ │ ├── ui-bg_flat_75_ffffff_40x100.png
│ │ │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png
│ │ │ │ ├── ui-bg_glass_65_ffffff_1x400.png
│ │ │ │ ├── ui-bg_glass_75_dadada_1x400.png
│ │ │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png
│ │ │ │ ├── ui-bg_glass_95_fef1ec_1x400.png
│ │ │ │ └── ui-bg_highlight-soft_75_cccccc_1x100.png
│ │ │ ├── colorPicker.css
│ │ │ └── d3.parcoords.css
│ │ │ ├── js
│ │ │ ├── js
│ │ │ │ ├── ColorConverter.js
│ │ │ │ └── Detector.js
│ │ │ ├── FileSaver.min.js
│ │ │ └── THREEx.screenshot.js
│ │ │ └── emperor
│ │ │ ├── js
│ │ │ ├── ui.js
│ │ │ ├── draw.js
│ │ │ ├── util.js
│ │ │ └── animate.js
│ │ │ └── css
│ │ │ └── emperor.css
│ └── weighted_unifrac_emperor_pcoa_plot
│ │ └── emperor_required_resources
│ │ ├── img
│ │ ├── pause.png
│ │ ├── play.png
│ │ ├── reset.png
│ │ ├── emperor.png
│ │ └── favicon.ico
│ │ ├── css
│ │ ├── images
│ │ │ ├── ui-icons_222222_256x240.png
│ │ │ ├── ui-icons_2e83ff_256x240.png
│ │ │ ├── ui-icons_454545_256x240.png
│ │ │ ├── ui-icons_888888_256x240.png
│ │ │ ├── ui-icons_cd0a0a_256x240.png
│ │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png
│ │ │ ├── ui-bg_flat_75_ffffff_40x100.png
│ │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png
│ │ │ ├── ui-bg_glass_65_ffffff_1x400.png
│ │ │ ├── ui-bg_glass_75_dadada_1x400.png
│ │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png
│ │ │ ├── ui-bg_glass_95_fef1ec_1x400.png
│ │ │ └── ui-bg_highlight-soft_75_cccccc_1x100.png
│ │ ├── colorPicker.css
│ │ └── d3.parcoords.css
│ │ ├── js
│ │ ├── js
│ │ │ ├── ColorConverter.js
│ │ │ └── Detector.js
│ │ ├── FileSaver.min.js
│ │ └── THREEx.screenshot.js
│ │ └── emperor
│ │ ├── js
│ │ ├── ui.js
│ │ ├── draw.js
│ │ └── util.js
│ │ └── css
│ │ └── emperor.css
│ ├── biom_table_summary.txt
│ ├── index.html
│ └── log_20170105140456.txt
├── bin
├── util
│ ├── .gitignore
│ ├── merge_taxa
│ ├── bdiv-regression
│ ├── plot-gradients.r
│ └── plot-differentiated-taxa.r
└── mwas_analysis.R
├── .gitignore
├── doc
├── mwas_flowchart.jpg
└── MWAS code structure.pdf
├── config
├── params
├── README
├── kegg.filter.list.txt
├── color.list.txt
└── cluster.var.txt
├── data
├── generate-stats.r
└── readme.txt
├── lib
├── roc_mwas.R
├── feature.selection.R
├── model.evaluation.R
├── statistics.R
├── gradients.r
├── preprocess_mwas.r
└── export_data.R
├── example
└── example_1.R
└── README.md
/examples/README.md:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/bin/util/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .Rproj.user
3 |
--------------------------------------------------------------------------------
/doc/mwas_flowchart.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/doc/mwas_flowchart.jpg
--------------------------------------------------------------------------------
/doc/MWAS code structure.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/doc/MWAS code structure.pdf
--------------------------------------------------------------------------------
/bin/util/merge_taxa:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | head -n 1 $1
3 |
4 | for f in $*
5 | do
6 | tail -n +2 ${f}
7 | done
8 |
--------------------------------------------------------------------------------
/examples/corediv/table_mc500.biom.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/table_mc500.biom.gz
--------------------------------------------------------------------------------
/examples/corediv/table_even500.biom.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/table_even500.biom.gz
--------------------------------------------------------------------------------
/config/params:
--------------------------------------------------------------------------------
1 | preprocess:keggfilterlist "kegg.filter.list.txt"
2 | heatmap.mwas:cluster.var “cluster.var.txt”
3 | heatmap.mwas:color.list “color.list.txt”
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/table_mc500_sorted.biom:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/table_mc500_sorted.biom
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/table_mc500_sorted_L2.biom:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/table_mc500_sorted_L2.biom
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/table_mc500_sorted_L3.biom:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/table_mc500_sorted_L3.biom
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/table_mc500_sorted_L4.biom:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/table_mc500_sorted_L4.biom
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/table_mc500_sorted_L5.biom:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/table_mc500_sorted_L5.biom
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/table_mc500_sorted_L6.biom:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/table_mc500_sorted_L6.biom
--------------------------------------------------------------------------------
/config/README:
--------------------------------------------------------------------------------
1 | README
2 |
3 | This folder contains a param file mapping various parameters of the functions within the MWAS package to their values. Follows the QIIME param file format.
4 |
5 |
--------------------------------------------------------------------------------
/config/kegg.filter.list.txt:
--------------------------------------------------------------------------------
1 | Carbohydrate Metabolism
2 | Lipid Metabolism
3 | Nucleotide Metabolism
4 | Amino Acid Metabolism
5 | Metabolism of Other Amino Acids
6 | Glycan Biosynthesis and Metabolism
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1AGE.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1AGE.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1RUN.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1RUN.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1SEX.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1SEX.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1REGION.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1REGION.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1AGE_GROUP.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1AGE_GROUP.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1BODY_SITE.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1BODY_SITE.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1COUNTRY.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1COUNTRY.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1ELEVATION.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1ELEVATION.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1LATITUDE.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1LATITUDE.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1LONGITUDE.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1LONGITUDE.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1RUN_DATE.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1RUN_DATE.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1RUN_LANE.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1RUN_LANE.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1SampleID.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1SampleID.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeAGE.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeAGE.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeRUN.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeRUN.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeSEX.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeSEX.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1Description.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1Description.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1PCR_PRIMERS.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1PCR_PRIMERS.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1RUN_CENTER.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1RUN_CENTER.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusAGE.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusAGE.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusRUN.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusRUN.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusSEX.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusSEX.png
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/2dgFy60JCUtHFAKy2iyUyRDZjtZtg7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/2dgFy60JCUtHFAKy2iyUyRDZjtZtg7.png
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/302jgYT05Yr0nW4hQciTzCAa1ZwxaN.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/302jgYT05Yr0nW4hQciTzCAa1ZwxaN.png
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/42WEmTdgLMKOHKK5Qx68Lx2BpjCNzU.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/42WEmTdgLMKOHKK5Qx68Lx2BpjCNzU.png
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/8eOmunI0zrrllZUOJbYY58F40kZw3C.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/8eOmunI0zrrllZUOJbYY58F40kZw3C.png
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/CiDj7ioZEW5QzHAhesBiEgzzZ8rPQU.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/CiDj7ioZEW5QzHAhesBiEgzzZ8rPQU.pdf
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/GNRpHfWNeFYK02jCYjgJlxYZ7t08cx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/GNRpHfWNeFYK02jCYjgJlxYZ7t08cx.png
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/Hx5zCzhhDZUpUUaPppZXCS77WClTYx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/Hx5zCzhhDZUpUUaPppZXCS77WClTYx.png
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/LOiZh59UiXO6kUN5HXiBBfZyddpc2o.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/LOiZh59UiXO6kUN5HXiBBfZyddpc2o.pdf
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/MHNlQLcLeLlPrgzssEzBBiW6YIHdHl.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/MHNlQLcLeLlPrgzssEzBBiW6YIHdHl.pdf
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/NfaG0lzaeJy1ZRYO53scPTfkZztggP.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/NfaG0lzaeJy1ZRYO53scPTfkZztggP.pdf
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/duIRn0ISGZMYMZoIQmH248wCKPmAwE.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/duIRn0ISGZMYMZoIQmH248wCKPmAwE.png
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/fCmmkgADiqbPhFhjkpTQQdOsDKxppn.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/fCmmkgADiqbPhFhjkpTQQdOsDKxppn.pdf
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/k20PLgMqfdHqoyC5g7DczoZ0JQ02be.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/k20PLgMqfdHqoyC5g7DczoZ0JQ02be.pdf
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/oJs09z4uyBAhQ8OctdTdsjOsf5D0AY.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/oJs09z4uyBAhQ8OctdTdsjOsf5D0AY.pdf
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/pKhKhGAJzUX9YaSaZwaxanaQQRkRIr.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/pKhKhGAJzUX9YaSaZwaxanaQQRkRIr.pdf
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/r6BSPpElEzBJ0p2e6mOK0F0Xm6Zr0c.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/r6BSPpElEzBJ0p2e6mOK0F0Xm6Zr0c.png
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/sRMcA6z9WsqwwzFY70l6SXyRo1BB1F.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/sRMcA6z9WsqwwzFY70l6SXyRo1BB1F.pdf
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/ywMuS4FF9bOI0BI1bXTyDsPrEmOZ3R.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/ywMuS4FF9bOI0BI1bXTyDsPrEmOZ3R.png
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/z3ps0IGZhzCY2yOWi6KDcXjMwTpsHg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/z3ps0IGZhzCY2yOWi6KDcXjMwTpsHg.png
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/zsHQzLWKFu3jdGSLiUsZLrMlR5HoUR.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/zsHQzLWKFu3jdGSLiUsZLrMlR5HoUR.pdf
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeREGION.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeREGION.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1STUDY_ABSTRACT.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1STUDY_ABSTRACT.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusREGION.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusREGION.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeCOUNTRY.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeCOUNTRY.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeLATITUDE.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeLATITUDE.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeRUN_DATE.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeRUN_DATE.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeRUN_LANE.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeRUN_LANE.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeSampleID.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeSampleID.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1BarcodeSequence.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1BarcodeSequence.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1HOST_COMMON_NAME.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1HOST_COMMON_NAME.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1HOST_SUBJECT_ID.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1HOST_SUBJECT_ID.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusCOUNTRY.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusCOUNTRY.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusLATITUDE.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusLATITUDE.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusRUN_DATE.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusRUN_DATE.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusRUN_LANE.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusRUN_LANE.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusSampleID.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusSampleID.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeAGE_GROUP.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeAGE_GROUP.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeBODY_SITE.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeBODY_SITE.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeDescription.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeDescription.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeELEVATION.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeELEVATION.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeLONGITUDE.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeLONGITUDE.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treePCR_PRIMERS.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treePCR_PRIMERS.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeRUN_CENTER.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeRUN_CENTER.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1FAMILY_RELATIONSHIP.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1FAMILY_RELATIONSHIP.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusAGE_GROUP.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusAGE_GROUP.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusBODY_SITE.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusBODY_SITE.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusDescription.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusDescription.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusELEVATION.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusELEVATION.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusLONGITUDE.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusLONGITUDE.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusPCR_PRIMERS.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusPCR_PRIMERS.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusRUN_CENTER.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusRUN_CENTER.png
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/2dgFy60JCUtHFAKy2iyUyRDZjtZtg7_legend.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/2dgFy60JCUtHFAKy2iyUyRDZjtZtg7_legend.pdf
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/302jgYT05Yr0nW4hQciTzCAa1ZwxaN_legend.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/302jgYT05Yr0nW4hQciTzCAa1ZwxaN_legend.pdf
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/42WEmTdgLMKOHKK5Qx68Lx2BpjCNzU_legend.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/42WEmTdgLMKOHKK5Qx68Lx2BpjCNzU_legend.pdf
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/8eOmunI0zrrllZUOJbYY58F40kZw3C_legend.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/8eOmunI0zrrllZUOJbYY58F40kZw3C_legend.pdf
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/GNRpHfWNeFYK02jCYjgJlxYZ7t08cx_legend.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/GNRpHfWNeFYK02jCYjgJlxYZ7t08cx_legend.pdf
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/Hx5zCzhhDZUpUUaPppZXCS77WClTYx_legend.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/Hx5zCzhhDZUpUUaPppZXCS77WClTYx_legend.pdf
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/duIRn0ISGZMYMZoIQmH248wCKPmAwE_legend.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/duIRn0ISGZMYMZoIQmH248wCKPmAwE_legend.pdf
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/r6BSPpElEzBJ0p2e6mOK0F0Xm6Zr0c_legend.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/r6BSPpElEzBJ0p2e6mOK0F0Xm6Zr0c_legend.pdf
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/ywMuS4FF9bOI0BI1bXTyDsPrEmOZ3R_legend.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/ywMuS4FF9bOI0BI1bXTyDsPrEmOZ3R_legend.pdf
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/charts/z3ps0IGZhzCY2yOWi6KDcXjMwTpsHg_legend.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/taxa_plots/taxa_summary_plots/charts/z3ps0IGZhzCY2yOWi6KDcXjMwTpsHg_legend.pdf
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1LinkerPrimerSequence.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1LinkerPrimerSequence.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeBarcodeSequence.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeBarcodeSequence.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeHOST_COMMON_NAME.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeHOST_COMMON_NAME.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeHOST_SUBJECT_ID.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeHOST_SUBJECT_ID.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeSTUDY_ABSTRACT.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeSTUDY_ABSTRACT.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusBarcodeSequence.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusBarcodeSequence.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusHOST_COMMON_NAME.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusHOST_COMMON_NAME.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusHOST_SUBJECT_ID.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusHOST_SUBJECT_ID.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusSTUDY_ABSTRACT.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusSTUDY_ABSTRACT.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeFAMILY_RELATIONSHIP.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeFAMILY_RELATIONSHIP.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeLinkerPrimerSequence.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeLinkerPrimerSequence.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1EXPERIMENT_DESIGN_DESCRIPTION.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/chao1EXPERIMENT_DESIGN_DESCRIPTION.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusFAMILY_RELATIONSHIP.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusFAMILY_RELATIONSHIP.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusLinkerPrimerSequence.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusLinkerPrimerSequence.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/img/play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/img/play.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/img/pause.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/img/pause.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/img/play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/img/play.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/img/reset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/img/reset.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/img/pause.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/img/pause.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/img/reset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/img/reset.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/img/emperor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/img/emperor.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/img/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/img/favicon.ico
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/img/emperor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/img/emperor.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/img/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/img/favicon.ico
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeEXPERIMENT_DESIGN_DESCRIPTION.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/PD_whole_treeEXPERIMENT_DESIGN_DESCRIPTION.png
--------------------------------------------------------------------------------
/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusEXPERIMENT_DESIGN_DESCRIPTION.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/arare_max500/alpha_rarefaction_plots/average_plots/observed_otusEXPERIMENT_DESIGN_DESCRIPTION.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-icons_222222_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-icons_222222_256x240.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-icons_2e83ff_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-icons_2e83ff_256x240.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-icons_454545_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-icons_454545_256x240.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-icons_888888_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-icons_888888_256x240.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-icons_cd0a0a_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-icons_cd0a0a_256x240.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-icons_222222_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-icons_222222_256x240.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-icons_2e83ff_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-icons_2e83ff_256x240.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-icons_454545_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-icons_454545_256x240.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-icons_888888_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-icons_888888_256x240.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-icons_cd0a0a_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-icons_cd0a0a_256x240.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_flat_0_aaaaaa_40x100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_flat_0_aaaaaa_40x100.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_flat_0_aaaaaa_40x100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_flat_0_aaaaaa_40x100.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_flat_75_ffffff_40x100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_flat_75_ffffff_40x100.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_glass_55_fbf9ee_1x400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_glass_55_fbf9ee_1x400.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_glass_65_ffffff_1x400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_glass_65_ffffff_1x400.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_glass_75_dadada_1x400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_glass_75_dadada_1x400.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_glass_75_e6e6e6_1x400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_glass_75_e6e6e6_1x400.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_glass_95_fef1ec_1x400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_glass_95_fef1ec_1x400.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_flat_75_ffffff_40x100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_flat_75_ffffff_40x100.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_glass_55_fbf9ee_1x400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_glass_55_fbf9ee_1x400.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_glass_65_ffffff_1x400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_glass_65_ffffff_1x400.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_glass_75_dadada_1x400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_glass_75_dadada_1x400.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_glass_75_e6e6e6_1x400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_glass_75_e6e6e6_1x400.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_glass_95_fef1ec_1x400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_glass_95_fef1ec_1x400.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danknights/mwas/HEAD/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png
--------------------------------------------------------------------------------
/config/color.list.txt:
--------------------------------------------------------------------------------
1 | # tab delimited, colors must be listed before variables. variable names and values must match exactly to values in mapping file
2 | Treatment.color antiquewhite darkseagreen1 thistle
Treatment Control PAT STAT
Sex.color pink lightblue
Sex F M
Diabetes_week.color indianred1 snow3
Diabetes_week early Diabetes late Diabetes
--------------------------------------------------------------------------------
/config/cluster.var.txt:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\cocoartf1265\cocoasubrtf210
2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;}
3 | {\colortbl;\red255\green255\blue255;}
4 | \margl1440\margr1440\vieww10800\viewh8400\viewkind0
5 | \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
6 |
7 | \f0\fs24 \cf0 Sex\
8 | Treatment}
--------------------------------------------------------------------------------
/bin/util/bdiv-regression:
--------------------------------------------------------------------------------
1 | #!/usr/bin/Rscript
2 | # regresses out distance that can be explained linearly by provided metadata
3 | # Rscript bdiv-regression.r distance-file map-file columns > new-distance-file
4 | source('~/drive//research/mwas/src/lib/bdiv.r')
5 |
6 | args <- commandArgs(trail=T)
7 | d <- read.table(args[1],sep='\t',head=T,row=1,check=F)
8 | m <- read.table(args[2],sep='\t',head=T,row=1,check=F,comment='')
9 | columns <- strsplit(args[3],',')[[1]]
10 |
11 | dr <- residual.distance(d,m[,columns,drop=F])
12 |
13 | cat('\t')
14 | write.table(dr,sep='\t',quote=F)
15 |
--------------------------------------------------------------------------------
/data/generate-stats.r:
--------------------------------------------------------------------------------
1 | m <- read.table('gg-map-adults.txt',sep='\t',head=T,row=1,check=F,comment='')
2 | dim(m)
3 | x <- read.table('taxa/merged-taxa.txt',sep='\t',head=T,row=1,check=F)
4 | dim(x)
5 | x <- t(as.matrix(read.table('taxa/merged-taxa.txt',sep='\t',head=T,row=1,check=F)))
6 | x <- x[rownames(m),]
7 | dim(m)
8 | dim(x)
9 | m$COUNTRY
10 | pvals <- apply(x,2,function(xx) kruskal.test(m$COUNTRY ~ xx)$p.value)
11 | pvals <- apply(x,2,function(xx) kruskal.test(xx ~ m$COUNTRY)$p.value)
12 | qvals <- p.adjust(pvals,'fdr')
13 | sort(qvals)[1:10]
14 | classwise.means <- apply(x,2, function(xx) sapply(split(xx, m$COUNTRY),mean))
15 | dim(classwise.means)
16 | mean(x[m$COUNTRY == levels(m$COUNTRY)[1],1])
17 | classwise.means[,1]
18 | classwise.means <- t(apply(x,2, function(xx) sapply(split(xx, m$COUNTRY),mean)))
19 | res <- data.frame(pvalues=pvals, qvalues=qvals, classwise.means)
20 | colnames(res)
21 | sink('stats/taxon-stats-table.txt'); cat('Taxon\t'); write.table(res,sep='\t',quote=F); sink(NULL)
22 |
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/colorPicker.css:
--------------------------------------------------------------------------------
1 | div.colorPicker-picker {
2 | height: 16px;
3 | width: 16px;
4 | padding: 0 !important;
5 | border: 1px solid #ccc;
6 | background: url(arrow.gif) no-repeat top right;
7 | cursor: pointer;
8 | line-height: 16px;
9 | }
10 |
11 | div.colorPicker-palette {
12 | width: 110px;
13 | position: absolute;
14 | border: 1px solid #598FEF;
15 | background-color: #EFEFEF;
16 | padding: 2px;
17 | z-index: 9999;
18 | }
19 | div.colorPicker_hexWrap {width: 100%; float:left }
20 | div.colorPicker_hexWrap label {font-size: 95%; color: #2F2F2F; margin: 5px 2px; width: 25%}
21 | div.colorPicker_hexWrap input {margin: 5px 2px; padding: 0; font-size: 95%; border: 1px solid #000; width: 65%; }
22 |
23 | div.colorPicker-swatch {
24 | height: 12px;
25 | width: 12px;
26 | border: 1px solid #000;
27 | margin: 2px;
28 | float: left;
29 | cursor: pointer;
30 | line-height: 12px;
31 | }
32 |
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/colorPicker.css:
--------------------------------------------------------------------------------
1 | div.colorPicker-picker {
2 | height: 16px;
3 | width: 16px;
4 | padding: 0 !important;
5 | border: 1px solid #ccc;
6 | background: url(arrow.gif) no-repeat top right;
7 | cursor: pointer;
8 | line-height: 16px;
9 | }
10 |
11 | div.colorPicker-palette {
12 | width: 110px;
13 | position: absolute;
14 | border: 1px solid #598FEF;
15 | background-color: #EFEFEF;
16 | padding: 2px;
17 | z-index: 9999;
18 | }
19 | div.colorPicker_hexWrap {width: 100%; float:left }
20 | div.colorPicker_hexWrap label {font-size: 95%; color: #2F2F2F; margin: 5px 2px; width: 25%}
21 | div.colorPicker_hexWrap input {margin: 5px 2px; padding: 0; font-size: 95%; border: 1px solid #000; width: 65%; }
22 |
23 | div.colorPicker-swatch {
24 | height: 12px;
25 | width: 12px;
26 | border: 1px solid #000;
27 | margin: 2px;
28 | float: left;
29 | cursor: pointer;
30 | line-height: 12px;
31 | }
32 |
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/d3.parcoords.css:
--------------------------------------------------------------------------------
1 | .parcoords > svg, .parcoords > canvas {
2 | font: 14px sans-serif;
3 | position: absolute;
4 | }
5 | .parcoords > canvas {
6 | pointer-events: none;
7 | }
8 | .parcoords rect.background {
9 | fill: transparent;
10 | }
11 | .parcoords rect.background:hover {
12 | fill: rgba(120,120,120,0.2);
13 | }
14 | .parcoords .resize rect {
15 | fill: rgba(0,0,0,0.1);
16 | }
17 | .parcoords rect.extent {
18 | fill: rgba(255,255,255,0.25);
19 | stroke: rgba(0,0,0,0.6);
20 | }
21 | .parcoords .axis line, .parcoords .axis path {
22 | fill: none;
23 | stroke: #fff;
24 | shape-rendering: crispEdges;
25 | }
26 |
27 | .parcoords text {
28 | stroke: #fff;
29 | shape-rendering: crispEdges;
30 | }
31 |
32 | .parcoords canvas {
33 | opacity: 1;
34 | -moz-transition: opacity 0.3s;
35 | -webkit-transition: opacity 0.3s;
36 | -o-transition: opacity 0.3s;
37 | }
38 | .parcoords canvas.faded {
39 | opacity: 0.25;
40 | }
41 |
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/css/d3.parcoords.css:
--------------------------------------------------------------------------------
1 | .parcoords > svg, .parcoords > canvas {
2 | font: 14px sans-serif;
3 | position: absolute;
4 | }
5 | .parcoords > canvas {
6 | pointer-events: none;
7 | }
8 | .parcoords rect.background {
9 | fill: transparent;
10 | }
11 | .parcoords rect.background:hover {
12 | fill: rgba(120,120,120,0.2);
13 | }
14 | .parcoords .resize rect {
15 | fill: rgba(0,0,0,0.1);
16 | }
17 | .parcoords rect.extent {
18 | fill: rgba(255,255,255,0.25);
19 | stroke: rgba(0,0,0,0.6);
20 | }
21 | .parcoords .axis line, .parcoords .axis path {
22 | fill: none;
23 | stroke: #fff;
24 | shape-rendering: crispEdges;
25 | }
26 |
27 | .parcoords text {
28 | stroke: #fff;
29 | shape-rendering: crispEdges;
30 | }
31 |
32 | .parcoords canvas {
33 | opacity: 1;
34 | -moz-transition: opacity 0.3s;
35 | -webkit-transition: opacity 0.3s;
36 | -o-transition: opacity 0.3s;
37 | }
38 | .parcoords canvas.faded {
39 | opacity: 0.25;
40 | }
41 |
--------------------------------------------------------------------------------
/data/readme.txt:
--------------------------------------------------------------------------------
1 | # mapping file: gg-map-adults.txt
2 | # OTU table (classic): GG_100nt_even10k-adults-s20.biom
3 | # OTU table (biom): GG_100nt_even10k-adults-s20.txt
4 | # genus-level taxonomy: taxa/GG_100nt_even10k-adults_L6.txt
5 | # multi-level taxonomy: taxa/merged-taxa.txt
6 | # distance matrix: beta/unweighted_unifrac_GG_100nt_even10k-adults.txt
7 | # pcoa file: beta/unweighted_unifrac_GG_100nt_even10k-adults_pcoa.txt
8 | # Classification column: COUNTRY
9 | # Regression column: AGE
10 | # feature stats table (qvalues): stats/taxon-stats-table.txt
11 |
12 |
13 | # GG input data were obtained from Antonion Gonzales Pena for
14 | # CHM "Rethinking Enterotypes" paper.
15 | # They were picked againts greengenes 13_8 and rarefied at 10k.
16 |
17 | # commands used to generate downstream tables:
18 | filter_samples_from_otu_table.py -m gg-map.txt -s 'Age:*,!None' -i GG_100nt_even10k.biom -o GG_100nt_even10k-adults.biom
19 | filter_otus_from_otu_table.py -s 20 -i GG_100nt_even10k-adults.biom -o GG_100nt_even10k-adults-s20.biom
20 | summarize_taxa.py -i GG_100nt_even10k-adults.biom -L '2,3,4,5,6,7' -o taxa
21 | sh ../../bin/util/merge_taxa taxa/GG_100nt_even10k-adults_L*.txt > taxa/merged-taxa.txt
22 | beta_diversity.py -i GG_100nt_even10k-adults.biom -o beta -t 97_otus.tree
23 | principal_coordinates.py -i beta/unweighted_unifrac_GG_100nt_even10k-adults.txt -o beta/unweighted_unifrac_GG_100nt_even10k-adults_pcoa.txt
24 |
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/js/js/ColorConverter.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author bhouston / http://exocortex.com/
3 | * @author zz85 / http://github.com/zz85
4 | */
5 |
6 | THREE.ColorConverter = {
7 |
8 | setHSV: function ( color, h, s, v ) {
9 |
10 | // https://gist.github.com/xpansive/1337890#file-index-js
11 | return color.setHSL( h, ( s * v ) / ( ( h = ( 2 - s ) * v ) < 1 ? h : ( 2 - h ) ), h * 0.5 );
12 |
13 | },
14 |
15 | getHSV: function( color ) {
16 |
17 | var hsl = color.getHSL();
18 |
19 | // based on https://gist.github.com/xpansive/1337890#file-index-js
20 | hsl.s *= ( hsl.l < 0.5 ) ? hsl.l : ( 1 - hsl.l );
21 |
22 | return {
23 | h: hsl.h,
24 | s: 2 * hsl.s / ( hsl.l + hsl.s ),
25 | v: hsl.l + hsl.s
26 | };
27 | },
28 |
29 | // where c, m, y, k is between 0 and 1
30 |
31 | setCMYK: function ( color, c, m, y, k ) {
32 |
33 | var r = ( 1 - c ) * ( 1 - k );
34 | var g = ( 1 - m ) * ( 1 - k );
35 | var b = ( 1 - y ) * ( 1 - k );
36 |
37 | return color.setRGB( r, g, b );
38 |
39 | },
40 |
41 | getCMYK: function ( color ) {
42 |
43 | var r = color.r;
44 | var g = color.g;
45 | var b = color.b;
46 | var k = 1 - Math.max(r, g, b);
47 | var c = ( 1 - r - k ) / ( 1 - k );
48 | var m = ( 1 - g - k ) / ( 1 - k );
49 | var y = ( 1 - b - k ) / ( 1 - k );
50 |
51 | return {
52 | c: c, m: m, y: y, k: k
53 | };
54 |
55 | }
56 |
57 |
58 | };
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/js/js/ColorConverter.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author bhouston / http://exocortex.com/
3 | * @author zz85 / http://github.com/zz85
4 | */
5 |
6 | THREE.ColorConverter = {
7 |
8 | setHSV: function ( color, h, s, v ) {
9 |
10 | // https://gist.github.com/xpansive/1337890#file-index-js
11 | return color.setHSL( h, ( s * v ) / ( ( h = ( 2 - s ) * v ) < 1 ? h : ( 2 - h ) ), h * 0.5 );
12 |
13 | },
14 |
15 | getHSV: function( color ) {
16 |
17 | var hsl = color.getHSL();
18 |
19 | // based on https://gist.github.com/xpansive/1337890#file-index-js
20 | hsl.s *= ( hsl.l < 0.5 ) ? hsl.l : ( 1 - hsl.l );
21 |
22 | return {
23 | h: hsl.h,
24 | s: 2 * hsl.s / ( hsl.l + hsl.s ),
25 | v: hsl.l + hsl.s
26 | };
27 | },
28 |
29 | // where c, m, y, k is between 0 and 1
30 |
31 | setCMYK: function ( color, c, m, y, k ) {
32 |
33 | var r = ( 1 - c ) * ( 1 - k );
34 | var g = ( 1 - m ) * ( 1 - k );
35 | var b = ( 1 - y ) * ( 1 - k );
36 |
37 | return color.setRGB( r, g, b );
38 |
39 | },
40 |
41 | getCMYK: function ( color ) {
42 |
43 | var r = color.r;
44 | var g = color.g;
45 | var b = color.b;
46 | var k = 1 - Math.max(r, g, b);
47 | var c = ( 1 - r - k ) / ( 1 - k );
48 | var m = ( 1 - g - k ) / ( 1 - k );
49 | var y = ( 1 - b - k ) / ( 1 - k );
50 |
51 | return {
52 | c: c, m: m, y: y, k: k
53 | };
54 |
55 | }
56 |
57 |
58 | };
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/emperor/js/ui.js:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * @author Yoshiki Vazquez Baeza
4 | * @copyright Copyright 2013, The Emperor Project
5 | * @credits Yoshiki Vazquez Baeza
6 | * @license BSD
7 | * @version 0.9.51
8 | * @maintainer Yoshiki Vazquez Baeza
9 | * @email yoshiki89@gmail.com
10 | * @status Release
11 | *
12 | */
13 |
14 | /**
15 | *
16 | * Formatting function that creates a table to display color pickers.
17 | *
18 | * @param {headers} mapping file headers
19 | * @param {data} mapping file data
20 | * @param {category} category in the mapping file
21 | * @param {id} id prefix added to every id element in the table
22 | *
23 | * @return a DOM document object where the table has been formated.
24 | *
25 | */
26 | function buildColorSelectorTable(headers, data, category, id){
27 | var categoryIndex, table, values = [], row, cell, div;
28 |
29 | categoryIndex = headers.indexOf(category);
30 |
31 | if (categoryIndex === -1){
32 | throw new Error('The category to build the table does not exist');
33 | }
34 |
35 | id = (id === undefined) ? '' : id+'-';
36 |
37 | // get all values of this category from the mapping file
38 | values = _.map(data, function(sample){ return sample[categoryIndex] });
39 | values = _.uniq(values);
40 | values = naturalSort(values);
41 |
42 | table = document.createElement('table');
43 |
44 | // see emperor.css
45 | table.className = 'emperor-tab-table';
46 |
47 | // we want to go in this order to have the first rows at the top
48 | for (var i=values.length-1; i >= 0; i--){
49 | row = table.insertRow();
50 |
51 | // add the name of the category to the right of the color box
52 | cell = row.insertCell();
53 | cell.title = values[i];
54 | cell.appendChild(document.createTextNode(values[i]));
55 |
56 | // create the div with the color selector
57 | cell = row.insertCell();
58 | div = document.createElement('div');
59 | div.id = id+'row-'+i+'-column-'+categoryIndex;
60 | div.className = 'colorbox';
61 | div.setAttribute('name', values[i]);
62 | cell.appendChild(div);
63 |
64 | }
65 |
66 | return table;
67 | }
68 |
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/emperor/js/ui.js:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * @author Yoshiki Vazquez Baeza
4 | * @copyright Copyright 2013, The Emperor Project
5 | * @credits Yoshiki Vazquez Baeza
6 | * @license BSD
7 | * @version 0.9.51
8 | * @maintainer Yoshiki Vazquez Baeza
9 | * @email yoshiki89@gmail.com
10 | * @status Release
11 | *
12 | */
13 |
14 | /**
15 | *
16 | * Formatting function that creates a table to display color pickers.
17 | *
18 | * @param {headers} mapping file headers
19 | * @param {data} mapping file data
20 | * @param {category} category in the mapping file
21 | * @param {id} id prefix added to every id element in the table
22 | *
23 | * @return a DOM document object where the table has been formated.
24 | *
25 | */
26 | function buildColorSelectorTable(headers, data, category, id){
27 | var categoryIndex, table, values = [], row, cell, div;
28 |
29 | categoryIndex = headers.indexOf(category);
30 |
31 | if (categoryIndex === -1){
32 | throw new Error('The category to build the table does not exist');
33 | }
34 |
35 | id = (id === undefined) ? '' : id+'-';
36 |
37 | // get all values of this category from the mapping file
38 | values = _.map(data, function(sample){ return sample[categoryIndex] });
39 | values = _.uniq(values);
40 | values = naturalSort(values);
41 |
42 | table = document.createElement('table');
43 |
44 | // see emperor.css
45 | table.className = 'emperor-tab-table';
46 |
47 | // we want to go in this order to have the first rows at the top
48 | for (var i=values.length-1; i >= 0; i--){
49 | row = table.insertRow();
50 |
51 | // add the name of the category to the right of the color box
52 | cell = row.insertCell();
53 | cell.title = values[i];
54 | cell.appendChild(document.createTextNode(values[i]));
55 |
56 | // create the div with the color selector
57 | cell = row.insertCell();
58 | div = document.createElement('div');
59 | div.id = id+'row-'+i+'-column-'+categoryIndex;
60 | div.className = 'colorbox';
61 | div.setAttribute('name', values[i]);
62 | cell.appendChild(div);
63 |
64 | }
65 |
66 | return table;
67 | }
68 |
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/js/js/Detector.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | * @author mr.doob / http://mrdoob.com/
4 | */
5 |
6 | var Detector = {
7 |
8 | canvas: !! window.CanvasRenderingContext2D,
9 | webgl: ( function () { try { var canvas = document.createElement( 'canvas' ); return !! window.WebGLRenderingContext && ( canvas.getContext( 'webgl' ) || canvas.getContext( 'experimental-webgl' ) ); } catch( e ) { return false; } } )(),
10 | workers: !! window.Worker,
11 | fileapi: window.File && window.FileReader && window.FileList && window.Blob,
12 |
13 | getWebGLErrorMessage: function () {
14 |
15 | var element = document.createElement( 'div' );
16 | element.id = 'webgl-error-message';
17 | element.style.fontFamily = 'monospace';
18 | element.style.fontSize = '13px';
19 | element.style.fontWeight = 'normal';
20 | element.style.textAlign = 'center';
21 | element.style.background = '#fff';
22 | element.style.color = '#000';
23 | element.style.padding = '1.5em';
24 | element.style.width = '400px';
25 | element.style.margin = '5em auto 0';
26 |
27 | if ( ! this.webgl ) {
28 |
29 | element.innerHTML = window.WebGLRenderingContext ? [
30 | 'Your graphics card does not seem to support WebGL.
',
31 | 'Find out how to get it here.'
32 | ].join( '\n' ) : [
33 | 'Your browser does not seem to support WebGL.
',
34 | 'Find out how to get it here.'
35 | ].join( '\n' );
36 |
37 | }
38 |
39 | return element;
40 |
41 | },
42 |
43 | addGetWebGLMessage: function ( parameters ) {
44 |
45 | var parent, id, element;
46 |
47 | parameters = parameters || {};
48 |
49 | parent = parameters.parent !== undefined ? parameters.parent : document.body;
50 | id = parameters.id !== undefined ? parameters.id : 'oldie';
51 |
52 | element = Detector.getWebGLErrorMessage();
53 | element.id = id;
54 |
55 | parent.appendChild( element );
56 |
57 | }
58 |
59 | };
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/js/js/Detector.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alteredq / http://alteredqualia.com/
3 | * @author mr.doob / http://mrdoob.com/
4 | */
5 |
6 | var Detector = {
7 |
8 | canvas: !! window.CanvasRenderingContext2D,
9 | webgl: ( function () { try { var canvas = document.createElement( 'canvas' ); return !! window.WebGLRenderingContext && ( canvas.getContext( 'webgl' ) || canvas.getContext( 'experimental-webgl' ) ); } catch( e ) { return false; } } )(),
10 | workers: !! window.Worker,
11 | fileapi: window.File && window.FileReader && window.FileList && window.Blob,
12 |
13 | getWebGLErrorMessage: function () {
14 |
15 | var element = document.createElement( 'div' );
16 | element.id = 'webgl-error-message';
17 | element.style.fontFamily = 'monospace';
18 | element.style.fontSize = '13px';
19 | element.style.fontWeight = 'normal';
20 | element.style.textAlign = 'center';
21 | element.style.background = '#fff';
22 | element.style.color = '#000';
23 | element.style.padding = '1.5em';
24 | element.style.width = '400px';
25 | element.style.margin = '5em auto 0';
26 |
27 | if ( ! this.webgl ) {
28 |
29 | element.innerHTML = window.WebGLRenderingContext ? [
30 | 'Your graphics card does not seem to support WebGL.
',
31 | 'Find out how to get it here.'
32 | ].join( '\n' ) : [
33 | 'Your browser does not seem to support WebGL.
',
34 | 'Find out how to get it here.'
35 | ].join( '\n' );
36 |
37 | }
38 |
39 | return element;
40 |
41 | },
42 |
43 | addGetWebGLMessage: function ( parameters ) {
44 |
45 | var parent, id, element;
46 |
47 | parameters = parameters || {};
48 |
49 | parent = parameters.parent !== undefined ? parameters.parent : document.body;
50 | id = parameters.id !== undefined ? parameters.id : 'oldie';
51 |
52 | element = Detector.getWebGLErrorMessage();
53 | element.id = id;
54 |
55 | parent.appendChild( element );
56 |
57 | }
58 |
59 | };
--------------------------------------------------------------------------------
/examples/corediv/biom_table_summary.txt:
--------------------------------------------------------------------------------
1 | Num samples: 66
2 | Num observations: 6356
3 | Total count: 121287
4 | Table density (fraction of non-zero values): 0.080
5 |
6 | Counts/sample summary:
7 | Min: 152.0
8 | Max: 3546.0
9 | Median: 1960.000
10 | Mean: 1837.682
11 | Std. dev.: 764.245
12 | Sample Metadata Categories: None provided
13 | Observation Metadata Categories: taxonomy
14 |
15 | Counts/sample detail:
16 | Amz33eld.418866: 152.0
17 | Amz31adlt.418759: 374.0
18 | Amz24chld.418412: 384.0
19 | Amz7adltF.418395: 449.0
20 | Amz23chld.418722: 480.0
21 | Amz6teen.418569: 483.0
22 | Amz6eldM.418356: 543.0
23 | Amz25chld.418466: 594.0
24 | Amz5chldF1.418757: 604.0
25 | Amz6eldF.418597: 661.0
26 | Amz29adlt.418370: 727.0
27 | Amz32eldF.418511: 967.0
28 | h305M.1.418771: 1168.0
29 | Amz22chld.418485: 1273.0
30 | h122M.1.418534: 1280.0
31 | h10M.1.418706: 1295.0
32 | Amz7eldM.418423: 1402.0
33 | Amz2adltF.418633: 1429.0
34 | Amz26chld.418481: 1509.0
35 | h37M.1.418863: 1543.0
36 | USchp4Mom.418666: 1554.0
37 | Amz4chldM2.418774: 1624.0
38 | TS13.418619: 1706.0
39 | Amz4adltF.418711: 1719.0
40 | USchp18Mom.418783: 1733.0
41 | TS25.418407: 1744.0
42 | USchp25Mom.418780: 1796.0
43 | Amz5teenF.418519: 1882.0
44 | h60M.1.418694: 1891.0
45 | Amz5chldF2.418405: 1893.0
46 | h78M.1.418725: 1900.0
47 | USchp3Child.418614: 1918.0
48 | h85M.1.418596: 1929.0
49 | k278A.2.418424: 1991.0
50 | h9M.1.418588: 1993.0
51 | TS109.418691: 2055.0
52 | USchp25Child.418345: 2083.0
53 | h101M.1.418586: 2131.0
54 | TS4.418810: 2140.0
55 | USchp1Mom.418814: 2142.0
56 | h95M.1.418831: 2162.0
57 | TS7.418860: 2188.0
58 | h147M.1.418531: 2195.0
59 | USchp33ChildB.418578: 2229.0
60 | TS163.418636: 2244.0
61 | h257M.1.418454: 2284.0
62 | USchp3Mom.418727: 2291.0
63 | h279M.1.418530: 2350.0
64 | TS184.418577: 2359.0
65 | TS1.418828: 2472.0
66 | TS127.418550: 2493.0
67 | h186M.1.418788: 2510.0
68 | TS193.418750: 2525.0
69 | TS111.418684: 2535.0
70 | USchp36Mom.418718: 2543.0
71 | h146M.1.418838: 2615.0
72 | h208M.1.418731: 2630.0
73 | h235M.1.418489: 2646.0
74 | TS129.418618: 2660.0
75 | h165M.1.418394: 2673.0
76 | h273M.1.418507: 2691.0
77 | h68M.1.418773: 2811.0
78 | TS195.418848: 2821.0
79 | h264M.1.418377: 2826.0
80 | Amz6chldM.418668: 2847.0
81 | Amz30adlt.418837: 3546.0
82 |
--------------------------------------------------------------------------------
/lib/roc_mwas.R:
--------------------------------------------------------------------------------
1 | # Receiver operating characteristic - using package 'pROC' or 'ROCR'
2 | # Contributors: Hu
3 | #
4 | # ----- input:
5 | # x: feature vector
6 | # model: trained model
7 | # predicted: predicted output using the trained model (if no model is specified as input)
8 | # response: desired response
9 | #
10 | # ----- output:
11 | # rocobj: ROC object
12 | # $auc class "auc"
13 | # $sensitivities sensitivities defining the ROC curve
14 | # $specificities specificities defining the ROC curve
15 | # $response response vector (desired)
16 | # $predictor the predictor vector converted to numeric as used to build the ROC curve
17 | # -----
18 | # Last update: 10/25/2014
19 | #
20 |
21 | "roc.mwas" <- function(x, model=NULL, predicted=NULL, response, is.plot=TRUE){
22 |
23 | # require(pROC, quietly=TRUE, warn.conflicts=FALSE)
24 |
25 | if (!is.null(model)&&is.null(predicted)) {
26 | predicted <- predict(model, x)
27 | }else if(is.null(model)&&is.null(predicted)){
28 | # if both model and predicted values are not provided, then informm the user and stop.
29 | stop("ROC fucntion needs at least one of the following values: trained model or predicted values!")
30 | }
31 |
32 | #roc.flag <- 1
33 | #for(id in length(levels(response))){
34 | # roc.flag <- roc.flag * length(which(response==levels(response)[id]))
35 | #}
36 |
37 | #if(roc.flag != 0){
38 | if (length(levels(response)) == 2) { # binary classification
39 | rocobj <- roc(response, as.numeric(predicted), percent=F, ci=F, plot=is.plot)
40 | if(is.plot){
41 | title_text <- sprintf("AUC=%.3f", rocobj$auc)
42 | usr <- par( "usr" )
43 | text( 0, usr[ 3 ] + 5, title_text, adj = c( 1, 0 ), col = "blue" )
44 | }
45 | } else {# multi-class classification
46 | rocobj <- multiclass.roc(response, as.numeric(predicted), percent=TRUE, plot=FALSE)
47 | if(is.plot){
48 | rocobj2 <- attr(rocobj$auc, "roc")$rocs[[3]]
49 | plot(rocobj2)
50 | title_text <- sprintf("AUC=%.3f", rocobj$auc)
51 | usr <- par( "usr" )
52 | text( 0, usr[ 3 ] + 5, title_text, adj = c( 1, 0 ), col = "blue" )
53 | }
54 | }
55 | #} else {
56 | # rocobj <- list()
57 | # rocobj$auc <- 0
58 | #rocobj <- NULL
59 | #}
60 | return(rocobj)
61 | }
62 |
63 |
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/js/FileSaver.min.js:
--------------------------------------------------------------------------------
1 | /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
2 | var saveAs=saveAs||navigator.msSaveBlob&&navigator.msSaveBlob.bind(navigator)||function(e){"use strict";var t=e.document,n=function(){return e.URL||e.webkitURL||e},r=e.URL||e.webkitURL||e,i=t.createElementNS("http://www.w3.org/1999/xhtml","a"),s="download"in i,o=function(n){var r=t.createEvent("MouseEvents");r.initMouseEvent("click",true,false,e,0,0,0,0,0,false,false,false,false,0,null);n.dispatchEvent(r)},u=e.webkitRequestFileSystem,a=e.requestFileSystem||u||e.mozRequestFileSystem,f=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},l="application/octet-stream",c=0,h=[],p=function(){var e=h.length;while(e--){var t=h[e];if(typeof t==="string"){r.revokeObjectURL(t)}else{t.remove()}}h.length=0},d=function(e,t,n){t=[].concat(t);var r=t.length;while(r--){var i=e["on"+t[r]];if(typeof i==="function"){try{i.call(e,n||e)}catch(s){f(s)}}}},v=function(t,r){var f=this,p=t.type,v=false,m,g,y=function(){var e=n().createObjectURL(t);h.push(e);return e},b=function(){d(f,"writestart progress write writeend".split(" "))},w=function(){if(v||!m){m=y(t)}if(g){g.location.href=m}else{window.open(m,"_blank")}f.readyState=f.DONE;b()},E=function(e){return function(){if(f.readyState!==f.DONE){return e.apply(this,arguments)}}},S={create:true,exclusive:false},x;f.readyState=f.INIT;if(!r){r="download"}if(s){m=y(t);i.href=m;i.download=r;o(i);f.readyState=f.DONE;b();return}if(e.chrome&&p&&p!==l){x=t.slice||t.webkitSlice;t=x.call(t,0,t.size,l);v=true}if(u&&r!=="download"){r+=".download"}if(p===l||u){g=e}if(!a){w();return}c+=t.size;a(e.TEMPORARY,c,E(function(e){e.root.getDirectory("saved",S,E(function(e){var n=function(){e.getFile(r,S,E(function(e){e.createWriter(E(function(n){n.onwriteend=function(t){g.location.href=e.toURL();h.push(e);f.readyState=f.DONE;d(f,"writeend",t)};n.onerror=function(){var e=n.error;if(e.code!==e.ABORT_ERR){w()}};"writestart progress write abort".split(" ").forEach(function(e){n["on"+e]=f["on"+e]});n.write(t);f.abort=function(){n.abort();f.readyState=f.DONE};f.readyState=f.WRITING}),w)}),w)};e.getFile(r,{create:false},E(function(e){e.remove();n()}),E(function(e){if(e.code===e.NOT_FOUND_ERR){n()}else{w()}}))}),w)}),w)},m=v.prototype,g=function(e,t){return new v(e,t)};m.abort=function(){var e=this;e.readyState=e.DONE;d(e,"abort")};m.readyState=m.INIT=0;m.WRITING=1;m.DONE=2;m.error=m.onwritestart=m.onprogress=m.onwrite=m.onabort=m.onerror=m.onwriteend=null;e.addEventListener("unload",p,false);return g}(self)
3 |
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/js/FileSaver.min.js:
--------------------------------------------------------------------------------
1 | /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
2 | var saveAs=saveAs||navigator.msSaveBlob&&navigator.msSaveBlob.bind(navigator)||function(e){"use strict";var t=e.document,n=function(){return e.URL||e.webkitURL||e},r=e.URL||e.webkitURL||e,i=t.createElementNS("http://www.w3.org/1999/xhtml","a"),s="download"in i,o=function(n){var r=t.createEvent("MouseEvents");r.initMouseEvent("click",true,false,e,0,0,0,0,0,false,false,false,false,0,null);n.dispatchEvent(r)},u=e.webkitRequestFileSystem,a=e.requestFileSystem||u||e.mozRequestFileSystem,f=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},l="application/octet-stream",c=0,h=[],p=function(){var e=h.length;while(e--){var t=h[e];if(typeof t==="string"){r.revokeObjectURL(t)}else{t.remove()}}h.length=0},d=function(e,t,n){t=[].concat(t);var r=t.length;while(r--){var i=e["on"+t[r]];if(typeof i==="function"){try{i.call(e,n||e)}catch(s){f(s)}}}},v=function(t,r){var f=this,p=t.type,v=false,m,g,y=function(){var e=n().createObjectURL(t);h.push(e);return e},b=function(){d(f,"writestart progress write writeend".split(" "))},w=function(){if(v||!m){m=y(t)}if(g){g.location.href=m}else{window.open(m,"_blank")}f.readyState=f.DONE;b()},E=function(e){return function(){if(f.readyState!==f.DONE){return e.apply(this,arguments)}}},S={create:true,exclusive:false},x;f.readyState=f.INIT;if(!r){r="download"}if(s){m=y(t);i.href=m;i.download=r;o(i);f.readyState=f.DONE;b();return}if(e.chrome&&p&&p!==l){x=t.slice||t.webkitSlice;t=x.call(t,0,t.size,l);v=true}if(u&&r!=="download"){r+=".download"}if(p===l||u){g=e}if(!a){w();return}c+=t.size;a(e.TEMPORARY,c,E(function(e){e.root.getDirectory("saved",S,E(function(e){var n=function(){e.getFile(r,S,E(function(e){e.createWriter(E(function(n){n.onwriteend=function(t){g.location.href=e.toURL();h.push(e);f.readyState=f.DONE;d(f,"writeend",t)};n.onerror=function(){var e=n.error;if(e.code!==e.ABORT_ERR){w()}};"writestart progress write abort".split(" ").forEach(function(e){n["on"+e]=f["on"+e]});n.write(t);f.abort=function(){n.abort();f.readyState=f.DONE};f.readyState=f.WRITING}),w)}),w)};e.getFile(r,{create:false},E(function(e){e.remove();n()}),E(function(e){if(e.code===e.NOT_FOUND_ERR){n()}else{w()}}))}),w)}),w)},m=v.prototype,g=function(e,t){return new v(e,t)};m.abort=function(){var e=this;e.readyState=e.DONE;d(e,"abort")};m.readyState=m.INIT=0;m.WRITING=1;m.DONE=2;m.error=m.onwritestart=m.onprogress=m.onwrite=m.onabort=m.onerror=m.onwriteend=null;e.addEventListener("unload",p,false);return g}(self)
3 |
--------------------------------------------------------------------------------
/examples/corediv/index.html:
--------------------------------------------------------------------------------
1 |
2 |
QIIME results
3 |
4 | 
5 |
24 | Need help? See http://help.qiime.org.
25 |
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/emperor/js/draw.js:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * @author Yoshiki Vazquez Baeza
4 | * @copyright Copyright 2013, The Emperor Project
5 | * @credits Yoshiki Vazquez Baeza
6 | * @license BSD
7 | * @version 0.9.51
8 | * @maintainer Yoshiki Vazquez Baeza
9 | * @email yoshiki89@gmail.com
10 | * @status Release
11 | *
12 | */
13 |
14 | /**
15 | *
16 | * @name THREE.EmperorTrajectory
17 | *
18 | * @class This class represents the internal logic for a linearly interpolated
19 | * tube/trajectory in THREE.js the object itself is a subclass of the
20 | * THREE.Curve.
21 | *
22 | * @credits: This answer in StackOverflow helped a lot:
23 | * http://stackoverflow.com/a/18580832/379593
24 | *
25 | */
26 | THREE.EmperorTrajectory = THREE.Curve.create(
27 | function ( points) {
28 | this.points = (points == undefined) ? [] : points;
29 | },
30 |
31 | function ( t ) {
32 | var points = this.points;
33 | var index = ( points.length - 1 ) * t;
34 | var floorIndex = Math.floor(index);
35 |
36 | if(floorIndex == points.length-1){
37 | return points[floorIndex];
38 | }
39 |
40 | var floorPoint = points[floorIndex];
41 | var ceilPoint = points[floorIndex+1];
42 |
43 | return floorPoint.clone().lerp(ceilPoint, index - floorIndex);
44 | }
45 | );
46 |
47 | THREE.EmperorTrajectory.prototype.getUtoTmapping = function(u) {
48 | return u;
49 | };
50 |
51 | /**
52 | *
53 | * Format an SVG string with labels and colors.
54 | *
55 | * @param {labels} Array object with the name of the labels.
56 | * @param {colors} Array object with the colors for each label.
57 | *
58 | * @return Returns an SVG string with the labels and colors values formated as
59 | * a legend.
60 | *
61 | */
62 | function formatSVGLegend(labels, colors){
63 | var labels_svg='', pos_y=1, increment=40, max_len=0, rect_width,
64 | font_size=12;
65 |
66 | for (var i=0; i';
71 |
72 | // add the name of the category
73 | labels_svg += ''+labels[i]+'';
76 |
77 | pos_y += increment;
78 | }
79 |
80 | // get the name with the maximum number of characters and get the length
81 | max_len = _.max(labels, function(a){return a.length}).length
82 |
83 | // duplicate the size of the rectangle to make sure it fits the labels
84 | rect_width = font_size*max_len*2;
85 |
86 | labels_svg = '';
88 |
89 | return labels_svg;
90 | }
91 |
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/emperor/js/draw.js:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * @author Yoshiki Vazquez Baeza
4 | * @copyright Copyright 2013, The Emperor Project
5 | * @credits Yoshiki Vazquez Baeza
6 | * @license BSD
7 | * @version 0.9.51
8 | * @maintainer Yoshiki Vazquez Baeza
9 | * @email yoshiki89@gmail.com
10 | * @status Release
11 | *
12 | */
13 |
14 | /**
15 | *
16 | * @name THREE.EmperorTrajectory
17 | *
18 | * @class This class represents the internal logic for a linearly interpolated
19 | * tube/trajectory in THREE.js the object itself is a subclass of the
20 | * THREE.Curve.
21 | *
22 | * @credits: This answer in StackOverflow helped a lot:
23 | * http://stackoverflow.com/a/18580832/379593
24 | *
25 | */
26 | THREE.EmperorTrajectory = THREE.Curve.create(
27 | function ( points) {
28 | this.points = (points == undefined) ? [] : points;
29 | },
30 |
31 | function ( t ) {
32 | var points = this.points;
33 | var index = ( points.length - 1 ) * t;
34 | var floorIndex = Math.floor(index);
35 |
36 | if(floorIndex == points.length-1){
37 | return points[floorIndex];
38 | }
39 |
40 | var floorPoint = points[floorIndex];
41 | var ceilPoint = points[floorIndex+1];
42 |
43 | return floorPoint.clone().lerp(ceilPoint, index - floorIndex);
44 | }
45 | );
46 |
47 | THREE.EmperorTrajectory.prototype.getUtoTmapping = function(u) {
48 | return u;
49 | };
50 |
51 | /**
52 | *
53 | * Format an SVG string with labels and colors.
54 | *
55 | * @param {labels} Array object with the name of the labels.
56 | * @param {colors} Array object with the colors for each label.
57 | *
58 | * @return Returns an SVG string with the labels and colors values formated as
59 | * a legend.
60 | *
61 | */
62 | function formatSVGLegend(labels, colors){
63 | var labels_svg='', pos_y=1, increment=40, max_len=0, rect_width,
64 | font_size=12;
65 |
66 | for (var i=0; i';
71 |
72 | // add the name of the category
73 | labels_svg += ''+labels[i]+'';
76 |
77 | pos_y += increment;
78 | }
79 |
80 | // get the name with the maximum number of characters and get the length
81 | max_len = _.max(labels, function(a){return a.length}).length
82 |
83 | // duplicate the size of the rectangle to make sure it fits the labels
84 | rect_width = font_size*max_len*2;
85 |
86 | labels_svg = '';
88 |
89 | return labels_svg;
90 | }
91 |
--------------------------------------------------------------------------------
/example/example_1.R:
--------------------------------------------------------------------------------
1 | # Example - using the whole pipeline
2 | #
3 | #
4 |
5 |
6 | #library(biom)
7 | setwd("~/Documents/R/mwas_git")
8 | # Source files
9 | #file.sources = list.files(c("C:/folder1", "C:/folder2"),
10 | file.sources = list.files("lib", pattern="*.R$",
11 | #file.sources = list.files(paste(Sys.getenv('MWAS_DIR'),'/lib',sep=''), pattern="*.R$",
12 | full.names=TRUE, ignore.case=TRUE)
13 | invisible(sapply(file.sources, source, .GlobalEnv))
14 |
15 | opts <- list()
16 | opts$mode <- "train"
17 | opts$input_fp <- "test/data/GG_100nt_even10k-adults-s20.biom"
18 | opts$map_fp <- "test/data/gg-map-adults.txt"
19 | opts$category <- "COUNTRY"
20 | opts$outdir <- "example/"
21 |
22 | ################### train
23 | opts <- list()
24 | opts$mode <- "train"
25 | opts$input_fp <- "test/data/GG_100nt_even10k-adults-s20.biom"
26 | opts$map_fp <- "test/data/gg-map-adults.txt"
27 | opts$category <- "COUNTRY"
28 | opts$outdir <- "example/train_model"
29 | opts$method <- "svm"
30 | opts$feat <- TRUE
31 | opts$suppress_relative_abundance_conversion <- FALSE
32 | opts$collapse_table <- FALSE
33 | opts$min_prevalence <- 0.01
34 | opts$transform_type <- "none"
35 | opts$validType <- "cv"
36 | opts$nfolds <- 10
37 |
38 | if(opts$outdir != ".") dir.create(opts$outdir,showWarnings=FALSE, recursive=TRUE)
39 |
40 | mwas.obj <- import.train.params(opts)
41 | model.obj <- train.mwas(mwas.obj)
42 | print("Training a model is finished!")
43 |
44 | ################# predict
45 | pred_opts <- list()
46 | pred_opts$input_fp <- "test/data/GG_100nt_even10k-adults-s20.biom"
47 | pred_opts$map_fp <- "test/data/gg-map-adults.txt"
48 | pred_opts$category <- "COUNTRY"
49 | pred_opts$outdir <- "example/"
50 | pred_opts$param_fp <- "example/trained_model.rds"
51 |
52 | pred.obj <- import.predict.params(pred_opts)
53 | results <- model.evaluation.mwas(pred.obj)
54 | export.mwas(model.eval=results, out.dir=pred_opts$outdir, file.name="prediction")
55 |
56 | ################# feature selection - RF
57 | opts <- list()
58 | opts$mode <- "train"
59 | opts$input_fp <- "test/data/GG_100nt_even10k-adults-s20.biom"
60 | opts$map_fp <- "test/data/gg-map-adults.txt"
61 | opts$category <- "COUNTRY"
62 | opts$outdir <- "example/"
63 | opts$method <- "svm"
64 | opts$feat <- TRUE
65 |
66 | case.mode <- tolower(opts$mode)
67 |
68 | mwas.obj <- import.train.params(opts)
69 | model.obj <- train.mwas(mwas.obj)
70 | print("Training a model is finished!")
71 |
72 | ################# plot test
73 | opts <- list()
74 | opts$mode <- "plot"
75 | opts$input_fp <- "test/data/taxa/merged-taxa.txt"
76 | opts$map_fp <- "test/data/gg-map-adults.txt"
77 | opts$category <- "COUNTRY"
78 | opts$outdir <- "example/"
79 | opts$feat_stats_fp <- "test/data/stats/taxon-stats-table.txt"
80 | opts$min_prevalence <- 0.1
81 | opts$method <- "beeswarm"
82 | opts$shorten_taxa <- FALSE
83 | opts$alpha <- 0.001
84 | opts$shorten_taxa <- TRUE
85 | opts$filter_kegg <- FALSE
86 | opts$collapse_table <- FALSE
87 | opts$suppress_relative_abundance_conversion <- FALSE
88 | opts$nplot <- 20
89 |
90 | mwas.obj <- import.plot.params(opts)
91 | plot(mwas.obj)
92 |
93 | ###### test plot gradients
94 | opts <- list()
95 | opts$mode <- "plot"
96 | opts$input_fp <- "test/data/taxa/merged-taxa.txt"
97 | opts$map_fp <- "test/data/gg-map-adults.txt"
98 | opts$category <- "COUNTRY"
99 | opts$outdir <- "example/gradients"
100 | opts$feat_stats <- "test/data/stats/taxon-stats-table.txt"
101 | opts$min_prevalence <- 0.1
102 | opts$method <- "gradients"
103 | opts$shorten_taxa <- FALSE
104 | opts$alpha <- 0.05
105 | opts$shorten_taxa <- TRUE
106 | opts$which_taxa <- 'k__Bacteria; p__Bacteroidetes; c__Bacteroidia; o__Bacteroidales; f__Bacteroidaceae; g__Bacteroides'
107 | opts$filter_kegg <- FALSE
108 | opts$collapse_table <- FALSE
109 | opts$suppress_relative_abundance_conversion <- FALSE
110 | opts$multiple_axes <- FALSE
111 |
112 | mwas.obj <- import.plot.params(opts)
113 | plot(mwas.obj)
114 |
--------------------------------------------------------------------------------
/lib/feature.selection.R:
--------------------------------------------------------------------------------
1 | # Feature selection using randomForest
2 | # This function is adapted from randomForest module in QIIME pipeline
3 | # Contributors: Hu, Dan
4 | #---
5 | # input:
6 | # x : feature vector
7 | # response : response
8 | # selection_threshold : threshold for feature selection (determines the number of feautres)
9 | # method: feature selection criterion;
10 | # "FDR" - based on the statistical test;
11 | # selected features have smaller false discovery rate than selection_threshold
12 | # "RF" - based on random Forest feature importance values
13 | # selected features have larger impartance value than selection_threshold
14 | # ---
15 | # output:
16 | # list of feature vector
17 | # $feautres: selected feature vector (values)
18 | # $id : selected feautre index (colnames) in the feature vector
19 | # ---
20 | # Last update: 03/01/2015
21 | #
22 |
23 | "feature.selection" <- function(x, response, selection_threshold = 0.05, method="FDR", out.dir = NULL){
24 |
25 | feat_set <- list()
26 |
27 | if(is.null(out.dir)) out.dir <- "."
28 |
29 | num_obs <- length(response)
30 |
31 | method <- tolower(method)
32 | switch(method,
33 | fdr = {
34 | file_name = sprintf("%s/%s_%.2f_feature_statistcs", out.dir, method, selection_threshold)
35 |
36 | feat.stats <- feature.statistics(x, response, selection_threshold, include.subset = TRUE)
37 | feat_set$id <- colnames(feat.stats$subset)
38 | feat_set$features <- x[,feat_set$id]
39 | #feat_set$scores <-
40 |
41 | cat(length(feat_set$id), " features are selected under the criterion FDR < ", selection_threshold, "\n")
42 |
43 | #file_name <- gsub(".txt", "", file_name)
44 | write.statistical.test.results(feat.stats, filename=file_name)
45 |
46 | ## TODO: determine the number of features for the reduced feature set
47 |
48 | },
49 | rf = {
50 | file_name = sprintf("%s/%s_%.2f_feature_importance_rank.txt", out.dir, method, selection_threshold)
51 |
52 | #model.rf <- tune.randomForest(x, y, importance=TRUE, mtry=seq(from=min(round(sqrt(num_species)), round(num_species/5)), to=max(round(sqrt(num_species)), round(4*num_species/5)), by=5),
53 | model.rf <- tune.randomForest(x, as.factor(response), importance=TRUE, mtry=c(round(sqrt(num_obs)/2), round(sqrt(num_obs)), round(2*sqrt(num_obs))),
54 | tunecontrol = tune.control(random=TRUE, sampling="cross", cross = 5))
55 | summary(model.rf)
56 |
57 | #rf.model <- randomForest(x, response, proximity = TRUE, importance=TRUE)
58 | #importances <- rf.model$importance[,'MeanDecreaseAccuracy']
59 | imp <- importance(model.rf$best.model, type =1, scale=T)
60 | importances_order <- order(imp, decreasing = T)
61 |
62 | ordered_feat_set <- colnames(x)[importances_order]
63 | ordered_feat_imp <- imp[importances_order]
64 |
65 | ordered_feat_list <- as.matrix(ordered_feat_imp, dimnames=list(ordered_feat_set))
66 | ordered_feat_list <- cbind(ordered_feat_list, model.rf$best.model$importance[importances_order,length(levels(response))+1])
67 | colnames(ordered_feat_list) <- c("Importance_value", "MeanDecreaseAccuracy")
68 |
69 | # save feature importance list
70 | file.out <- file(file_name, 'w')
71 | #write.table(imp, file.out, sep='\t')
72 | #flush(file.out)
73 | #close(file.out)
74 | sink(file.out)
75 | cat('Features\t')
76 | write.table(ordered_feat_list, quote=F, sep='\t')
77 | sink(NULL)
78 |
79 | feat_set$id <- ordered_feat_set[ordered_feat_imp > selection_threshold]
80 | feat_set$features <- x[, feat_set$id]
81 |
82 | cat(length(feat_set$id), " features are selected under the criterion feat_importance > ", selection_threshold, "\n")
83 | }
84 |
85 | )
86 | return(feat_set)
87 | }
88 |
89 | #"feature.number" <- function(feat_set, ){
90 |
91 | #}
92 |
--------------------------------------------------------------------------------
/lib/model.evaluation.R:
--------------------------------------------------------------------------------
1 | # If the desired response is known, then evaluate the model,
2 | # otherwise output the predicted labels.
3 | # -------------------
4 | # Contributors: Hu, Dan
5 | # -------------------
6 | # Model evaluation with different criteria.
7 | #
8 | # 1. classification accuracy
9 | # 2. area under the ROC (AUC)
10 | # 3. Matthew's correlation coefficients (MCC)
11 | # 4. Cohen's Kappa
12 | #
13 | # --- input:
14 | # x: feature vector
15 | # model: trained model
16 | # desired: desired output (response)
17 | #
18 | # --- output:
19 | # evalobj: evaluation object - $error, $accuracy, $auc, $mcc, $kappa,
20 | # $probabilities, $confusion
21 | #
22 | # ---
23 | # Last Update: 10/25/2014
24 | #
25 |
26 | "model.evaluation.mwas" <- function(data.set, model, desired){
27 |
28 | if (class(data.set)=="mwas"){
29 | x <- data.set$features
30 | model <- data.set$trained.model
31 | desired <- data.set$response
32 | }else x <- data.set
33 |
34 | evalobj <- list() # resutls object
35 |
36 | model.class <- tolower(class(model))
37 | #print(model.class)
38 | switch(model.class,
39 | randomforest = {
40 |
41 | evalobj$probabilities <- predict(model, x, type="prob")
42 | evalobj$prediction <- predict(model, x, type="response")
43 |
44 | }, ksvm={
45 | #predicted <- predict(model, x, type="response")
46 |
47 | #evalobj$probabilities <- attr(predicted, "probabilities")
48 | #evalobj$prediction <- predict(model, x)
49 |
50 | evalobj$prediction <- predict(model, x, type="response")
51 | evalobj$probabilities <- predict(model, x, type="probabilities")
52 |
53 | }, mlr={
54 |
55 | evalobj$prediction <- predict(model, x, type="link") # gives the linear predictors
56 | evalobj$probabilities <- predict(model, x, type="response") # gives the fitted probabilities
57 |
58 | }, knn={
59 | predicted <- predict(model, x)
60 | evalobj$prediction <- predicted
61 | evalobj$probabilities <- attr(predicted, "prob")
62 | }, stop('Please choose a classification method!')
63 | )
64 |
65 | #evalobj$prediction <- predicted
66 |
67 | is.binary <- length(levels(evalobj$prediction)) == 2
68 | if (!is.null(desired)){
69 | # if desired response is known, then evaluate the classifier model
70 | # else output the predicted labels
71 |
72 | sample.num <- length(desired)
73 |
74 | # confusion matrix
75 | c.matrix <- t(sapply(levels(desired), function(level) table(evalobj$prediction[desired==level])))
76 |
77 | rocobj <- roc.mwas(x, predicted = evalobj$prediction, response = desired)
78 | AUC <- rocobj$auc
79 |
80 | evalobj$confusion.matrix <- c.matrix
81 | error <- sum(as.numeric(evalobj$prediction) != as.numeric(desired))/sample.num
82 | accuracy <- sum(diag(c.matrix))/sum(c.matrix) # == 1 - evalobj$error
83 |
84 |
85 | # MCC = Pearson's correlation of y, yhat
86 | # MCC and Kappa for binary classification only
87 | if(is.binary){
88 |
89 | # MCC = (TP*TN - FP*FN)/(sqrt((TP+FP)(TP+FN)(TN+FP)(TN+FN)))
90 | MCC <- (c.matrix[1,1]*c.matrix[2,2])/(
91 | sqrt((c.matrix[1,1]+c.matrix[1,2])*
92 | (c.matrix[1,1]*c.matrix[2,1])*
93 | (c.matrix[2,2]*c.matrix[1,2])*
94 | (c.matrix[2,2]*c.matrix[2,1])))
95 |
96 | # Kappa = (Pr(a)-Pr(e))/(1-Pr(e))
97 | # Pr(a): relative observed agreement among raters = (TP+TN)/(P+N) = acc
98 | # Pr(e): the hypothetical probability of chance agreement
99 | # = ((TP+FP)/(P+N)*(TP+FP)/(P+N)+(FN+TN)/(P+N)*(FP+TN)/(P+N))
100 | Pr.e <- (c.matrix[1,1]+c.matrix[1,2])/sum(c.matrix)*(c.matrix[1,1]*c.matrix[2,1])/sum(c.matrix)+
101 | (c.matrix[2,1]*c.matrix[2,2])/sum(c.matrix)*(c.matrix[1,2]*c.matrix[2,2])/sum(c.matrix)
102 | Kappa <- (accuracy - Pr.e)/(1 - Pr.e)
103 | } else {
104 | MCC <- NULL
105 | Kappa <- NULL
106 | }
107 |
108 | evalobj$performance = c(error, accuracy, AUC, MCC, Kappa)
109 | if (length(evalobj$performance)==3) { names(evalobj$performance) <- c("error", "accuracy", "AUC")
110 | }else names(evalobj$performance) <- c("error", "accuracy", "AUC", " Matthews_corr_coeff","Cohens_Kappa")
111 | }
112 | #evalobj$rownames <- rownames(x)
113 | #evalobj$colnmaes <- levels(evalobj$prediction)
114 | return(evalobj)
115 | }
116 |
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/js/THREEx.screenshot.js:
--------------------------------------------------------------------------------
1 | /** @namespace */
2 | var THREEx = THREEx || {};
3 |
4 | // TODO http://29a.ch/2011/9/11/uploading-from-html5-canvas-to-imgur-data-uri
5 | // able to upload your screenshot without running servers
6 |
7 | // forced closure
8 | (function(){
9 |
10 | /**
11 | * Take a screenshot of a renderer
12 | * - require WebGLRenderer to have "preserveDrawingBuffer: true" to be set
13 | * - TODO is it possible to check if this variable is set ? if so check it
14 | * and make advice in the console.log
15 | * - maybe with direct access to the gl context...
16 | *
17 | * @param {Object} renderer to use
18 | * @param {String} mimetype of the output image. default to "image/png"
19 | * @param {String} dataUrl of the image
20 | */
21 | var toDataURL = function(renderer, mimetype)
22 | {
23 | mimetype = mimetype || "image/png";
24 | var dataUrl = renderer.domElement.toDataURL(mimetype);
25 | return dataUrl;
26 | }
27 |
28 | /**
29 | * resize an image to another resolution while preserving aspect
30 | *
31 | * @param {String} srcUrl the url of the image to resize
32 | * @param {Number} dstWidth the destination width of the image
33 | * @param {Number} dstHeight the destination height of the image
34 | * @param {Number} callback the callback to notify once completed with callback(newImageUrl)
35 | */
36 | var _aspectResize = function(srcUrl, dstW, dstH, callback){
37 | // to compute the width/height while keeping aspect
38 | var cpuScaleAspect = function(maxW, maxH, curW, curH){
39 | var ratio = curH / curW;
40 | if( curW >= maxW && ratio <= 1 ){
41 | curW = maxW;
42 | curH = maxW * ratio;
43 | }else if(curH >= maxH){
44 | curH = maxH;
45 | curW = maxH / ratio;
46 | }
47 | return { width: curW, height: curH };
48 | }
49 | // callback once the image is loaded
50 | var onLoad = function(){
51 | // init the canvas
52 | var canvas = document.createElement('canvas');
53 | canvas.width = dstW; canvas.height = dstH;
54 | var ctx = canvas.getContext('2d');
55 |
56 | // TODO is this needed
57 | ctx.fillStyle = "black";
58 | ctx.fillRect(0, 0, canvas.width, canvas.height);
59 |
60 | // scale the image while preserving the aspect
61 | var scaled = cpuScaleAspect(canvas.width, canvas.height, image.width, image.height);
62 |
63 | // actually draw the image on canvas
64 | var offsetX = (canvas.width - scaled.width )/2;
65 | var offsetY = (canvas.height - scaled.height)/2;
66 | ctx.drawImage(image, offsetX, offsetY, scaled.width, scaled.height);
67 |
68 | // dump the canvas to an URL
69 | var mimetype = "image/png";
70 | var newDataUrl = canvas.toDataURL(mimetype);
71 | // notify the url to the caller
72 | callback && callback(newDataUrl)
73 | }.bind(this);
74 |
75 | // Create new Image object
76 | var image = new Image();
77 | image.onload = onLoad;
78 | image.src = srcUrl;
79 | }
80 |
81 |
82 | // Super cooked function: THREEx.Screenshot.bindKey(renderer)
83 | // and you are done to get screenshot on your demo
84 |
85 | /**
86 | * Bind a key to renderer screenshot
87 | */
88 | var bindKey = function(renderer, opts){
89 | // handle parameters
90 | opts = opts || {};
91 | var charCode = opts.charCode || 'p'.charCodeAt(0);
92 | var width = opts.width;
93 | var height = opts.height;
94 | var callback = opts.callback || function(url){
95 | window.open(url, "name-"+Math.random());
96 | };
97 |
98 | // callback to handle keypress
99 | var onKeyPress = function(event){
100 | // return now if the KeyPress isnt for the proper charCode
101 | if( event.which !== charCode ) return;
102 | // get the renderer output
103 | var dataUrl = this.toDataURL(renderer);
104 |
105 | if( width === undefined && height === undefined ){
106 | callback( dataUrl )
107 | }else{
108 | // resize it and notify the callback
109 | // * resize == async so if callback is a window open, it triggers the pop blocker
110 | _aspectResize(dataUrl, width, height, callback);
111 | }
112 | }.bind(this);
113 |
114 | // listen to keypress
115 | // NOTE: for firefox it seems mandatory to listen to document directly
116 | document.addEventListener('keypress', onKeyPress, false);
117 |
118 | return {
119 | unbind : function(){
120 | document.removeEventListener('keypress', onKeyPress, false);
121 | }
122 | };
123 | }
124 |
125 | // export it
126 | THREEx.Screenshot = {
127 | toDataURL : toDataURL,
128 | bindKey : bindKey
129 | };
130 | })();
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/js/THREEx.screenshot.js:
--------------------------------------------------------------------------------
1 | /** @namespace */
2 | var THREEx = THREEx || {};
3 |
4 | // TODO http://29a.ch/2011/9/11/uploading-from-html5-canvas-to-imgur-data-uri
5 | // able to upload your screenshot without running servers
6 |
7 | // forced closure
8 | (function(){
9 |
10 | /**
11 | * Take a screenshot of a renderer
12 | * - require WebGLRenderer to have "preserveDrawingBuffer: true" to be set
13 | * - TODO is it possible to check if this variable is set ? if so check it
14 | * and make advice in the console.log
15 | * - maybe with direct access to the gl context...
16 | *
17 | * @param {Object} renderer to use
18 | * @param {String} mimetype of the output image. default to "image/png"
19 | * @param {String} dataUrl of the image
20 | */
21 | var toDataURL = function(renderer, mimetype)
22 | {
23 | mimetype = mimetype || "image/png";
24 | var dataUrl = renderer.domElement.toDataURL(mimetype);
25 | return dataUrl;
26 | }
27 |
28 | /**
29 | * resize an image to another resolution while preserving aspect
30 | *
31 | * @param {String} srcUrl the url of the image to resize
32 | * @param {Number} dstWidth the destination width of the image
33 | * @param {Number} dstHeight the destination height of the image
34 | * @param {Number} callback the callback to notify once completed with callback(newImageUrl)
35 | */
36 | var _aspectResize = function(srcUrl, dstW, dstH, callback){
37 | // to compute the width/height while keeping aspect
38 | var cpuScaleAspect = function(maxW, maxH, curW, curH){
39 | var ratio = curH / curW;
40 | if( curW >= maxW && ratio <= 1 ){
41 | curW = maxW;
42 | curH = maxW * ratio;
43 | }else if(curH >= maxH){
44 | curH = maxH;
45 | curW = maxH / ratio;
46 | }
47 | return { width: curW, height: curH };
48 | }
49 | // callback once the image is loaded
50 | var onLoad = function(){
51 | // init the canvas
52 | var canvas = document.createElement('canvas');
53 | canvas.width = dstW; canvas.height = dstH;
54 | var ctx = canvas.getContext('2d');
55 |
56 | // TODO is this needed
57 | ctx.fillStyle = "black";
58 | ctx.fillRect(0, 0, canvas.width, canvas.height);
59 |
60 | // scale the image while preserving the aspect
61 | var scaled = cpuScaleAspect(canvas.width, canvas.height, image.width, image.height);
62 |
63 | // actually draw the image on canvas
64 | var offsetX = (canvas.width - scaled.width )/2;
65 | var offsetY = (canvas.height - scaled.height)/2;
66 | ctx.drawImage(image, offsetX, offsetY, scaled.width, scaled.height);
67 |
68 | // dump the canvas to an URL
69 | var mimetype = "image/png";
70 | var newDataUrl = canvas.toDataURL(mimetype);
71 | // notify the url to the caller
72 | callback && callback(newDataUrl)
73 | }.bind(this);
74 |
75 | // Create new Image object
76 | var image = new Image();
77 | image.onload = onLoad;
78 | image.src = srcUrl;
79 | }
80 |
81 |
82 | // Super cooked function: THREEx.Screenshot.bindKey(renderer)
83 | // and you are done to get screenshot on your demo
84 |
85 | /**
86 | * Bind a key to renderer screenshot
87 | */
88 | var bindKey = function(renderer, opts){
89 | // handle parameters
90 | opts = opts || {};
91 | var charCode = opts.charCode || 'p'.charCodeAt(0);
92 | var width = opts.width;
93 | var height = opts.height;
94 | var callback = opts.callback || function(url){
95 | window.open(url, "name-"+Math.random());
96 | };
97 |
98 | // callback to handle keypress
99 | var onKeyPress = function(event){
100 | // return now if the KeyPress isnt for the proper charCode
101 | if( event.which !== charCode ) return;
102 | // get the renderer output
103 | var dataUrl = this.toDataURL(renderer);
104 |
105 | if( width === undefined && height === undefined ){
106 | callback( dataUrl )
107 | }else{
108 | // resize it and notify the callback
109 | // * resize == async so if callback is a window open, it triggers the pop blocker
110 | _aspectResize(dataUrl, width, height, callback);
111 | }
112 | }.bind(this);
113 |
114 | // listen to keypress
115 | // NOTE: for firefox it seems mandatory to listen to document directly
116 | document.addEventListener('keypress', onKeyPress, false);
117 |
118 | return {
119 | unbind : function(){
120 | document.removeEventListener('keypress', onKeyPress, false);
121 | }
122 | };
123 | }
124 |
125 | // export it
126 | THREEx.Screenshot = {
127 | toDataURL : toDataURL,
128 | bindKey : bindKey
129 | };
130 | })();
--------------------------------------------------------------------------------
/lib/statistics.R:
--------------------------------------------------------------------------------
1 | # Statistical testing function.
2 | # returns p-values, q-values,
3 | # indices of those below FDR, and renamed features with '*' etc.
4 | # and subset of data if requested
5 | # add.stars adds stars to the column names that are significant at .05, .01, .001, .0001
6 | # if filename is provided, saves result of statistical test to file
7 | # if parametric, uses t-test/ANOVA; else uses mann-whitney U/Kruskal-wallis
8 | # -------------
9 | # Contributors: Dan, Hu
10 | # -------------
11 | # Input:
12 | #
13 | # ------
14 | # Output:
15 | #
16 | # ------
17 | # Last update: 10/28/2014
18 | "statistical.test.mwas" <- function(data, ...){
19 |
20 | options <- list(...)
21 |
22 | if (class(data) == "mwas"){
23 | x <- data$features
24 | response <- data$response
25 | fdr <- data$fdr
26 | is.parametric <- data$is.parametric
27 | out.dir <- data$out.dir
28 | #include.subset <- data$include.subset
29 | test.type <- data$test.type
30 | } else{
31 | x <- data
32 | #response <- response
33 | #fdr <- f
34 | #is.parametric <- data$is.parametric
35 | #out.dir <- data$include.subset
36 | #test.type <- test.type
37 | }
38 |
39 | test.type <- tolower(test.type)
40 | switch(test.type,
41 | fdr = {
42 | results <- feature.statistics(x, response, fdr,
43 | parametric=is.parametric,
44 | include.subset=FALSE)
45 | write.statistical.test.results(results, out.dir = out.dir)
46 | cat("The feature statistics listed in the directory ", out.dir, "\n")
47 | },
48 | rf = {
49 | feature.selection(x, as.factor(response), selection_threshold = 0.05, method="rf", out.dir = out.dir)
50 | cat("The feature statistics are listed in the directory ", out.dir, "\n")
51 | },
52 | #ttest = {
53 | #
54 | # },
55 | stop("Please assign the correct testing type!(Optioins:ttest, FDR, ")
56 | )
57 | }
58 |
59 |
60 | "feature.statistics" <- function (x, response, fdr=0.05, parametric=FALSE, include.subset=FALSE){
61 | # response here is a column, not a name.
62 | response <- as.factor(as.character(response))
63 | if(length(unique(response)) < 2) stop('Response only has one level')
64 | if(parametric){
65 | pvals <- apply(x,2, function(taxon){
66 | if(var(taxon) == 0){
67 | NA
68 | } else {
69 | summary(lm(taxon~response))[[4]][2,4] # ANOVA test
70 | }
71 | })
72 | stats <- apply(x,2, function(taxon){
73 | if(var(taxon) == 0){
74 | NA
75 | } else {
76 | summary(lm(taxon~response))[[4]][2,1] # ANOVA test
77 | }
78 | })
79 | } else {
80 | if(length(levels(response)) == 2){
81 | ix1 <- response == levels(response)[1]
82 | ix2 <- response == levels(response)[2]
83 | pvals <- apply(x,2,function(taxon) wilcox.test(taxon[ix1],taxon[ix2],exact=FALSE)$p.value)
84 | stats <- apply(x,2,function(taxon) wilcox.test(taxon[ix1],taxon[ix2],exact=FALSE)$statistic)
85 | } else {
86 | pvals <- apply(x,2,function(taxon) kruskal.test(taxon ~ response)$p.value)
87 | stats <- apply(x,2,function(taxon) kruskal.test(taxon ~ response)$statistic)
88 | }
89 | }
90 | na.ix <- is.na(pvals)
91 |
92 | adj.pvals <- rep(NA,length(pvals))
93 | names(adj.pvals) <- names(pvals)
94 | adj.pvals[!na.ix] <- p.adjust(pvals[!na.ix],'fdr')
95 | keep.ix <- adj.pvals < fdr
96 | keep.ix[is.na(keep.ix)] <- FALSE
97 | if(!any(keep.ix)) stop('select.features failed to find any features with the given threshold.')
98 |
99 | # add stars to column names based on significance
100 | annotations <- colnames(x)
101 | stared.annotations <- annotations
102 | thresholds <- c(.05, .01, .001, .0001)
103 | signif.notation <- vector()
104 | for(i in seq_along(thresholds)){
105 |
106 | star.ix <- adj.pvals[!na.ix] <= thresholds[i]
107 |
108 | if(any(star.ix)){
109 | for(j in which(star.ix)){
110 | stared.annotations[!na.ix][j] <- paste0('*', stared.annotations[!na.ix][j])
111 | }
112 | }
113 | }
114 | result <- list()
115 | result$annotations <- stared.annotations
116 | result$features <- which(keep.ix)
117 | result$qvalues <- adj.pvals
118 | result$pvalues <- pvals
119 | result$stats <- stats
120 |
121 | # classwise means
122 | result$classwise.means <- t(apply(x,2,function(xx) sapply(split(xx,response),mean)))
123 | colnames(result$classwise.means) <- sprintf('%s mean',colnames(result$classwise.means))
124 |
125 | if(include.subset){
126 | result$subset <- x[,keep.ix,drop=F]
127 | colnames(result$subset) <- annotations[keep.ix]
128 | }
129 |
130 | return(result)
131 | }
132 |
133 |
134 | # linear test
135 | #"linear.test" <- function(x, y, covariates=NULL){
136 | # if(!is.null(covariates)){
137 | # covariates <- as.data.frame(covariates)
138 | # covariates <- cbind(y, covariates)
139 | # covariates <- droplevels(covariates)
140 | # design <- model.matrix(~ ., data=covariates)
141 | # } else {
142 | # design <- model.matrix(~y)
143 | # }
144 | # pvals <- apply(x, 2, function(xx) summary(lm(xx ~ ., data=covariates))[[4]][2,4])
145 | # return(pvals)
146 | #}
147 |
148 | #"t.test.wrapper" <- function(x, y, use.fdr=TRUE){
149 | # y <- as.factor(y)
150 | # ix1 <- y == levels(y)[1]
151 | # pvals <- apply(x,2,function(xx) t.test(xx[ix1],xx[!ix1])$p.value)
152 | # if(use.fdr) pvals <- p.adjust(pvals,'fdr')
153 | # return(pvals)
154 | #}
155 |
--------------------------------------------------------------------------------
/lib/gradients.r:
--------------------------------------------------------------------------------
1 | # Shows a PCoA plot colored by taxon gradients
2 | # x is the taxon
3 | # pc contains the two pc axes
4 | # filename: if not NULL, must be a string of the pdf output file name
5 | # scale.axes: e.g. c(1,-1) means to flip the second axis, not the first
6 | "show.gradients" <- function(x, pc, filename=NULL,
7 | incl.legend=FALSE,
8 | pt.alpha='FF',bin.type=c('raw','log','quantile')[3],
9 | title.text='',
10 | axis.labels=c('PC1','PC2')){
11 | gradcols <- rev(rainbow(100,start=0,end=2/3))
12 | gradcols <- sprintf('%s%s',sapply(gradcols,function(x) substring(x,1,7)),pt.alpha)
13 | # reorder points randomly for drawing order
14 | scrambleix <- sample(nrow(pc))
15 | x <- x[scrambleix]
16 | pc <- pc[scrambleix, ]
17 |
18 | pdf.width <- 5
19 | if(incl.legend) pdf.width <- 6.5
20 | if(!is.null(filename)) pdf(filename, width=5, height=5)
21 |
22 | par(cex.main=.65)
23 | par(cex.axis=.6)
24 |
25 | xlim <- range(pc[,1]) * 1.05
26 | ylim <- range(pc[,2]) * 1.05
27 | if(incl.legend) xlim[2] <- xlim[2] + diff(range(xlim)) * .25
28 | newx <- x
29 |
30 | if(bin.type=='quantile'){
31 | # quantiles require 11 gradient points, to include 0%, 10%, ... 100%
32 | legend.gradcols <- rev(rainbow(11,start=0,end=2/3))
33 | quantiles <- quantile(as.numeric(newx),probs=seq(0,1,length=length(gradcols)))
34 | gradixs <- sapply(newx, function(xx) min(which(quantiles >= xx)))
35 | } else if(bin.type=='log'){
36 | legend.gradcols <- rev(rainbow(10,start=0,end=2/3))
37 | newx[newx==0] <- min(newx[newx>0])/2
38 | newx <- log(newx,10)
39 | gradixs <- get.gradient.ixs(newx,length(gradcols))
40 | } else if(bin.type=='raw'){
41 | legend.gradcols <- rev(rainbow(10,start=0,end=2/3))
42 | gradixs <- get.gradient.ixs(newx,length(gradcols))
43 | }
44 | plot(pc[,1], pc[,2],type='p',pch=16, cex=1.5,
45 | col=gradcols[gradixs],
46 | xlab=axis.labels[1],ylab=axis.labels[2],main=title.text,
47 | xlim=xlim, ylim=ylim)
48 | if(incl.legend){
49 | legend.pos <- best.legend.location(pc[,1],pc[,2])
50 | if(bin.type=='quantile'){
51 | quantiles <- quantile(as.numeric(newx),probs=seq(0,1,length=length(legend.gradcols)))
52 | legend.text <- sprintf('%.3f', quantiles)
53 | } else {
54 | legend.text <- sprintf('%.2f',seq(min(newx), max(newx),length=length(legend.gradcols)))
55 | }
56 | legend.pos <- 'right'
57 | legend(legend.pos, legend.text, fill=legend.gradcols, cex=.65, y.intersp=1)
58 | }
59 |
60 | if(!is.null(filename)) dev.off()
61 | }
62 |
63 |
64 |
65 | # Shows a PCoA plot colored by taxon gradients
66 | # x is a factor to color by
67 | # pc contains the two pc axes
68 | # filename: if not NULL, must be a string of the pdf output file name
69 | # scale.axes: e.g. c(1,-1) means to flip the second axis, not the first
70 | "show.metadata" <- function(y, pc, filename=NULL,
71 | incl.legend=TRUE,
72 | pt.alpha='FF',
73 | title.text='',
74 | axis.labels=c('PC1','PC2')){
75 | #require('RColorBrewer')
76 | y.colors <- c(brewer.pal(9,'Set1'),brewer.pal(9,'Pastel1'),brewer.pal(8,'Dark2'),brewer.pal(8,'Accent'))
77 | y.colors <- sprintf('%s%s',y.colors,pt.alpha)
78 |
79 | # reorder points randomly for drawing order
80 | scrambleix <- sample(nrow(pc))
81 | y <- y[scrambleix]
82 | pc <- pc[scrambleix, ]
83 |
84 | y <- as.factor(as.character(y))
85 |
86 | pdf.width <- 5
87 | if(incl.legend) pdf.width <- 6.5
88 | if(!is.null(filename)) pdf(filename, width=5, height=5)
89 | color.ix <- as.numeric(y)
90 | if(max(color.ix) > length(y.colors)) stop(paste('y has more than',y.colors,'values.',sep=' '))
91 | par(cex.main=.8)
92 |
93 | xlim <- range(pc[,1]) * 1.05
94 | ylim <- range(pc[,2]) * 1.05
95 | if(incl.legend) xlim[2] <- xlim[2] + diff(range(xlim)) * .25
96 |
97 | plot(pc[,1], pc[,2],type='p',pch=16, cex=1.5,
98 | col=y.colors[color.ix],
99 | xlab=axis.labels[1],ylab=axis.labels[2],main=title.text,
100 | xlim=xlim, ylim=ylim)
101 | if(incl.legend){
102 | legend.pos <- 'right'
103 | legend(legend.pos, legend=levels(y), fill=y.colors, cex=.65, y.intersp=1)
104 | }
105 |
106 | if(!is.null(filename)) dev.off()
107 | }
108 |
109 |
110 | # converts real values to indices between 1 and n
111 | "get.gradient.ixs" <- function(x,n=10){
112 | stdx <- x-min(x)
113 | stdx <- stdx/abs(diff(range(stdx)))
114 | gradientix <- 1 + round((n-1)*stdx)
115 | return(gradientix)
116 | }
117 |
118 |
119 | # returns the best location from ('bottomleft','bottomright','topleft','topright')
120 | "best.legend.location" <- function(x,y,xlim=NULL,ylim=NULL){
121 | if(is.null(xlim)) xlim <- range(x)
122 | if(is.null(ylim)) ylim <- range(y)
123 |
124 | # get boundaries for a 3x3 grid
125 | xbounds <-seq(xlim[1],xlim[2],length=4)
126 | ybounds <-seq(ylim[1],ylim[2],length=4)
127 | density <- numeric(4)
128 | # bottom left
129 | density[1] <- sum(x < xbounds[2] & y < ybounds[2])
130 | # bottom right
131 | density[2] <- sum(x > xbounds[3] & y < ybounds[2])
132 | # top left
133 | density[3] <- sum(x < xbounds[2] & y > ybounds[3])
134 | # top right
135 | density[4] <- sum(x > xbounds[3] & y > ybounds[3])
136 | return(c('bottomleft','bottomright','topleft','topright')[which.min(density)])
137 | }
138 |
--------------------------------------------------------------------------------
/lib/preprocess_mwas.r:
--------------------------------------------------------------------------------
1 | # Preprocessing the original OTU table
2 | # Functions:
3 | # 1) Remove non-overlapping samples from OTU table, mapping file and distance matrix etc.
4 | # to make sure every sample in each table is one-to-one
5 | # ----------------
6 | # Contributors: Hu, PJ
7 | # ----------------
8 | # Input:
9 | # otu : OTU table
10 | # minOTUInSamples :
11 | # ----
12 | # Output:
13 | # otu : filtered otu table
14 | # -----
15 | # Last update: 10/27/2014
16 | #
17 |
18 | # temporary place holder for use by PJ until the real preprocess function is written
19 | "preprocess.mwas" <- function(input.data = NULL,
20 | map = NULL,
21 | distMat = NULL,
22 | kegg = NULL,
23 | min_prevalence = NULL,
24 | transform_type = "none",
25 | is.filter.kegg = FALSE,
26 | is.collapse = FALSE,
27 | is.relative.conversion = FALSE
28 | )
29 | {
30 | if (class(input.data)=="mwas"){
31 | otu <- input.data$otu
32 | map <- input.data$map
33 | distMat <- input.data$distMat
34 | taxa <- input.data$taxa
35 |
36 | min_prevalence <- input.data$min_prevalence
37 | transform_type <- input.data$transform_type
38 |
39 | }else otu <- input.data
40 |
41 | # remove nonoverlapping samples from OTU table, mapping file and other distance/PCoA table
42 | preprocess.obj <- remove.nonoverlapping.samples(map = map, otus = otu, distmat = distMat)
43 | otu <- preprocess.obj$otus
44 | map <- preprocess.obj$map
45 | taxa <- preprocess.obj$taxa
46 | distMat <- preprocess.obj$distmat
47 |
48 | if (!is.null(otu) & !is.null(map)) {
49 | if (dim(otu)[1]==0 | dim(map)[1]==0){
50 | stop('The sample IDs in the OTU table don\'t match the samples in the mapping file!')
51 | }
52 | }
53 |
54 | # convert to the relative abundance
55 | if(is.relative.conversion){
56 | otu[rowSums(otu)>0,] <- sweep(otu[rowSums(otu)>0,], 1, rowSums(otu[rowSums(otu)>0,]), '/') #relative abundance
57 | }
58 |
59 | # remove rare features (do by minimum prevalence or average prevalence)
60 | # proportion of an OTU over the whole population is larger than min_prevalence
61 | if (dim(otu)[2] > 1&&!is.null(min_prevalence))
62 | otu <- otu[,colMeans(otu > 0) >= min_prevalence, drop = FALSE]
63 |
64 | # data transform
65 | if(!is.null(transform_type)){
66 | switch(transform_type,
67 | asin_sqrt = {otu <- asin(sqrt(otu))
68 | },
69 | norm_asin_sqrt={otu <- asin(sqrt(otu))/asin(sqrt(1))
70 | },
71 | none = {otu <- otu},
72 | stop(paste('Unrecognized data transform type:', transform_type))
73 | )
74 | }
75 |
76 | # OTU collapse by correlation
77 | if (is.collapse){
78 | ret <- collapse.by.correlation(otu, .95)
79 | otu <- otu[, ret$reps]
80 | }
81 |
82 | # filter kegg pathways
83 | if(is.filter.kegg)
84 | {
85 | keep.pathways.file <- parse.params("preprocess", "keggfilterlist")
86 | kegg_pathways <- NULL
87 | # filter the kegg pathways by what's in the file
88 | kegg <- filter.pathways(kegg, keep.pathways.file)
89 | # return the next level up for displaying
90 | next.kegg <- get.next.kegg(kegg)
91 | names(next.kegg) <- names(kegg)
92 | kegg_pathways<-next.kegg
93 | } else kegg_pathways <- NULL
94 |
95 | return(list(otu=otu, kegg_pathways=kegg_pathways, map = map, distMat = distMat, taxa = taxa))
96 | }
97 |
98 | # This function filters the kegg descriptions by a vector of unknown-level kegg pathways
99 | # kegg: vector of kegg descriptions named by current kegg level
100 | # TODO: mention we havent implemented specifying current level filtering
101 | "filter.pathways" <- function(kegg, keep.pathways.file)
102 | {
103 | #filter by comparing to the entire database
104 | # kegg.db.file<- paste(Sys.getenv("MWAS.HEATMAP"),'/data/ko.to.pathways.txt', sep='')
105 | # kegg.db <- read.delim(kegg.db.file, header=T)
106 |
107 | pathways.to.keep <- read.delim(keep.pathways.file, header=F)[,1]
108 |
109 | keggnames <- names(kegg)
110 | kegg <- as.character(kegg)
111 | names(kegg) <- keggnames
112 | # split the kegg descriptions of this pathway table into L1, L2, L3
113 | keggsplit <- lapply(kegg, function(xx) unlist(strsplit(xx, split="; ", fixed=TRUE)))
114 | keggmatrix <- do.call(rbind, keggsplit)
115 |
116 | # remove any L1 pathways that begin with Unclassified;
117 | kegg <- kegg[keggmatrix[,1]!="Unclassified"]
118 | keggmatrix <- keggmatrix[keggmatrix[,1]!="Unclassified",]
119 | kegg.level <- 0
120 | for(i in 3:1){
121 | if(sum(keggmatrix[,i] %in% pathways.to.keep) > 0)
122 | kegg.level <- i
123 | }
124 | filtered.kegg <- kegg[keggmatrix[, kegg.level] %in% pathways.to.keep]
125 |
126 | as.factor(filtered.kegg)
127 | }
128 |
129 | # This function returns the next kegg level up from the current kegg level
130 | # kegg: vector of kegg description named by current kegg level
131 | "get.next.kegg" <- function(kegg)
132 | {
133 | # split the kegg descriptions of this pathway table into L1, L2, L3
134 | keggsplit <- lapply(as.character(kegg), function(xx) unlist(strsplit(xx, split="; ", fixed=TRUE)))
135 | keggmatrix <- do.call(rbind, keggsplit)
136 | kegg.level <- 0
137 | for(i in 3:1){
138 | if(identical(keggmatrix[,i], names(kegg)))
139 | kegg.level <- i
140 | }
141 | if(kegg.level == 1)
142 | stop("ERROR: current KEGG level cannot be 1")
143 | if(kegg.level == 0)
144 | stop("ERROR: check your kegg vector names. level not found.")
145 |
146 | kegg.level.up.one <- kegg.level-1
147 | kegg_pathways <- keggmatrix[, kegg.level.up.one]
148 | names(kegg_pathways) <- rownames(kegg)
149 | kegg_pathways
150 | }
--------------------------------------------------------------------------------
/bin/util/plot-gradients.r:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env Rscript
2 | # run with Rscript plot-gradients.r -i taxontable -w 'Bacteroides,Prevotella' -o outdir
3 |
4 | # REQUIRED GLOBAL VARIABLES: PLEASE EDIT
5 | #source(paste(Sys.getenv('MWAS_DIR'),'/lib/gradients.r',sep=''))
6 | #source(paste(Sys.getenv('MWAS_DIR'),'/lib/util.r',sep=''))
7 |
8 | require('RColorBrewer')
9 | require('optparse')
10 | require('vegan')
11 |
12 | # make option list and parse command line
13 | option_list <- list(
14 | make_option(c("-i","--input_fp"), type="character",
15 | help="QIIME-formatted input taxon table (tab-delimited text, not biom) [required]."),
16 | make_option(c("-m","--map_fp"), type="character",default=NULL,
17 | help="QIIME-formatted mapping file (optional). If provided, only samples in both taxon table and mapping file will be plotted."),
18 | make_option(c("-c","--column"), type="character",default=NULL,
19 | help="Name of metadata column to color plot by (optional). If included, does not plot gradients."),
20 | make_option(c("-d","--distance_fp"), type="character",default=NULL,
21 | help="QIIME-formatted distance table file (optional). If omitted, the script uses Bray-Curtis distance."),
22 | make_option(c("-p","--pcoa_fp"), type="character",default=NULL,
23 | help="QIIME-formatted pcoa table file (optional). If omitted, the script uses Bray-Curtis distance. If included, takes priority over --distance_fp."),
24 | make_option(c("-w", "--which_taxa"), type="character", default=NULL,
25 | help="Comma-separated list of taxa to plot [default: plot top --nplot taxa]"),
26 | make_option(c("-s", "--shorten_taxa"),action='store_true',default=FALSE,
27 | help="Shorten taxonomy names to lowest defined level. [default: %default]"),
28 | make_option(c("-x", "--multiple_axes"),action='store_true',default=FALSE,
29 | help="Show PC1 v PC2, PC1 v PC3, PC2 v PC3 in 3 separate plots. [default: %default]"),
30 | make_option(c("-n", "--nplot"), type="numeric", default=10,
31 | help="Number of taxa to plot (in order of decreasing mean). Ignored if --which_taxa exists [default: %default]"),
32 | make_option(c("-o", "--outdir"), type="character", default='.',
33 | help="Output directory [default %default]")
34 | )
35 | opts <- parse_args(OptionParser(option_list=option_list),
36 | args=commandArgs(trailing=TRUE))
37 |
38 | # create output directory if needed
39 | if(opts$outdir != ".") dir.create(opts$outdir,showWarnings=FALSE, recursive=TRUE)
40 |
41 | # LOAD DATA
42 | x <- t(read.table(opts$input_fp,sep='\t',head=T,row=1,check=F,quote='"'))
43 | if(!is.null(opts$map_fp)){
44 | m <- read.table(opts$map_fp,sep='\t',head=T,row=1,check=F,comment='',quote='"')
45 | # check rownames in mapping file matrix
46 | missing.taxa.samples <- setdiff(rownames(x), rownames(m))
47 | missing.map.samples <- setdiff(rownames(m), rownames(x))
48 | if(length(missing.taxa.samples) > 0){
49 | stop(sprintf('\n\nError: one or more sample names from taxonomy table (%s, ...) not present in metadata table (%s, ...).',
50 | paste(sort(missing.taxa.samples)[1:5],collapse=', '),
51 | paste(sort(missing.map.samples)[1:5],collapse=', ')))
52 | }
53 |
54 | x <- x[intersect(rownames(x),rownames(m)),,drop=F]
55 | m <- droplevels(m[rownames(x),,drop=F])
56 | }
57 |
58 | # check that taxon.names are in taxon table
59 | if(is.null(opts$which_taxa)){
60 | taxon.names <- colnames(x)[rev(order(colMeans(x)))]
61 | taxon.names <- taxon.names[1:min(opts$nplot, length(taxon.names))]
62 | } else {
63 | taxon.names <- strsplit(opts$which_taxa,',')[[1]]
64 |
65 | if(!all(taxon.names %in% colnames(x))){
66 | stop(paste('The following taxa are not present in the taxon table:',
67 | paste(taxon.names[!(taxon.names %in% colnames(x))],collapse=', '),
68 | '\n'))
69 | }
70 | }
71 |
72 | if(opts$shorten_taxa){
73 | colnames(x) <- shorten.taxonomy(colnames(x))
74 | taxon.names <- shorten.taxonomy(taxon.names)
75 | }
76 |
77 | if(is.null(opts$pcoa_fp)){
78 | if(is.null(opts$distance_fp)){
79 | d <- vegdist(x)
80 | } else {
81 | d <- read.table(opts$distance_fp,sep='\t',head=T,row=1,check=F)
82 | # check rownames in distance matrix
83 | missing.taxa.samples <- union(setdiff(rownames(x), rownames(d)), setdiff(rownames(x), colnames(d)))
84 | missing.distance.samples <- union(setdiff(rownames(d), rownames(x)), setdiff(colnames(d), rownames(x)))
85 | if(length(missing.taxa.samples) > 0){
86 | stop(sprintf('\n\nError: one or more sample names from taxonomy table (%s, ...) not present in distance table (%s, ...).',
87 | paste(sort(missing.taxa.samples)[1:5],collapse=', '),
88 | paste(sort(missing.distance.samples)[1:5],collapse=', ')))
89 | }
90 | d <- d[rownames(x),rownames(x)]
91 | d <- as.dist(d)
92 | }
93 |
94 | pc <- cmdscale(d,k=5)
95 | } else {
96 | pc <- read.table(opts$pcoa_fp,sep='\t',row=1,head=T)
97 | if(rownames(pc)[nrow(pc)] == '% variation explained'){
98 | pc <- pc[1:(nrow(pc)-2),1:min(5,ncol(pc))]
99 | }
100 | if(mean(rownames(x) %in% rownames(pc)) < 1){
101 | stop('Taxon table row names do not match PC file row names')
102 | }
103 | pc <- pc[rownames(x),]
104 | }
105 |
106 | # plots
107 | if(is.null(opts$column)) {
108 | fp <- sprintf('%s/gradients.pdf',opts$outdir)
109 | } else {
110 | if(!is.element(opts$column,colnames(m))) stop(paste(opts$column,'not in mapping file.'))
111 | fp <- sprintf('%s/pcoa.pdf',opts$outdir)
112 | }
113 | if(opts$multiple_axes){
114 | pdf(fp,width=11,height=3.75)
115 | par(mfrow=c(1,3))
116 | combs <- combn(1:3,2)
117 | } else {
118 | pdf(fp,width=6,height=5)
119 | combs <- matrix(1:2,ncol=1)
120 | }
121 |
122 | if(is.null(opts$column)){
123 | for(i in seq_along(taxon.names)){
124 | for(j in 1:ncol(combs)){
125 | show.gradients(x[,taxon.names[i]], pc[,combs[,j]], incl.legend=TRUE,pt.alpha='CC',
126 | axis.labels=sprintf('PC%d',combs[,j]),
127 | title.text=sprintf('%s - PC%d v PC%d',taxon.names[i],combs[1,j],combs[2,j]))
128 | }
129 | }
130 | } else {
131 | for(j in 1:ncol(combs)){
132 | show.metadata(m[,opts$column], pc[,combs[,j]], incl.legend=TRUE,pt.alpha='CC',
133 | axis.labels=sprintf('PC%d',combs[,j]),
134 | title.text=sprintf('%s - PC%d v PC%d',opts$column,combs[1,j],combs[2,j]))
135 | }
136 | }
137 | dev.off()
138 |
139 |
140 |
--------------------------------------------------------------------------------
/examples/corediv/log_20170105140456.txt:
--------------------------------------------------------------------------------
1 | Logging started at 14:04:56 on 05 Jan 2017
2 | QIIME version: 1.9.1
3 |
4 | qiime_config values:
5 | pick_otus_reference_seqs_fp /macqiime/anaconda/lib/python2.7/site-packages/qiime_default_reference/gg_13_8_otus/rep_set/97_otus.fasta
6 | sc_queue all.q
7 | pynast_template_alignment_fp /macqiime/anaconda/lib/python2.7/site-packages/qiime_default_reference/gg_13_8_otus/rep_set_aligned/85_otus.pynast.fasta
8 | cluster_jobs_fp start_parallel_jobs.py
9 | assign_taxonomy_reference_seqs_fp /macqiime/anaconda/lib/python2.7/site-packages/qiime_default_reference/gg_13_8_otus/rep_set/97_otus.fasta
10 | torque_queue friendlyq
11 | jobs_to_start 1
12 | denoiser_min_per_core 50
13 | assign_taxonomy_id_to_taxonomy_fp /macqiime/anaconda/lib/python2.7/site-packages/qiime_default_reference/gg_13_8_otus/taxonomy/97_otu_taxonomy.txt
14 | temp_dir /tmp/
15 | blastall_fp blastall
16 | seconds_to_sleep 60
17 |
18 | parameter file values:
19 | parallel:jobs_to_start 1
20 |
21 | Input file md5 sums:
22 | otu_table.biom: f2d0f34206db0efe8028362f4e65d94f
23 | map.txt: b905b0f21f00a49b3f5ad8f76016e7d4
24 | ../ref/greengenes/97_otus.tree: b7e76593bce82913af1cfb06edf15732
25 |
26 | Executing commands.
27 |
28 | # Generate BIOM table summary command
29 | biom summarize-table -i otu_table.biom -o corediv/biom_table_summary.txt
30 |
31 | Stdout:
32 |
33 | Stderr:
34 |
35 | # Filter low sequence count samples from table (minimum sequence count: 500) command
36 | filter_samples_from_otu_table.py -i otu_table.biom -o corediv/table_mc500.biom -n 500
37 |
38 | Stdout:
39 |
40 | Stderr:
41 |
42 | # Rarify the OTU table to 500 sequences/sample command
43 | single_rarefaction.py -i corediv/table_mc500.biom -o corediv/table_even500.biom -d 500
44 |
45 | Stdout:
46 |
47 | Stderr:
48 |
49 | Executing commands.
50 |
51 | # Beta Diversity (weighted_unifrac) command
52 | beta_diversity.py -i corediv/table_even500.biom -o corediv/bdiv_even500/ --metrics weighted_unifrac -t ../ref/greengenes/97_otus.tree
53 |
54 | Stdout:
55 |
56 | Stderr:
57 |
58 | # Rename distance matrix (weighted_unifrac) command
59 | mv corediv/bdiv_even500//weighted_unifrac_table_even500.txt corediv/bdiv_even500//weighted_unifrac_dm.txt
60 |
61 | Stdout:
62 |
63 | Stderr:
64 |
65 | # Principal coordinates (weighted_unifrac) command
66 | principal_coordinates.py -i corediv/bdiv_even500//weighted_unifrac_dm.txt -o corediv/bdiv_even500//weighted_unifrac_pc.txt
67 |
68 | Stdout:
69 |
70 | Stderr:
71 | /macqiime/anaconda/lib/python2.7/site-packages/skbio/stats/ordination/_principal_coordinate_analysis.py:107: RuntimeWarning: The result contains negative eigenvalues. Please compare their magnitude with the magnitude of some of the largest positive eigenvalues. If the negative ones are smaller, it's probably safe to ignore them, but if they are large in magnitude, the results won't be useful. See the Notes section for more details. The smallest eigenvalue is -0.0548020048157 and the largest is 1.52060295537.
72 | RuntimeWarning
73 |
74 | # Make emperor plots, weighted_unifrac) command
75 | make_emperor.py -i corediv/bdiv_even500//weighted_unifrac_pc.txt -o corediv/bdiv_even500//weighted_unifrac_emperor_pcoa_plot/ -m map.txt
76 |
77 | Stdout:
78 |
79 | Stderr:
80 |
81 | # Beta Diversity (unweighted_unifrac) command
82 | beta_diversity.py -i corediv/table_even500.biom -o corediv/bdiv_even500/ --metrics unweighted_unifrac -t ../ref/greengenes/97_otus.tree
83 |
84 | Stdout:
85 |
86 | Stderr:
87 |
88 | # Rename distance matrix (unweighted_unifrac) command
89 | mv corediv/bdiv_even500//unweighted_unifrac_table_even500.txt corediv/bdiv_even500//unweighted_unifrac_dm.txt
90 |
91 | Stdout:
92 |
93 | Stderr:
94 |
95 | # Principal coordinates (unweighted_unifrac) command
96 | principal_coordinates.py -i corediv/bdiv_even500//unweighted_unifrac_dm.txt -o corediv/bdiv_even500//unweighted_unifrac_pc.txt
97 |
98 | Stdout:
99 |
100 | Stderr:
101 |
102 | # Make emperor plots, unweighted_unifrac) command
103 | make_emperor.py -i corediv/bdiv_even500//unweighted_unifrac_pc.txt -o corediv/bdiv_even500//unweighted_unifrac_emperor_pcoa_plot/ -m map.txt
104 |
105 | Stdout:
106 |
107 | Stderr:
108 |
109 | Executing commands.
110 |
111 | # Alpha rarefaction command
112 | multiple_rarefactions.py -i corediv/table_mc500.biom -m 10 -x 500 -s 49 -o corediv/arare_max500//rarefaction/
113 |
114 | Stdout:
115 |
116 | Stderr:
117 |
118 | # Alpha diversity on rarefied OTU tables command
119 | alpha_diversity.py -i corediv/arare_max500//rarefaction/ -o corediv/arare_max500//alpha_div/ -t ../ref/greengenes/97_otus.tree
120 |
121 | Stdout:
122 |
123 | Stderr:
124 |
125 | # Collate alpha command
126 | collate_alpha.py -i corediv/arare_max500//alpha_div/ -o corediv/arare_max500//alpha_div_collated/
127 |
128 | Stdout:
129 |
130 | Stderr:
131 |
132 | # Removing intermediate files command
133 | rm -r corediv/arare_max500//rarefaction/ corediv/arare_max500//alpha_div/
134 |
135 | Stdout:
136 |
137 | Stderr:
138 |
139 | # Rarefaction plot: All metrics command
140 | make_rarefaction_plots.py -i corediv/arare_max500//alpha_div_collated/ -m map.txt -o corediv/arare_max500//alpha_rarefaction_plots/
141 |
142 | Stdout:
143 |
144 | Stderr:
145 |
146 | Skipping compare_alpha_diversity.py as no categories were provided.
147 |
148 | Executing commands.
149 |
150 | # Sort OTU Table command
151 | sort_otu_table.py -i corediv/table_mc500.biom -o corediv/taxa_plots/table_mc500_sorted.biom
152 |
153 | Stdout:
154 |
155 | Stderr:
156 |
157 | # Summarize Taxonomy command
158 | summarize_taxa.py -i corediv/taxa_plots/table_mc500_sorted.biom -o corediv/taxa_plots/
159 |
160 | Stdout:
161 |
162 | Stderr:
163 |
164 | # Plot Taxonomy Summary command
165 | plot_taxa_summary.py -i corediv/taxa_plots/table_mc500_sorted_L2.txt,corediv/taxa_plots/table_mc500_sorted_L3.txt,corediv/taxa_plots/table_mc500_sorted_L4.txt,corediv/taxa_plots/table_mc500_sorted_L5.txt,corediv/taxa_plots/table_mc500_sorted_L6.txt -o corediv/taxa_plots//taxa_summary_plots/
166 |
167 | Stdout:
168 |
169 | Stderr:
170 |
171 | Executing commands.
172 |
173 | # Compress the filtered BIOM table command
174 | gzip corediv/table_mc500.biom
175 |
176 | Stdout:
177 |
178 | Stderr:
179 |
180 | # Compress the rarefied BIOM table command
181 | gzip corediv/table_even500.biom
182 |
183 | Stdout:
184 |
185 | Stderr:
186 |
187 |
188 | Logging stopped at 14:26:57 on 05 Jan 2017
189 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ---
2 | Package Name: "MWAS R Package v0.9.3"
3 | Developers: "Hu Huang,Emmanuel Montassier, Pajau Vangay, Gabe Al Ghalith, Dan Knights"
4 | Date: "03-01-2015"
5 | ---
6 |
7 | ****
8 |
9 |
10 | **MWAS (microbiome-wide association study)** package is a R-based toolbox for microbiome study, developped by the members of the Knights Lab at the University of Minnesota, Twin Cities. It provides three main functional modules: learning a predictve model, predicting an unknown microbiome data, and visualization of different results. The latest update is version 0.9.3 (03-2015).
11 |
12 | MWAS is developed in R, however, it also provides a Unix command-line interface as a simplified application for those who are not familliar with R.
13 |
14 | ****
15 |
16 | (Examples are in preparation. Full document will be available soon.)
17 |
18 | #### 1. [Installing MWAS](http://rpubs.com/hwangtiger/install_mwas)
19 |
20 | Click the above link (section title) for more details.
21 |
22 | * Use the following command to set `MWAS_DIR` in the Terminal (or an equivalent command window; `/MWAS_directory` should be your actual directory):
23 | `echo "export MWAS_DIR=$HOME/MWAS_directory" >> ~/.bash_profile`
24 |
25 | * You might need to install dependencies seperately, if it cannot install or load the required packages. Most of the dependencies would be installed when running the corresponding function commands, except one pacakge `optparse`. Follow the steps below to install this package (_This step is needed only when you use the command-line functions for the first time_.):
26 | + Open R Console in Terminal (or use RStudio)
27 | + Install the pacakge: `install.packages("optparse")`
28 | + You should be able to use the MWAS functions now.
29 |
30 | *(Detailed testing information is available [here](http://rpubs.com/hwangtiger/install_mwas).)*
31 |
32 | ***
33 |
34 | #### 2. [MWAS "*learn*" Module](http://rpubs.com/hwangtiger/mwas_learn)
35 |
36 | * **Command-line version (in Terminal)**
37 | `Rscript MWAS_DIR/bin/mwas_analysis.R -w learn -M SVM -C linear -i MWAS_DIR/data/taxa/GG_100nt_even10k-adults_L7.biom -m MWAS_DIR/data/gg-map-adults.txt -o example/svm_output -c COUNTRY -f -v FDR -s 0.05`
38 |
39 | `-w`: learn mode
40 | `-M`: classifier type
41 | `-C`: kernel type for SVM
42 | `-i`: input file
43 | `-m`: mapfile
44 | `-c`: category name
45 | `-o`: output directory
46 | `-f`: proceed feature selection
47 | `-v`: feature selection method: `fdr` or `rf`
48 | `-s`: threshold for feature selection (determines the number of features)
49 |
50 | * **R version (in R Console)**
51 |
52 | If you are familiar with R, you could manipulate your data in a more flexible way. Here is the same example as shown in the command-line version.
53 |
54 | `file.sources = list.files("MWAS_DIR/lib", pattern="*.R$", full.names=TRUE, ignore.case=TRUE)`
55 | `invisible(sapply(file.sources, source, .GlobalEnv))`
56 |
57 | `opts <- list()`
58 | `opts$mode <- "learn"`
59 | `opts$method <- "SVM"`
60 | `opts$input_fp <- "data/taxa/GG_100nt_even10k-adults_L7.biom"`
61 | `opts$map_fp <- "data/gg-map-adults.txt"`
62 | `opts$category <- "COUNTRY"`
63 | `opts$outdir <- "example/svm_learn"`
64 | `opts$nfolds <- 5`
65 | `opts$method_param <- "linear"`
66 | `opts$ftMethod <- "FDR"`
67 | `opts$is_feat <- TRUE`
68 | `opts$feat_param <- 0.05`
69 |
70 | `train_params <- import.train.params(opts)`
71 | `best_model <- train.mwas(train_params)`
72 |
73 |
74 | ***
75 |
76 | #### 3. [MWAS "*predict*" Module](http://rpubs.com/hwangtiger/mwas_predict)
77 |
78 | ***
79 |
80 | #### 4. [MWAS Visualization Module](http://rpubs.com/hwangtiger/mwas_visualization)
81 |
82 | ***
83 |
84 | #### 5. [MWAS feature "*statistics*" Module](http://rpubs.com/hwangtiger/MWAS_feat_stats)
85 |
86 | ***
87 |
88 | #### 6. Example 1: Learning a predictive model
89 |
90 |
91 |
92 |
93 | ***
94 | #### 7. Example 2: Prediction from an unknown dataset
95 |
96 | ***
97 |
98 | #### 8. Example 3: Taxon Statistical Analysis and Visualization
99 |
100 | ***
101 |
102 | #### 9. Common Errors and Solutions
103 |
104 | ***
105 |
106 | ### References
107 | Breiman, L. (2001). **Random forests**. Machine learning. 45(1), 5-32.
108 | Leo Breiman and Adele Cutler. (2003) **Random Forest - Classification Description**. Retrieved on November 1, 2014 from [http://www.math.usu.edu/~adele/forests/cc_home.htm](http://www.math.usu.edu/~adele/forests/cc_home.htm)
109 | Hastie, T., Tibshirani, R., Friedman, J., Hastie, T., Friedman, J., & Tibshirani, R. (2009). **The Elements of Statistical Learning** (Vol. 2, No. 1). New York: springer.
110 | Adbi, H., & Williams, L. J. (2010). **Jackknife**. In: Neil Salkind (Ed.), _Encyclopedia of Research Design_. Thousand Oaks, CA: Sage.
111 | Robin, X., Turck, N., Hainard, A., Tiberti, N., Lisacek, F., Sanchez, J. C., & Müller, M. (2011). **pROC: an open-source package for R and S+ to analyze and compare ROC curves**. BMC bioinformatics, 12(1), 77.
112 | Chang, C. C., & Lin, C. J. (2011). **LIBSVM: a library for support vector machines**. ACM Transactions on Intelligent Systems and Technology (TIST), 2(3), 27.
113 | Karatzoglou, A., Smola, A., Hornik, K., & Zeileis, A. (2004). **kernlab-an S4 package for kernel methods in R**. Journal of Statistical Software, 11(9)
114 | Jerome Friedman, Trevor Hastie, Robert Tibshirani (2010). **Regularization paths for generalized linear models via coordinate descent**. Journal of Statistical Software, 33(1), 1-22.
115 | Ben-Hur, A., & Weston, J. (2010). **A user’s guide to support vector machines**. In: O. Carugo, F. Eisenhaber (eds.), _Data mining techniques for the life sciences_ (pp. 223-239). Humana Press.
116 | Cawley, G. C., & Talbot, N. L. (2010). **On over-fitting in model selection and subsequent selection bias in performance evaluation**. The Journal of Machine Learning Research, 11, 2079-2107.
117 | Storey, J. D. (2002). **A direct approach to false discovery rates**. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 64(3), 479-498.
118 | Noble, W. S. (2009). **How does multiple testing correction work?** Nature biotechnology, 27(12), 1135-1137.
119 | Storey, J.D. (2010). **False discovery rate**. Retrieved on Feb. 1, 2015, from [http://www.genomine.org/papers/Storey_FDR_2010.pdf](http://www.genomine.org/papers/Storey_FDR_2010.pdf)
120 | Hu Huang, Emmanuel Montassier, Pajau Vangay, Gabe Al Ghalith, Dan Knights. "**Robust statistical models for microbiome phenotype prediction with the MWAS package**" (in preparation)
121 |
122 |
--------------------------------------------------------------------------------
/lib/export_data.R:
--------------------------------------------------------------------------------
1 | # Export results to files
2 | #
3 | # Contributors: Hu, Dan
4 | # --- input:
5 | # trained.model : trained claissifier model and other parameters
6 | # trained.model.eval: model evaluation on the training set by using the trained model
7 | # (error, confusion matrix, AUC, MCC, Kappa)
8 | # model.perform : model performance estimation (mean +/- std error/auc)
9 | # feat.set : selected feature vector index
10 | # test.results: output from predict.mwas.R, it's an model.evaluation object
11 | # if there is no desired labels are given then it only contains
12 | # opts : options from users
13 | #
14 | # ------ ouput
15 | # export the required results to the designated directory (opts$outdir)
16 | # ------
17 | # Last update: 10/25/2014
18 | #
19 |
20 | # require(xlsx, quietly = TRUE, warn.conflicts=FALSE)
21 | # if (!require("xlsx", quietly=TRUE, warn.conflicts = FALSE)) {
22 | # install.packages("xlsx", dependencies = TRUE)
23 | # library(xlsx, verbose=F, warn.conflicts =F)
24 | # }
25 |
26 | "export.mwas" <- function(trained.model=NULL, model.eval=NULL, trained.model.perform=NULL,
27 | feat.set=NULL, out.dir=NULL, file.name="predcition_results"){
28 |
29 | if(is.null(out.dir)) out.dir <- '.'
30 |
31 | if(!is.null(trained.model)) {
32 | # save trained model and selected feature vector
33 | if(!is.null(feat.set)){
34 | # save feautre scores for each feature
35 | # save selected feature vector with names (OTU ID etc.)
36 | #
37 |
38 | best.model<-list()
39 | best.model$trained.model <- trained.model
40 | best.model$features <- feat.set # feature row names or index
41 | } else {
42 | best.model<-list()
43 | best.model$trained.model <- trained.model
44 | }
45 | # should save as rds format
46 | model.out.name <- sprintf('%s/trained_%s_model.rds', out.dir, class(trained.model))
47 | #saveRDS(best.model, file = paste(out.dir,"/trained_model.rds", collapse='', sep=''))
48 | saveRDS(best.model, file = model.out.name)
49 | }
50 |
51 | if (!is.null(model.eval)){
52 | # save predicted labels and/or likelihood probabilities
53 | # save classification accuracy, if there is acc
54 | # save likelihood probabilities, if there is any
55 | # save AUC, if there is any
56 | # save MCC, if there is any
57 | # save Cohen's Kappa, if there is any
58 | file.name <- sprintf('%s/%s.txt', out.dir, file.name)
59 |
60 | # save as .txt format
61 | #scipen.save <- options('scipen')
62 | #options(scipen=20) # avoid exponential notation
63 | sink(file.name)
64 | cat('The Jackknife model evaluation: \n\n')
65 | cat('\t Error rate: \t', model.eval$mean.error, " +/- ", model.eval$std.error, "\n\n")
66 | cat('\t AUC from ROC: \t', model.eval$mean.auc, " +/- ", model.eval$std.auc, "\n\n")
67 | sink(NULL)
68 | #options(scipen=scipen.save)
69 | #save.xlsx(objects=model.eval, file.name=file.name)
70 | }
71 |
72 | if (!is.null(trained.model.perform)){
73 | # save trained model evaluation
74 | file.name1 <- sprintf('%s/trained_%s_model_perform_labels.txt', out.dir, class(trained.model))
75 | #save.xlsx(objects=trained.model.perform, file.name=file.name)
76 | pred.table <- data.frame(Labels=trained.model.perform$prediction, trained.model.perform$probabilities)
77 | #rownames(pred.table) <- trained.model.perform$rownames
78 | colnames(pred.table)[1] <- "Labels"
79 | #colnames(pred.table) <- c("labels", trained.model.perform$colnames)
80 | sink(file.name1)
81 | cat("SampleID\t")
82 | write.table(pred.table, quote=F, sep='\t', row.names=TRUE)
83 | sink(NULL)
84 |
85 | file.name2 <- sprintf('%s/trained_%s_model_performance.txt', out.dir, class(trained.model))
86 |
87 | #perform_table <- list() #data.frame(trained.model.perform$confusion.matrix, trained.model.perform$performance)
88 | #perform_table$confusion.matrix <- trained.model.perform$confusion.matrix
89 | #perform_table$performance <- trained.model.perform$performance
90 |
91 | sink(file.name2)
92 | #lapply(perform_table, print, file=file.name2, append=TRUE)
93 | print(trained.model.perform$confusion.matrix, max.levels=500)
94 | cat("\n\n")
95 | print(trained.model.perform$performance)
96 | sink(NULL)
97 | }
98 |
99 | if (!is.null(feat.set)){
100 | feat_file_name <- sprintf('%s/selected_feature_sets.txt', out.dir)
101 | file.out <- file(feat_file_name, 'w')
102 | #names(feat.set) <- "Features"
103 | #cat("ID\tFeatures - ")
104 | write.table(feat.set, file.out, sep='\t')
105 | flush(file.out)
106 | close(file.out)
107 | }
108 | cat("The results are saved in ", out.dir)
109 | }
110 |
111 | # save data tabel in a Excel workbook.
112 | # The original code is by Rob Kabacoff
113 | # from: http://www.r-bloggers.com/quickly-export-multiple-r-objects-to-an-excel-workbook/
114 | #
115 | # "save.xlsx" <- function (objects, file.name){
116 | #
117 | # # objects <- list(...)
118 | # fargs <- as.list(match.call(expand.dots = TRUE))
119 | # objnames <- as.character(fargs)[-c(1, 2)]
120 | # objnames <- names(objects)
121 | # nobjects <- length(objects)
122 | # for (i in 1:nobjects) {
123 | # if (i == 1) {
124 | # write.xlsx(objects[[i]], file.name, sheetName = objnames[i])
125 | # }else write.xlsx(objects[[i]], file.name, sheetName = objnames[i], append = TRUE)
126 | # }
127 | # print(paste("Workbook", file.name, "has", nobjects, "worksheets."))
128 | # }
129 |
130 |
131 | # saves list of results from feature.statistics to file (or prints)
132 | "write.statistical.test.results" <- function(results, out.dir=NULL, filename='feature_statistics'){
133 |
134 | if(is.null(out.dir)) out.dir <- '.'
135 |
136 | # save as .txt format
137 | scipen.save <- options('scipen')
138 | options(scipen=20) # avoid exponential notation
139 | hits <- cbind(results$pvalues, results$qvalues)
140 | hits <- cbind(hits, results$classwise.means)
141 | colnames(hits)[1:2] <- c('pvalue','qvalue')
142 | hits <- hits[!is.na(hits[,1]),,drop=F] # remove all NA values
143 | hits <- hits[order(hits[,1]),]
144 | filename1 <- sprintf("%s/%s.txt", out.dir, filename)
145 | sink(filename1)
146 | cat('Features\t')
147 | write.table(hits,quote=F,sep='\t')
148 | sink(NULL)
149 | options(scipen=scipen.save)
150 |
151 | # save as .xlsx format
152 | #filename2 <- sprintf("%s.xlsx", filename)
153 | #hits <- cbind(rownames(hits), hits)
154 | #colnames(hits)[1] <- "Features"
155 | #write.xlsx(hits, filename2, row.names=FALSE, sheetName = results)
156 |
157 | }
158 |
159 |
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/emperor/css/emperor.css:
--------------------------------------------------------------------------------
1 | /*
2 | * __author__ = "Meg Pirrung"
3 | * __copyright__ = "Copyright 2013, Emperor"
4 | * __credits__ = ["Meg Pirrung", "Yoshiki Vazquez Baeza",
5 | "Antonio Gonzalez Pena", "Jackson Chen"]
6 | * __license__ = "BSD"
7 | * __version__ = "0.9.3-dev"
8 | * __maintainer__ = "Yoshiki Vazquez Baeza"
9 | * __email__ = "yoshiki89@gmail.com"
10 | * __status__ = "Development"
11 | */
12 |
13 | body, html {
14 | font-size: 10px;
15 | height: 100%;
16 | width: 100%;
17 | margin: 0px;
18 | overflow: hidden;
19 | float: left;
20 | }
21 |
22 | /* #small-logo, #overlay, #explanation and #source are all styling elements
23 | * that get in use when WebGL is not enabled and a small help message needs to
24 | * be shown
25 | */
26 | #small-logo {
27 | width: 150px;
28 | height: 45px;
29 | }
30 |
31 | #overlay {
32 | visibility: hidden;
33 | position: absolute;
34 | left: 0px;
35 | top: 0px;
36 | width: 100%;
37 | height: 100%;
38 | font-size: 13px;
39 | text-align: center;
40 | z-index: 1000;
41 | }
42 |
43 | #overlay div {
44 | width: 325px;
45 | margin: 75px auto;
46 | background-color: #fff;
47 | border: 1px solid #000;
48 | padding: 15px;
49 | text-align: center;
50 | }
51 |
52 | #explanation {
53 | text-align: left;
54 | }
55 |
56 | #source {
57 | font-size: 11px;
58 | text-align: left;
59 | }
60 |
61 | /* the plotting area */
62 | div.emperor-plot-wrapper {
63 | position: relative;
64 | overflow: hidden;
65 | height: 100%;
66 | width: 73%;
67 | float: left;
68 | margin: 0;
69 | }
70 |
71 | /* button to select between parallel coordinates and 3D plots */
72 | #emperor-plot-toggle {
73 | z-index: 5;
74 | width: 73%;
75 | margin: 0;
76 | overflow: hidden;
77 | bottom: 0;
78 | position: absolute;
79 | float: left;
80 | }
81 |
82 | /* div.emperor-separator and div.emperor-separator:hover are classes that make
83 | * the separator on the right of the user interface that let's you rescale the
84 | * area of the plot
85 | */
86 | div.emperor-separator {
87 | height: 100%;
88 | width: 1%;
89 | float: left;
90 | cursor: col-resize;
91 | margin: 0;
92 | background-color: #333333;
93 | }
94 |
95 | div.emperor-separator:hover {
96 | background-color:#666666;
97 | }
98 |
99 | /* #emperor-menu and #emperor-menu-tabs the two things that show in the right
100 | * side-bar, #emperor-menu is the container for all the tabs and
101 | * #emperor-menu-tabs is the container for the name of the tabs */
102 | div#emperor-menu {
103 | height: 100%;
104 | font-family: Helvetica, sans-serif;
105 | width: 26%;
106 | overflow: hidden;
107 | float: left;
108 | padding: 0px;
109 | margin: 0;
110 | }
111 |
112 | div#emperor-menu-tabs {
113 | background: #eee;
114 | height: 100%;
115 | margin: 0;
116 | overflow: auto;
117 | }
118 |
119 | /* class used in the divs that contain the widgets for the menu tabs like:
120 | * axes, show by, and all the other tabs in the main interface.
121 | */
122 | .emperor-tab-div{
123 | padding-top: 0px;
124 | padding-bottom: 0px;
125 | height: 100%;
126 | overflow: auto;
127 | align: center; /*align the contents to the center*/
128 | }
129 |
130 | /* tables displayed inside any div of class emperor-tab-div should have the
131 | * following class to keep consistency between the displayed elements
132 | */
133 | .emperor-tab-table {
134 | display: table;
135 | margin-right: auto;
136 | margin-left: auto;
137 | width: 100%;
138 | height: 100%
139 | text-align: left;
140 | }
141 |
142 | /* tables displayed inside any div of class emperor-tab-div that list sliders
143 | * should have the following class that will prevent horizontal scroll bars to
144 | * appear on screen
145 | */
146 | .emperor-tab-table-with-sliders{
147 | display: table;
148 | margin-right: auto;
149 | margin-left: auto;
150 | width: 100%;
151 | height: 100%
152 | text-align: left;
153 |
154 | /* avoid showing horizontal scrollbars when the slider is at 0% or 100% */
155 | padding-right: 10px;
156 | padding-left: 10px;
157 | }
158 |
159 | /* drop-down menus inside the tabs should use as much space as possible but
160 | * never go out of the tab size, this is important because otherwise it breaks
161 | * some of the interface's layout.
162 | */
163 | .emperor-tab-drop-down{
164 | width: 100%;
165 | }
166 |
167 | /* general styling for a variety of elements in emperor */
168 | table {
169 | font-family: Helvetica, sans-serif;
170 | font-size: 12px !important;
171 | }
172 |
173 | form {
174 | margin: 0px;
175 | }
176 |
177 | input {
178 | font-style: 10pt helvetica;
179 | }
180 |
181 | div.colorbox {
182 | border: 1px solid black;
183 | height: 18px;
184 | width: 18px;
185 | }
186 |
187 | div.list{
188 | width: 100%;
189 | height: 85%;
190 | overflow: auto;
191 | }
192 |
193 | div.list ul {
194 | width: 100%;
195 | padding-left: 0px !important;
196 | list-style-type: none;
197 | font-size: 12px !important;
198 | }
199 |
200 | input.button {
201 | height: 2em;
202 | width: 100%;
203 | }
204 |
205 | label {
206 | border: 0;
207 | font: 9pt Helvetica;
208 | }
209 |
210 | label.slidervalue {
211 | float: right;
212 | border: 0;
213 | color: #6cf;
214 | font-weight: bold;
215 | font: 9pt Helvetica;
216 | }
217 |
218 | .ui-tabs .ui-tabs-nav li a{
219 | padding: 2px 5px !important;
220 | }
221 |
222 | /* style for all labels in emperor */
223 | div#label-list {
224 | height: 60%;
225 | }
226 |
227 | div.#labels-top {
228 | height: 30%;
229 | }
230 |
231 | div#labels {
232 | display: none;
233 | font-family: courier;
234 | color: #fff;
235 | height: 0px;
236 | float: left;
237 | position: absolute;
238 | z-index: 1;
239 | }
240 |
241 | div#taxalabels {
242 | display: none;
243 | font-family: courier;
244 | color: #fff;
245 | height: 0px;
246 | float: left;
247 | position: absolute;
248 | z-index: 1;
249 | }
250 |
251 | .axis-labels {
252 | color: #fff;
253 | }
254 |
255 | div#label-color-holder {
256 | width: 100%;
257 | }
258 |
259 | div#label-color-holder div {
260 | float: left;
261 | }
262 |
263 | div#label-color-holder label{
264 | float: left;
265 | width: 50%;
266 | }
267 |
268 | /* arrow that's shown on the plot when you double click a sample */
269 | .arrow-right {
270 | opacity: 0;
271 | position: absolute;
272 | width: 0;
273 | height: 0;
274 | border-top: 5px solid transparent;
275 | border-bottom: 5px solid transparent;
276 | border-left: 10px solid white;
277 | }
278 |
279 | /* the media-button class used in the animations tab */
280 | a.media-button img {
281 | background-color: #eee;
282 | }
283 |
284 | a.media-button:hover img{
285 | background-color: #cff;
286 | }
287 |
288 | /* miscellaneous useful classes */
289 | *.unselectable {
290 | -moz-user-select: -moz-none;
291 | -khtml-user-select: none;
292 | -webkit-user-select: none;
293 |
294 | /*
295 | Introduced in IE 10.
296 | See http://ie.microsoft.com/testdrive/HTML5/msUserSelect/
297 | */
298 | -ms-user-select: none;
299 | user-select: none;
300 | }
301 |
302 | .ontop {
303 | padding: 2px;
304 | font-style: 9pt helvetica;
305 | color: #fff;
306 | border: 1px solid white;
307 | position: absolute;
308 | }
309 |
310 | .invisible {
311 | display: none;
312 | }
313 |
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/emperor/css/emperor.css:
--------------------------------------------------------------------------------
1 | /*
2 | * __author__ = "Meg Pirrung"
3 | * __copyright__ = "Copyright 2013, Emperor"
4 | * __credits__ = ["Meg Pirrung", "Yoshiki Vazquez Baeza",
5 | "Antonio Gonzalez Pena", "Jackson Chen"]
6 | * __license__ = "BSD"
7 | * __version__ = "0.9.3-dev"
8 | * __maintainer__ = "Yoshiki Vazquez Baeza"
9 | * __email__ = "yoshiki89@gmail.com"
10 | * __status__ = "Development"
11 | */
12 |
13 | body, html {
14 | font-size: 10px;
15 | height: 100%;
16 | width: 100%;
17 | margin: 0px;
18 | overflow: hidden;
19 | float: left;
20 | }
21 |
22 | /* #small-logo, #overlay, #explanation and #source are all styling elements
23 | * that get in use when WebGL is not enabled and a small help message needs to
24 | * be shown
25 | */
26 | #small-logo {
27 | width: 150px;
28 | height: 45px;
29 | }
30 |
31 | #overlay {
32 | visibility: hidden;
33 | position: absolute;
34 | left: 0px;
35 | top: 0px;
36 | width: 100%;
37 | height: 100%;
38 | font-size: 13px;
39 | text-align: center;
40 | z-index: 1000;
41 | }
42 |
43 | #overlay div {
44 | width: 325px;
45 | margin: 75px auto;
46 | background-color: #fff;
47 | border: 1px solid #000;
48 | padding: 15px;
49 | text-align: center;
50 | }
51 |
52 | #explanation {
53 | text-align: left;
54 | }
55 |
56 | #source {
57 | font-size: 11px;
58 | text-align: left;
59 | }
60 |
61 | /* the plotting area */
62 | div.emperor-plot-wrapper {
63 | position: relative;
64 | overflow: hidden;
65 | height: 100%;
66 | width: 73%;
67 | float: left;
68 | margin: 0;
69 | }
70 |
71 | /* button to select between parallel coordinates and 3D plots */
72 | #emperor-plot-toggle {
73 | z-index: 5;
74 | width: 73%;
75 | margin: 0;
76 | overflow: hidden;
77 | bottom: 0;
78 | position: absolute;
79 | float: left;
80 | }
81 |
82 | /* div.emperor-separator and div.emperor-separator:hover are classes that make
83 | * the separator on the right of the user interface that let's you rescale the
84 | * area of the plot
85 | */
86 | div.emperor-separator {
87 | height: 100%;
88 | width: 1%;
89 | float: left;
90 | cursor: col-resize;
91 | margin: 0;
92 | background-color: #333333;
93 | }
94 |
95 | div.emperor-separator:hover {
96 | background-color:#666666;
97 | }
98 |
99 | /* #emperor-menu and #emperor-menu-tabs the two things that show in the right
100 | * side-bar, #emperor-menu is the container for all the tabs and
101 | * #emperor-menu-tabs is the container for the name of the tabs */
102 | div#emperor-menu {
103 | height: 100%;
104 | font-family: Helvetica, sans-serif;
105 | width: 26%;
106 | overflow: hidden;
107 | float: left;
108 | padding: 0px;
109 | margin: 0;
110 | }
111 |
112 | div#emperor-menu-tabs {
113 | background: #eee;
114 | height: 100%;
115 | margin: 0;
116 | overflow: auto;
117 | }
118 |
119 | /* class used in the divs that contain the widgets for the menu tabs like:
120 | * axes, show by, and all the other tabs in the main interface.
121 | */
122 | .emperor-tab-div{
123 | padding-top: 0px;
124 | padding-bottom: 0px;
125 | height: 100%;
126 | overflow: auto;
127 | align: center; /*align the contents to the center*/
128 | }
129 |
130 | /* tables displayed inside any div of class emperor-tab-div should have the
131 | * following class to keep consistency between the displayed elements
132 | */
133 | .emperor-tab-table {
134 | display: table;
135 | margin-right: auto;
136 | margin-left: auto;
137 | width: 100%;
138 | height: 100%
139 | text-align: left;
140 | }
141 |
142 | /* tables displayed inside any div of class emperor-tab-div that list sliders
143 | * should have the following class that will prevent horizontal scroll bars to
144 | * appear on screen
145 | */
146 | .emperor-tab-table-with-sliders{
147 | display: table;
148 | margin-right: auto;
149 | margin-left: auto;
150 | width: 100%;
151 | height: 100%
152 | text-align: left;
153 |
154 | /* avoid showing horizontal scrollbars when the slider is at 0% or 100% */
155 | padding-right: 10px;
156 | padding-left: 10px;
157 | }
158 |
159 | /* drop-down menus inside the tabs should use as much space as possible but
160 | * never go out of the tab size, this is important because otherwise it breaks
161 | * some of the interface's layout.
162 | */
163 | .emperor-tab-drop-down{
164 | width: 100%;
165 | }
166 |
167 | /* general styling for a variety of elements in emperor */
168 | table {
169 | font-family: Helvetica, sans-serif;
170 | font-size: 12px !important;
171 | }
172 |
173 | form {
174 | margin: 0px;
175 | }
176 |
177 | input {
178 | font-style: 10pt helvetica;
179 | }
180 |
181 | div.colorbox {
182 | border: 1px solid black;
183 | height: 18px;
184 | width: 18px;
185 | }
186 |
187 | div.list{
188 | width: 100%;
189 | height: 85%;
190 | overflow: auto;
191 | }
192 |
193 | div.list ul {
194 | width: 100%;
195 | padding-left: 0px !important;
196 | list-style-type: none;
197 | font-size: 12px !important;
198 | }
199 |
200 | input.button {
201 | height: 2em;
202 | width: 100%;
203 | }
204 |
205 | label {
206 | border: 0;
207 | font: 9pt Helvetica;
208 | }
209 |
210 | label.slidervalue {
211 | float: right;
212 | border: 0;
213 | color: #6cf;
214 | font-weight: bold;
215 | font: 9pt Helvetica;
216 | }
217 |
218 | .ui-tabs .ui-tabs-nav li a{
219 | padding: 2px 5px !important;
220 | }
221 |
222 | /* style for all labels in emperor */
223 | div#label-list {
224 | height: 60%;
225 | }
226 |
227 | div.#labels-top {
228 | height: 30%;
229 | }
230 |
231 | div#labels {
232 | display: none;
233 | font-family: courier;
234 | color: #fff;
235 | height: 0px;
236 | float: left;
237 | position: absolute;
238 | z-index: 1;
239 | }
240 |
241 | div#taxalabels {
242 | display: none;
243 | font-family: courier;
244 | color: #fff;
245 | height: 0px;
246 | float: left;
247 | position: absolute;
248 | z-index: 1;
249 | }
250 |
251 | .axis-labels {
252 | color: #fff;
253 | }
254 |
255 | div#label-color-holder {
256 | width: 100%;
257 | }
258 |
259 | div#label-color-holder div {
260 | float: left;
261 | }
262 |
263 | div#label-color-holder label{
264 | float: left;
265 | width: 50%;
266 | }
267 |
268 | /* arrow that's shown on the plot when you double click a sample */
269 | .arrow-right {
270 | opacity: 0;
271 | position: absolute;
272 | width: 0;
273 | height: 0;
274 | border-top: 5px solid transparent;
275 | border-bottom: 5px solid transparent;
276 | border-left: 10px solid white;
277 | }
278 |
279 | /* the media-button class used in the animations tab */
280 | a.media-button img {
281 | background-color: #eee;
282 | }
283 |
284 | a.media-button:hover img{
285 | background-color: #cff;
286 | }
287 |
288 | /* miscellaneous useful classes */
289 | *.unselectable {
290 | -moz-user-select: -moz-none;
291 | -khtml-user-select: none;
292 | -webkit-user-select: none;
293 |
294 | /*
295 | Introduced in IE 10.
296 | See http://ie.microsoft.com/testdrive/HTML5/msUserSelect/
297 | */
298 | -ms-user-select: none;
299 | user-select: none;
300 | }
301 |
302 | .ontop {
303 | padding: 2px;
304 | font-style: 9pt helvetica;
305 | color: #fff;
306 | border: 1px solid white;
307 | position: absolute;
308 | }
309 |
310 | .invisible {
311 | display: none;
312 | }
313 |
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/emperor/js/util.js:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * @author Yoshiki Vazquez Baeza
4 | * @copyright Copyright 2013, The Emperor Project
5 | * @credits Yoshiki Vazquez Baeza
6 | * @license BSD
7 | * @version 0.9.51
8 | * @maintainer Yoshiki Vazquez Baeza
9 | * @email yoshiki89@gmail.com
10 | * @status Release
11 | *
12 | */
13 |
14 |
15 | // http://colorbrewer2.org > qualitative > Number of Data Classes = 12
16 | // colorbrewer will provide you with two lists of colors, those have been
17 | // added here
18 | var colorbrewerDiscrete = ["#8dd3c7", "#ffffb3", "#bebada", "#fb8072",
19 | "#80b1d3", "#fdb462", "#b3de69", "#fccde5", "#d9d9d9", "#bc80bd",
20 | "#ccebc5", "#ffed6f", /*first list ends here*/
21 | "#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99", "#e31a1c",
22 | "#fdbf6f", "#ff7f00", "#cab2d6", "#6a3d9a", "#ffff99", "#b15928"];
23 | // taken from the qiime/colors.py module; a total of 24 colors
24 | var qiimeDiscrete = [ "#ff0000", "#0000ff", "#f27304", "#008000", "#91278d",
25 | "#ffff00", "#7cecf4", "#f49ac2", "#5da09e", "#6b440b", "#808080",
26 | "#f79679", "#7da9d8", "#fcc688", "#80c99b", "#a287bf", "#fff899",
27 | "#c49c6b", "#c0c0c0", "#ed008a", "#00b6ff", "#a54700", "#808000",
28 | "#008080"];
29 | var k_DiscreteColorMaps = {"discrete-coloring":colorbrewerDiscrete,
30 | "discrete-coloring-qiime":qiimeDiscrete};
31 |
32 | // these colors are included in chroma and are the only ones we should
33 | // use to interpolate through whe coloring in a continuous mode
34 | var k_CHROMABREWER_MAPS = ['discrete-coloring-qiime', 'discrete-coloring',
35 | 'OrRd', 'PuBu', 'BuPu', 'Oranges', 'BuGn', 'YlOrBr', 'YlGn', 'Reds',
36 | 'RdPu', 'Greens', 'YlGnBu', 'Purples', 'GnBu', 'Greys', 'YlOrRd', 'PuRd',
37 | 'Blues', 'PuBuGn', 'Spectral', 'RdYlGn', 'RdBu', 'PiYG', 'PRGn', 'RdYlBu',
38 | 'BrBG', 'RdGy', 'PuOr'];
39 | var k_CHROMABREWER_MAPNAMES = ['Classic QIIME Colors',
40 | 'Discrete Coloring (Colorbrewer)', 'Orange-Red', 'Purple-Blue',
41 | 'Blue-Purple', 'Oranges', 'Blue-Green', 'Yellow-Orange-Brown',
42 | 'Yellow-Green', 'Reds', 'Red-Purple', 'Greens', 'Yellow-Green-Blue',
43 | 'Purples', 'Green-Blue', 'Greys', 'Yellow-Orange-Red', 'Purple-Red',
44 | 'Blues', 'Purple-Blue-Green', 'Spectral', 'Red-Yellow-Green', 'Red-Blue',
45 | 'Pink-Yellow-Green', 'Pink-Red-Green', 'Red-Yellow-Blue',
46 | 'Brown-Blue-Green', 'Red-Grey', 'Purple-Orange'];
47 |
48 | /**
49 | *
50 | * Sorting function that deals with alpha and numeric elements
51 | *
52 | * This function takes a list of strings, divides it into two new lists, one
53 | * that's alpha-only and one that's numeric only.
54 | *
55 | * @param {list} an Array of strings.
56 | *
57 | * @return a sorted Array where all alpha elements at the beginning & all
58 | * numeric elements at the end.
59 | *
60 | */
61 | function naturalSort(list){
62 | var numericPart = [], alphaPart = [], result = [];
63 |
64 | // separate the numeric and the alpha elements of the array
65 | for(var index = 0; index < list.length; index++){
66 | if(isNaN(parseFloat(list[index]))){
67 | alphaPart.push(list[index])
68 | }
69 | else{
70 | numericPart.push(list[index])
71 | }
72 | }
73 |
74 | // ignore casing of the strings, taken from:
75 | // http://stackoverflow.com/a/9645447/379593
76 | alphaPart.sort(function (a, b) {
77 | return a.toLowerCase().localeCompare(b.toLowerCase());
78 | });
79 |
80 | // sort in ascending order
81 | numericPart.sort(function(a,b){return parseFloat(a)-parseFloat(b)})
82 |
83 | return result.concat(alphaPart, numericPart);
84 | }
85 |
86 | /**
87 | *
88 | * Utility function to convert an XML DOM documents to a string useful for unit
89 | * testing
90 | *
91 | * @param {node} XML DOM object, usually as created by the document object.
92 | *
93 | * @return string representation of the node object.
94 | *
95 | * This code is based on this answer http://stackoverflow.com/a/1750890
96 | *
97 | */
98 | function convertXMLToString(node) {
99 | if (typeof(XMLSerializer) !== 'undefined') {
100 | var serializer = new XMLSerializer();
101 | return serializer.serializeToString(node);
102 | }
103 | else if (node.xml) {
104 | return node.xml;
105 | }
106 | }
107 |
108 | /**
109 | *
110 | * Retrieve a discrete color.
111 | *
112 | * @param {index} int, the index of the color to retrieve.
113 | * @param {map} string, name of the discrete color map to use.
114 | *
115 | * @return string representation of the hexadecimal value for a color in the
116 | * list the QIIME colors or the ColorBrewer discrete colors. If this value
117 | * value is greater than the number of colors available, the function will just
118 | * rollover and retrieve the next available color.
119 | *
120 | * Defaults to use ColorBrewer colors if there's no map passed in.
121 | *
122 | */
123 | function getDiscreteColor(index, map){
124 | if (map === undefined){
125 | map = 'discrete-coloring';
126 | }
127 | if (_.has(k_DiscreteColorMaps, map) === false){
128 | throw new Error("Could not find "+map+" as a discrete colormap.")
129 | }
130 |
131 | var size = k_DiscreteColorMaps[map].length;
132 | if(index >= size){
133 | index = index - (Math.floor(index/size)*size)
134 | }
135 |
136 | return k_DiscreteColorMaps[map][index]
137 | }
138 |
139 |
140 | /**
141 | *
142 | * Generate a list of colors that corresponds to all the samples in the plot
143 | *
144 | * @param {values} list of objects to generate a color for, usually a category
145 | * in a given metadata column.
146 | * @param {map} name of the color map to use, see k_CHROMABREWER_MAPS.
147 | *
148 | *
149 | * This function will generate a list of coloring values depending on the
150 | * coloring scheme that the system is currently using (discrete or continuous).
151 | */
152 | function getColorList(values, map) {
153 | var colors = {}, numColors = values.length-1, counter=0, interpolator,
154 | discrete = false;
155 |
156 | if (k_CHROMABREWER_MAPS.indexOf(map) === -1) {
157 | throw new Error("Could not find "+map+" in the available colormaps");
158 | }
159 |
160 | if (map === 'discrete-coloring' || map === 'discrete-coloring-qiime'){
161 | discrete = true;
162 | }
163 |
164 | // 1 color and continuous coloring should return the first element of the map
165 | if (numColors === 0 && discrete === false){
166 | colors[values[0]] = chroma.brewer[map][0];
167 | return colors;
168 | }
169 |
170 | if (discrete === false){
171 | map = chroma.brewer[map];
172 | interpolator = chroma.interpolate.bezier([map[0], map[3], map[4], map[5],
173 | map[8]]);
174 | }
175 |
176 | for(var index in values){
177 | if(discrete){
178 | // get the next available color
179 | colors[values[index]] = getDiscreteColor(index, map);
180 | }
181 | else{
182 | colors[values[index]] = interpolator(counter/numColors).hex();
183 | counter = counter + 1;
184 | }
185 | }
186 |
187 | return colors;
188 | }
189 |
190 |
191 | /**
192 | *
193 | * Escape special characters in a string for use in a regular expression.
194 | *
195 | * @param {regex} string to escape for use in a regular expression.
196 | *
197 | * @return string with escaped characters for use in a regular expression.
198 | *
199 | * Credits go to this SO answer http://stackoverflow.com/a/5306111
200 | */
201 | function escapeRegularExpression(regex){
202 | return regex.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
203 | }
204 |
205 | /**
206 | *
207 | * Clean a string in HTML formatted strings that get created with the namespace
208 | * tag in some browsers and not in others. Intended to facilitate testing.
209 | *
210 | * @param {htmlString} string to remove namespace from.
211 | *
212 | * @return string without namespace.
213 | *
214 | */
215 | function cleanHTML(htmlString){
216 | return htmlString.replace(' xmlns="http://www.w3.org/1999/xhtml"', '')
217 | }
218 |
219 |
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/weighted_unifrac_emperor_pcoa_plot/emperor_required_resources/emperor/js/util.js:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * @author Yoshiki Vazquez Baeza
4 | * @copyright Copyright 2013, The Emperor Project
5 | * @credits Yoshiki Vazquez Baeza
6 | * @license BSD
7 | * @version 0.9.51
8 | * @maintainer Yoshiki Vazquez Baeza
9 | * @email yoshiki89@gmail.com
10 | * @status Release
11 | *
12 | */
13 |
14 |
15 | // http://colorbrewer2.org > qualitative > Number of Data Classes = 12
16 | // colorbrewer will provide you with two lists of colors, those have been
17 | // added here
18 | var colorbrewerDiscrete = ["#8dd3c7", "#ffffb3", "#bebada", "#fb8072",
19 | "#80b1d3", "#fdb462", "#b3de69", "#fccde5", "#d9d9d9", "#bc80bd",
20 | "#ccebc5", "#ffed6f", /*first list ends here*/
21 | "#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99", "#e31a1c",
22 | "#fdbf6f", "#ff7f00", "#cab2d6", "#6a3d9a", "#ffff99", "#b15928"];
23 | // taken from the qiime/colors.py module; a total of 24 colors
24 | var qiimeDiscrete = [ "#ff0000", "#0000ff", "#f27304", "#008000", "#91278d",
25 | "#ffff00", "#7cecf4", "#f49ac2", "#5da09e", "#6b440b", "#808080",
26 | "#f79679", "#7da9d8", "#fcc688", "#80c99b", "#a287bf", "#fff899",
27 | "#c49c6b", "#c0c0c0", "#ed008a", "#00b6ff", "#a54700", "#808000",
28 | "#008080"];
29 | var k_DiscreteColorMaps = {"discrete-coloring":colorbrewerDiscrete,
30 | "discrete-coloring-qiime":qiimeDiscrete};
31 |
32 | // these colors are included in chroma and are the only ones we should
33 | // use to interpolate through whe coloring in a continuous mode
34 | var k_CHROMABREWER_MAPS = ['discrete-coloring-qiime', 'discrete-coloring',
35 | 'OrRd', 'PuBu', 'BuPu', 'Oranges', 'BuGn', 'YlOrBr', 'YlGn', 'Reds',
36 | 'RdPu', 'Greens', 'YlGnBu', 'Purples', 'GnBu', 'Greys', 'YlOrRd', 'PuRd',
37 | 'Blues', 'PuBuGn', 'Spectral', 'RdYlGn', 'RdBu', 'PiYG', 'PRGn', 'RdYlBu',
38 | 'BrBG', 'RdGy', 'PuOr'];
39 | var k_CHROMABREWER_MAPNAMES = ['Classic QIIME Colors',
40 | 'Discrete Coloring (Colorbrewer)', 'Orange-Red', 'Purple-Blue',
41 | 'Blue-Purple', 'Oranges', 'Blue-Green', 'Yellow-Orange-Brown',
42 | 'Yellow-Green', 'Reds', 'Red-Purple', 'Greens', 'Yellow-Green-Blue',
43 | 'Purples', 'Green-Blue', 'Greys', 'Yellow-Orange-Red', 'Purple-Red',
44 | 'Blues', 'Purple-Blue-Green', 'Spectral', 'Red-Yellow-Green', 'Red-Blue',
45 | 'Pink-Yellow-Green', 'Pink-Red-Green', 'Red-Yellow-Blue',
46 | 'Brown-Blue-Green', 'Red-Grey', 'Purple-Orange'];
47 |
48 | /**
49 | *
50 | * Sorting function that deals with alpha and numeric elements
51 | *
52 | * This function takes a list of strings, divides it into two new lists, one
53 | * that's alpha-only and one that's numeric only.
54 | *
55 | * @param {list} an Array of strings.
56 | *
57 | * @return a sorted Array where all alpha elements at the beginning & all
58 | * numeric elements at the end.
59 | *
60 | */
61 | function naturalSort(list){
62 | var numericPart = [], alphaPart = [], result = [];
63 |
64 | // separate the numeric and the alpha elements of the array
65 | for(var index = 0; index < list.length; index++){
66 | if(isNaN(parseFloat(list[index]))){
67 | alphaPart.push(list[index])
68 | }
69 | else{
70 | numericPart.push(list[index])
71 | }
72 | }
73 |
74 | // ignore casing of the strings, taken from:
75 | // http://stackoverflow.com/a/9645447/379593
76 | alphaPart.sort(function (a, b) {
77 | return a.toLowerCase().localeCompare(b.toLowerCase());
78 | });
79 |
80 | // sort in ascending order
81 | numericPart.sort(function(a,b){return parseFloat(a)-parseFloat(b)})
82 |
83 | return result.concat(alphaPart, numericPart);
84 | }
85 |
86 | /**
87 | *
88 | * Utility function to convert an XML DOM documents to a string useful for unit
89 | * testing
90 | *
91 | * @param {node} XML DOM object, usually as created by the document object.
92 | *
93 | * @return string representation of the node object.
94 | *
95 | * This code is based on this answer http://stackoverflow.com/a/1750890
96 | *
97 | */
98 | function convertXMLToString(node) {
99 | if (typeof(XMLSerializer) !== 'undefined') {
100 | var serializer = new XMLSerializer();
101 | return serializer.serializeToString(node);
102 | }
103 | else if (node.xml) {
104 | return node.xml;
105 | }
106 | }
107 |
108 | /**
109 | *
110 | * Retrieve a discrete color.
111 | *
112 | * @param {index} int, the index of the color to retrieve.
113 | * @param {map} string, name of the discrete color map to use.
114 | *
115 | * @return string representation of the hexadecimal value for a color in the
116 | * list the QIIME colors or the ColorBrewer discrete colors. If this value
117 | * value is greater than the number of colors available, the function will just
118 | * rollover and retrieve the next available color.
119 | *
120 | * Defaults to use ColorBrewer colors if there's no map passed in.
121 | *
122 | */
123 | function getDiscreteColor(index, map){
124 | if (map === undefined){
125 | map = 'discrete-coloring';
126 | }
127 | if (_.has(k_DiscreteColorMaps, map) === false){
128 | throw new Error("Could not find "+map+" as a discrete colormap.")
129 | }
130 |
131 | var size = k_DiscreteColorMaps[map].length;
132 | if(index >= size){
133 | index = index - (Math.floor(index/size)*size)
134 | }
135 |
136 | return k_DiscreteColorMaps[map][index]
137 | }
138 |
139 |
140 | /**
141 | *
142 | * Generate a list of colors that corresponds to all the samples in the plot
143 | *
144 | * @param {values} list of objects to generate a color for, usually a category
145 | * in a given metadata column.
146 | * @param {map} name of the color map to use, see k_CHROMABREWER_MAPS.
147 | *
148 | *
149 | * This function will generate a list of coloring values depending on the
150 | * coloring scheme that the system is currently using (discrete or continuous).
151 | */
152 | function getColorList(values, map) {
153 | var colors = {}, numColors = values.length-1, counter=0, interpolator,
154 | discrete = false;
155 |
156 | if (k_CHROMABREWER_MAPS.indexOf(map) === -1) {
157 | throw new Error("Could not find "+map+" in the available colormaps");
158 | }
159 |
160 | if (map === 'discrete-coloring' || map === 'discrete-coloring-qiime'){
161 | discrete = true;
162 | }
163 |
164 | // 1 color and continuous coloring should return the first element of the map
165 | if (numColors === 0 && discrete === false){
166 | colors[values[0]] = chroma.brewer[map][0];
167 | return colors;
168 | }
169 |
170 | if (discrete === false){
171 | map = chroma.brewer[map];
172 | interpolator = chroma.interpolate.bezier([map[0], map[3], map[4], map[5],
173 | map[8]]);
174 | }
175 |
176 | for(var index in values){
177 | if(discrete){
178 | // get the next available color
179 | colors[values[index]] = getDiscreteColor(index, map);
180 | }
181 | else{
182 | colors[values[index]] = interpolator(counter/numColors).hex();
183 | counter = counter + 1;
184 | }
185 | }
186 |
187 | return colors;
188 | }
189 |
190 |
191 | /**
192 | *
193 | * Escape special characters in a string for use in a regular expression.
194 | *
195 | * @param {regex} string to escape for use in a regular expression.
196 | *
197 | * @return string with escaped characters for use in a regular expression.
198 | *
199 | * Credits go to this SO answer http://stackoverflow.com/a/5306111
200 | */
201 | function escapeRegularExpression(regex){
202 | return regex.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
203 | }
204 |
205 | /**
206 | *
207 | * Clean a string in HTML formatted strings that get created with the namespace
208 | * tag in some browsers and not in others. Intended to facilitate testing.
209 | *
210 | * @param {htmlString} string to remove namespace from.
211 | *
212 | * @return string without namespace.
213 | *
214 | */
215 | function cleanHTML(htmlString){
216 | return htmlString.replace(' xmlns="http://www.w3.org/1999/xhtml"', '')
217 | }
218 |
219 |
--------------------------------------------------------------------------------
/examples/corediv/taxa_plots/taxa_summary_plots/css/qiime_style.css:
--------------------------------------------------------------------------------
1 | a.header:link { color: black; font-family:Arial,Verdana; font-size:11; font-weight: bold;}
2 | a.header:visited { color: black; font-family:Arial,Verdana; font-size:11; font-weight:bold;}
3 | a.header:hover { color: black; font-family:Arial,Verdana; font-size:11; font-weight:bold;}
4 | a.header:active { color: black; font-family:Arial,Verdana; font-size:11; font-weight:bold;}
5 |
6 | a:link { color: blue;}
7 | a:visited { color: blue;}
8 | a:hover { color: blue;}
9 | a:active { color: blue; }
10 |
11 |
12 |
13 |
14 | a.text_tree:link { color: black; font-family:"Courier New", Courier, monospace; font-size:10px; font-weight: bold; text-decoration: none}
15 | a.text_tree:visited { color: black; font-family:"Courier New", Courier, monospace; font-size:10px; font-weight: bold; text-decoration: none}
16 |
17 | a.tree_scale:link { color: red; font-family:"Courier New", Courier, monospace; font-size:10px; font-weight: bold; text-decoration: none; background-color: white;}
18 | a.tree_scale:visited { color: red; font-family:"Courier New", Courier, monospace; font-size:10px; font-weight: bold; text-decoration: none; background-color: white;}
19 | a.tree_scale:hover { color: white; font-family:"Courier New", Courier, monospace; font-size:10px; font-weight: bold; text-decoration: none; background-color: red;}
20 |
21 | td.header-attn { background-color: yellow; border: 1px solid #DDDDDD; color: black; font-family:Arial, Verdana; font-size:11; font-weight:bold;}
22 |
23 | td.header-last { background-color: #fdfdf4; border: 1px solid #DDDDDD; color: black; font-family:Arial, Verdana; font-size:11; font-weight:bold;}
24 | td.header1 { background-color: #e4f7fd; border: 1px solid #DDDDDD; color: black; font-family:Arial, Verdana; font-size:11; font-weight:bold;}
25 | td.header2 { background-color: #e4fdf8; border: 1px solid #cccccc; color: black; font-family:Arial, Verdana; font-size:11; font-weight:bold;}
26 | td.header3 { background-color: #e4fdf5; border: 1px solid #cccccc; color: black; font-family:Arial, Verdana; font-size:11; font-weight:bold;}
27 | td.header4 { background-color: #e4e8fd; border: 1px solid #cccccc; color: black; font-family:Arial, Verdana; font-size:11; font-weight:bold;}
28 | td.header5 { background-color: #f5f7ef; border: 1px solid #DDDDDD; color: black; font-family:Arial, Verdana; font-size:11; font-weight:bold;}
29 | td.header { background-color: #eff4f7; border: 1px solid #DDDDDD; color: black; font-family:Arial, Verdana; font-size:10; font-weight:bold;}
30 | td.normal { text-align:center;border-width:medium;border-style:solid;border: 1px solid #DDDDDD; color: black; font-family:Arial, Verdana; font-size:9; font-weight:bold;}
31 |
32 | td.nav_sel { background-color: red; border: 1px solid #DDDDDD; color: white; font-family:Arial, Verdana; font-size:11; font-weight:bold;}
33 | td.nav_grey { background-color: eeeeee; border: 1px solid #DDDDDD; color: red; font-family:Arial, Verdana; font-size:11; font-weight:bold;}
34 | td.nav_other { background-color: white; border: 1px solid #DDDDDD; color: red; font-family:Arial, Verdana; font-size:11; font-weight:bold;}
35 |
36 | td.nav_tax_sel { background-color: red; border: 1px solid #DDDDDD; color: white; font-family:Arial, Verdana; font-size:10; font-weight:bold; font-style: italic;}
37 | td.nav_tax_grey { background-color: eeeeee; border: 1px solid #DDDDDD; color: red; font-family:Arial, Verdana; font-size:10; font-weight:bold; font-style: italic;}
38 | td.nav_tax_other { background-color: white; border: 1px solid #DDDDDD; color: red; font-family:Arial, Verdana; font-size:10; font-weight:bold; font-style: italic;}
39 |
40 | a.nav:link { color: red; font-family:Arial,Verdana; font-size:11; font-weight: bold;}
41 | a.nav:visited { color: red; font-family:Arial,Verdana; font-size:11; font-weight:bold;}
42 | a.nav:hover { color: red; font-family:Arial,Verdana; font-size:11; font-weight:bold;}
43 | a.nav:active { color: red; font-family:Arial,Verdana; font-size:11; font-weight:bold;}
44 |
45 | a.nav_tax:link { color: black; font-family:Arial,Verdana; font-size:10; font-weight: bold; font-style: italic;}
46 | a.nav_tax:visited { color: black; font-family:Arial,Verdana; font-size:10; font-weight:bold; font-style: italic;}
47 | a.nav_tax:hover { color: black; font-family:Arial,Verdana; font-size:10; font-weight:bold; font-style: italic;}
48 | a.nav_tax:active { color: black; font-family:Arial,Verdana; font-size:10; font-weight:bold; font-style: italic;}
49 |
50 |
51 |
52 | td.smheader-last { background-color: #fdfdf4; border: 1px solid #DDDDDD; color: black; font-family:Arial, Verdana; font-size:7; font-weight:bold;}
53 | td.smheader { background-color: #eff4f7; border: 1px solid #DDDDDD; color: black; font-family:Arial, Verdana; font-size:7; font-weight:bold;}
54 | td.smbheader-last { background-color: #fdfdf4; border: 1px solid #DDDDDD; color: black; font-family:Arial, Verdana; font-size:9; font-weight:bold;}
55 | td.smbheader { background-color: #eff4f7; border: 1px solid #DDDDDD; color: black; font-family:Arial, Verdana; font-size:9; font-weight:bold;}
56 | td.smcolor { background-color: #fcfde6; border: 0px solid #DDDDDD; color: black; font-family:Arial,Verdana; font-size:7; text-align: center; }
57 | .smnorm { color: black; font-family:Arial,Verdana; font-size:6;}
58 | .bsmnorm { color: black; font-family:Arial,Verdana; font-size:6; background-color: #00ffff}
59 |
60 | .csmnorm { color: black; font-family:Arial,Verdana; font-size:6; text-align: center; }
61 | .cbsmnorm { color: black; font-family:Arial,Verdana; font-size:6; background-color: #00ffff; text-align: center;}
62 |
63 | .smh_norm { color: black; font-family:Arial,Verdana; font-size:7;}
64 | .smhotu_norm { color: black; font-family:Arial,Verdana; font-size:6;}
65 |
66 | .smv_header-last { background-color: #fdfdf4; border: 1px solid #DDDDDD; color: black; font-family:Arial, Verdana; font-size:9; font-weight:bold;}
67 | .smv_header { background-color: #eff4f7; border: 1px solid #DDDDDD; color: black; font-family:Arial, Verdana; font-size:9; font-weight:bold;}
68 |
69 | .smv_norm { color: black; font-family:Arial,Verdana; font-size:9; text-align: center;}
70 | .smvn_norm { color: black; font-family:Arial,Verdana; font-size:9; }
71 |
72 | td.sm_lm_header-last { background-color: #fdfdf4; border: 1px solid #DDDDDD; color: black; font-family:Arial, Verdana; font-size:8; font-weight:bold;}
73 | td.sm_lm_header { background-color: #eff4f7; border: 1px solid #DDDDDD; color: black; font-family:Arial, Verdana; font-size:8; font-weight:bold;}
74 | .sm_lm_norm { color: black; font-family:Arial,Verdana; font-size:6;}
75 | .sm_lmh_norm { color: black; font-family:Arial,Verdana; font-size:9;}
76 | .smcnorm { color: black; font-family:Arial,Verdana; font-size:7; text-align: center;}
77 |
78 | .treeticks { font-family: "Courier New", Courier, monospace; font-size: 8; font-weight: bold;}
79 | .tree { color: black; font-family: "Courier New", Courier, monospace; font-size: 8px; }
80 |
81 | td.solidheader { background-color: #FFF200; border: 1px solid #FFF200; color: black; font-family:Arial, Verdana; font-size:11; font-weight:bold;}
82 | .cheader { background-color: #FFFDC9; border: 1px solid #FFF200; color: black; font-family:Arial, Verdana; font-size:11; font-weight:bold;}
83 |
84 | td.section {background-color: #dfe0c0; border: 1px solid #999999; color: black; font-family:Arial, Verdana; font-size:14; font-weight:bold;}
85 |
86 | .normal { color: black; font-family:Arial,Verdana; font-size:11; font-weight:normal;}
87 | .normal_red { color: red; font-family:Arial,Verdana; font-size:11; font-weight:normal;}
88 | .copy { color: red; font-family:Arial,Verdana; font-size:11; font-weight:bold; font-style: italic;}
89 |
90 | .sm_bnorm { color: black; font-family:Arial,Verdana; font-size:10; font-weight:bold;}
91 | .ntitle { color: black; font-family:Arial,Verdana; font-size:11; font-weight:bold;}
92 | .ntotal { color: black; font-family:Arial,Verdana; font-size:11; font-weight:bold; font-style: italic;}
93 | .tiny { background-color: #eeeeee; font-family: "Courier New", Courier, monospace; font-size: 10px; font-weight: bold; text-align: center;}
94 | .tinyh { font-family: "Courier New", Courier, monospace; font-size: 10px; font-weight: bold; text-align: center}
95 | .tinyt { font-family: "Arial"; font-size: 8px; font-weight: bold; text-align: left}
96 | .tinytc { font-family: "Arial"; font-size: 8px; font-weight: bold; text-align: center; width: 20px}
97 |
98 | .smh_key_norm { color: black; font-family:Arial,Verdana; font-size:10;}
99 |
--------------------------------------------------------------------------------
/bin/mwas_analysis.R:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env Rscript
2 | ## Command line function calling all testing, model training, model testing and visualization
3 | #
4 | # Contributor: Hu
5 | # ------
6 | # input:
7 | #
8 | # 1. w - mode - "learn", "predict", "plot", "statistics"
9 | # 2. i - OTU table - BIOM or classic format (required)
10 | # 3. m - map file (required)
11 | # 4. c - category name(s) (required)
12 | # 5. o - output directory: save classification model, model evaluation results, visualization file etc. [default: "."]
13 | # 6. M - method: classifier type for "learn", trained classifier model file name for "predict",
14 | # plot type for "plot", statistical test type for "statistics"
15 | #
16 | # 7. t - transformation type [default: none]
17 | # 8. r - suppress conversion of relative abundance from absolute abunance [default: FALSE]
18 | # 9. p - minimum prevalence of OTU to keep [default: 0.01 %]
19 | # 10. b - whether collapse the table by correlation [default: FALSE]
20 | #
21 | # 11. C - classifier parameters- kernel function only for SVM classification method
22 | # 12. v - Feature selection methods: 'FDR' or 'RF' [default: FDR]
23 | # 13. n - number of folds in cross-validation [default: 10]
24 | # 14. f - Whether to do feature selection option [default: FALSE]
25 | # 15. s - feature selection parameter [default: 0]
26 | # (options are capital)
27 | # 16. F - feature statistics table file from differentiated test
28 | # 17. P - PCoA matrix file
29 | # 18. D - distance matrix file
30 | # 19. T - which taxa to plot
31 | # 20. S - whether shorten taxon names [default: FALSE]
32 | # 21. A - False discovery rate, alpha [default: NULL]
33 | # 22. X - whether plot pair-wise PC plots [default: FALSE]
34 | # 23. K - For heatmap plot, whether filter kegg list [default: FALSE]
35 | # 24. N - the number of plots for beeswarm and scatter plots [default: NULL]
36 | #
37 | # 25. a - statistical options
38 | #
39 | # ----
40 | # Last update: 02/05/2015
41 | #
42 |
43 | # Source files
44 |
45 | file.sources = list.files("lib", pattern="*.R$",
46 | #file.sources = list.files(paste(Sys.getenv('MWAS_DIR'),'/lib',sep=''), pattern="*.R$",
47 | full.names=TRUE, ignore.case=TRUE)
48 | invisible(sapply(file.sources, source, .GlobalEnv))
49 |
50 | ####################### Parse INPUT options #####
51 | if (!require("optparse", quietly=TRUE, warn.conflicts = FALSE)) {
52 | install.packages("optparse", dependencies = TRUE)
53 | library("optparse", verbose=F, warn.conflicts =F)
54 | }
55 | #require(optparse, quietly=TRUE, warn.conflicts=FALSE)
56 | # make option list and parse command line
57 | option_list <- list(
58 | make_option(c("-w", "--mode"),type='character',
59 | help="Function mode [required]"),
60 | # preprocessing parameters
61 | make_option(c("-t", "--transform_type"), type="character", default="none",
62 | help="Relative abundance transform type (none, asin_sqrt, or norm_asin_sqrt) [default: norm_asin_sqrt]"),
63 | make_option(c("-r", "--suppress_relative_abundance_conversion"),action='store_false',default=TRUE,
64 | help="Do not convert input to relative abundances (assumes already relative abundances). [default: %default]"),
65 | make_option(c("-p","--min_prevalence"), type="numeric",default=0.0,
66 | help="Minimum fraction of samples in which taxon must be present to be included [default: %default]."),
67 | make_option(c("-b","--collapse_table"), type="logical", action='store_true', default=FALSE,
68 | help="Collapse otu table by correlation."),
69 | # universal paramters
70 | make_option(c("-i","--input_fp"), type="character",
71 | help="BIOM format or classic format of OTU table or other matrix [requried]"),
72 | make_option(c("-m","--map_fp"), type="character",
73 | help="Mapping file [required]."),
74 | make_option(c("-c","--category"), type="character",
75 | help="Column name in the mapping file [requried]"),
76 | make_option(c("-o", "--outdir"),type='character',default=".",
77 | help="Output directory [default: %default]"),
78 | make_option(c("-M", "--method"),type='character',
79 | help="Classifier type [required for model training] or trained model file [required for predicting]
80 | or plot type [required for plotting]."),
81 | # classification parameters
82 | make_option(c("-C", "--method_param"),type='character',default="linear",
83 | help="For training: classifier parameter, e.g. SVM kernel type [default: %default]."),
84 | make_option(c("-v", "--ftMethod"),type='character',default="fdr",
85 | help="Feature selection method:'fdr' for false discovery rate, or 'rf' for randomForest variable importance ranking [default: %default]"),
86 | make_option(c("-n", "--nfolds"),type='numeric',default=5,
87 | help="Number of folds in cross-validation [default: %default]"),
88 | make_option(c("-f", "--is_feat"),type="logical", action="store_true", default=FALSE,
89 | help="Flag for feature selection [default: %default]"),
90 | make_option(c("-s", "--feat_param"),type='numeric',default=0.0,
91 | help="Parameter for feature selection [default: %default].
92 | For plotting options, it specifies the directory of feature statistics file."),
93 | # plot parameters
94 | make_option(c("-F","--feat_stats_fp"), type="character",default=NULL,
95 | help="Feature statistics table file from differentiated test."),
96 | make_option(c("-D","--distance_fp"), type="character",default=NULL,
97 | help="QIIME-formatted distance table file (optional). If omitted, the script uses Bray-Curtis distance."),
98 | make_option(c("-P","--pcoa_fp"), type="character",default=NULL,
99 | help="QIIME-formatted pcoa table file (optional). If omitted, the script uses Bray-Curtis distance. If included, takes priority over --distance_fp."),
100 | make_option(c("-T", "--which_taxa"), type="character", default=NULL,
101 | help="Comma-separated list of taxa to plot [default: plot top --nplot taxa]"),
102 | make_option(c("-S", "--shorten_taxa"),type="logical", action='store_true',default=FALSE,
103 | help="Shorten taxonomy names to lowest defined level. [default: %default]"),
104 | make_option(c("-X", "--multiple_axes"),type="logical", action='store_true',default=FALSE,
105 | help="Show PC1 v PC2, PC1 v PC3, PC2 v PC3 in 3 separate plots. [default: %default]"),
106 | make_option(c("-A","--fdr"), type='numeric', default=NULL,
107 | help='Maximum false discovery rate to report. Ignored if --which_taxa exists [default: %default]'),
108 | make_option(c("-K","--filter_kegg"), type="logical", action='store_true', default=FALSE,
109 | help='Whether filter kegg list'),
110 | make_option(c("-N", "--nplot"), type="numeric", default=NULL,
111 | help="Number of taxa to plot (in order of decreasing significance). Ignored if --which_taxa exists [default: %default]"),
112 | make_option(c("-O","--category_order"), type="character", default=NULL,
113 | help="Optional ordering of categories (comma-separated) [default alphabetical]."),
114 | # Statistical test parameters
115 | make_option(c("-a", "--statistcs"),type='character',default="linear",
116 | help="Statistical testing options [default: %default]")
117 | )
118 |
119 | opts <- parse_args(OptionParser(option_list=option_list),
120 | args=commandArgs(trailing=TRUE))
121 |
122 | # create output directory if needed
123 | if(opts$outdir != ".") dir.create(opts$outdir,showWarnings=FALSE, recursive=TRUE)
124 |
125 | ######################## Mode selection #######
126 | # Four available modes:
127 | # 1. learn
128 | # 2. predict
129 | # 3. plot
130 | # 4. statistics
131 |
132 | case_mode <- tolower(opts$mode) # case insensitive
133 |
134 | switch(case_mode,
135 | learn = { mwas.obj <- import.train.params(opts)
136 | best_model <- train.mwas(mwas.obj)
137 | #print("Training is finished!")
138 | },
139 | predict = { mwas.obj <- import.predict.params(opts)
140 | results <- model.evaluation.mwas(mwas.obj)
141 | export.mwas(model.eval=results, out.dir=opts$outdir, file.name="prediction_results")
142 | #print("Prediction is finished!")
143 | },
144 | plot = { mwas.obj <- import.plot.params(opts)
145 | plot(mwas.obj)
146 | #print("Visualization")
147 | },
148 | statistics = { mwas.obj <- import.stats.params(opts)
149 | statistical.test.mwas(mwas.obj)
150 | #print("statistics")
151 | },
152 | stop("Please specify a function mode: learn, predict, plot, statistics.")
153 | )
154 |
--------------------------------------------------------------------------------
/bin/util/plot-differentiated-taxa.r:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env Rscript
2 | # Usage: run non-parametric test for differentiation according to metadata:
3 | #
4 | # run with Rscript make-beeswarm-plots.r -i taxontable -m map.txt -c column_name -o outdir
5 | #
6 | # Usage: plot specific taxa (must match row name exactly from taxontable)
7 | # run with Rscript make-beeswarm-plots.r -i taxontable -w 'Bacteroides,Prevotella' -o outdir
8 |
9 | # REQUIRED GLOBAL VARIABLES: PLEASE EDIT
10 | #source(paste(Sys.getenv('MWAS_DIR'),'/lib/gradients.r',sep=''))
11 | #source(paste(Sys.getenv('MWAS_DIR'),'/lib/util.r',sep=''))
12 | #source(paste(Sys.getenv('MWAS_DIR'),'/lib/stats.r',sep=''))
13 | #source(paste(Sys.getenv('MWAS_DIR'),'/lib/visualization.R',sep=''))
14 |
15 | require('RColorBrewer')
16 | require('optparse')
17 | require('vegan')
18 |
19 | # make option list and parse command line
20 | option_list <- list(
21 | make_option(c("-i","--input_fp"), type="character",
22 | help="QIIME-formatted input taxon, OTU, or feature table (see --input_type) (tab-delimited text, not biom) [required]."),
23 | make_option(c("-I","--input_format"), type="character", default='Taxon table',
24 | help="Format of classic QIIME-formatted input table: \"Taxon table\" or \"OTU table\" [default: %default]."),
25 | make_option(c("-m","--map_fp"), type="character",default=NULL,
26 | help="QIIME-formatted mapping file (optional). If provided, only samples in both taxon table and mapping file will be plotted."),
27 | make_option(c("-c","--column"), type="character",default=NULL,
28 | help="Name of metadata column to color plot by (optional). If included, does not plot gradients."),
29 | make_option(c("-M","--min_prevalence"), type="numeric",default=.1,
30 | help="Minimum fraction of samples in which taxon must be present to be included [default: %default]."),
31 | make_option(c("-w", "--which_taxa"), type="character", default=NULL,
32 | help="Comma-separated list of taxa to plot [default: plot top --nplot taxa]"),
33 | make_option(c("-t", "--transform_type"), type="character", default="norm-asin-sqrt",
34 | help="Relative abundance transform type (none, asin-sqrt, or norm-asin-sqrt) [default: norm-asin-sqrt]"),
35 | make_option(c("-X", "--x_axis_label"), type="character", default="",
36 | help="Label for x axis [default: blank]"),
37 | make_option(c("-s", "--shorten_taxa"),action='store_true',default=FALSE,
38 | help="Shorten taxonomy names to lowest defined level. [default: %default]"),
39 | make_option(c("-C", "--suppress_relative_abundance_conversion"),action='store_true',default=FALSE,
40 | help="Do not convert input to relative abundances (assumes already relative abundances). [default: %default]"),
41 | make_option(c("-r", "--sort_by_abundance"),action='store_true',default=FALSE,
42 | help="Sort resulting plots by decreasing relative abundance (instead of significance) [default: %default]"),
43 | make_option(c("-n", "--nplot"), type="numeric", default=NULL,
44 | help="Number of taxa to plot (in order of decreasing significance). Ignored if --which_taxa exists [default: %default]"),
45 | make_option(c("-a","--alpha"), type='numeric', default=.05,
46 | help='Maximum false discovery rate to report. Ignored if --which_taxa exists or --nplot exists [default: %default]'),
47 | make_option(c("-O","--category_order"), type="character", default=NULL,
48 | help="Optional ordering of categories (comma-separated) [default alphabetical]."),
49 | make_option(c("-o", "--outdir"), type="character", default='.',
50 | help="Output directory [default %default]")
51 | )
52 | opts <- parse_args(OptionParser(option_list=option_list),
53 | args=commandArgs(trailing=TRUE))
54 |
55 | # create output directory if needed
56 | if(opts$outdir != ".") dir.create(opts$outdir,showWarnings=FALSE, recursive=TRUE)
57 |
58 | # LOAD DATA
59 | if(opts$input_format == "Taxon table"){
60 | x <- t(read.table(opts$input_fp,sep='\t',head=T,row=1,check=F,quote='"'))
61 | } else if(opts$input_format == "OTU table") {
62 | x <- t(read.table(opts$input_fp,sep='\t',head=T,row=1,check=F,quote='"',comment='',skip=1))
63 | } else {
64 | stop("Unknown input format\n")
65 | }
66 | if(!is.null(opts$map_fp)){
67 | m <- read.table(opts$map_fp,sep='\t',head=T,row=1,check=F,comment='',quote='"')
68 | # check rownames in mapping file matrix
69 | missing.taxa.samples <- setdiff(rownames(x), rownames(m))
70 | missing.map.samples <- setdiff(rownames(m), rownames(x))
71 | if(length(missing.taxa.samples) > 0){
72 | stop(sprintf('\n\nError: one or more sample names from taxonomy table (%s, ...) not present in metadata table (%s, ...).',
73 | paste(sort(missing.taxa.samples)[1:5],collapse=', '),
74 | paste(sort(missing.map.samples)[1:5],collapse=', ')))
75 | }
76 | x <- x[intersect(rownames(x),rownames(m)),,drop=F]
77 | m <- droplevels(m[rownames(x),,drop=F])
78 | }
79 |
80 | # remove rare features (do by minimum prevalence or average prevalence)
81 | print(dim(x))
82 | if (dim(x)[2] > 1) x <- x[,colMeans(x > 0) >= opts$min_prevalence, drop = FALSE]
83 |
84 | # data transform
85 | if(opts$transform_type == 'asin-sqrt'){
86 | x <- asin(sqrt(x))
87 | } else if(opts$transform_type == 'norm-asin-sqrt'){
88 | x <- asin(sqrt(x))/asin(sqrt(1))
89 | } else if(opts$transform_type != 'none'){
90 | stop(paste('Unrecognized data transform type:',opts$transform_type))
91 | }
92 |
93 | # check that taxon.names are in taxon table
94 | if(is.null(opts$which_taxa)){
95 | taxon.names <- colnames(x)[rev(order(colMeans(x)))]
96 | taxon.names <- taxon.names[1:min(opts$nplot, length(taxon.names))]
97 | } else {
98 | taxon.names <- strsplit(opts$which_taxa,',')[[1]]
99 |
100 | if(!all(taxon.names %in% colnames(x))){
101 | stop(paste('The following taxa are not present in the taxon table:',
102 | paste(taxon.names[!(taxon.names %in% colnames(x))],collapse=', '),
103 | '\n'))
104 | }
105 | }
106 | if(!is.element(opts$column,colnames(m))) stop(paste(opts$column,'not in mapping file.'))
107 |
108 | diff.tests = NULL;
109 | # identify differentiated features
110 | print(dim(m))
111 | if (dim(m)[2] > 1)
112 | try (diff.tests <- differentiation.test(x, m[,opts$column], alpha=2, parametric=FALSE),silent=T)
113 |
114 |
115 | #if(is.null(opts$which_taxa)){
116 | if (!is.null(diff.tests)) {
117 | if(is.null(opts$nplot)){
118 | hit.ix <- which(diff.tests$qvalues <= opts$alpha)
119 | } else {
120 | hit.ix <- order(diff.tests$pvalues)[1:min(opts$nplot,length(diff.tests$pvalues))]
121 | }
122 | } else {
123 | hit.ix <- match(opts$which_taxa, colnames(x))
124 | }
125 |
126 | if(length(hit.ix) == 0){
127 | print('No hits found.')
128 | } else {
129 | cat("There were",length(hit.ix),"taxa significant at FDR of",opts$alpha,'\n')
130 | }
131 |
132 | # save hits
133 | if (length(hit.ix)) write.differentiation.test.results(diff.tests, filename=sprintf('%s/test_results.txt',opts$outdir))
134 |
135 | # sort by relative abundance if requested
136 | if(opts$sort_by_abundance){
137 | hit.ix <- hit.ix[order(colMeans(x)[hit.ix],decreasing=TRUE)]
138 | }
139 |
140 | if(opts$shorten_taxa){
141 | colnames(x) <- shorten.taxonomy(colnames(x))
142 | taxon.names <- shorten.taxonomy(taxon.names)
143 | }
144 |
145 | # plots
146 | env <- m[,opts$column]
147 |
148 | # fix order if requested
149 | if(!is.null(opts$category_order)){
150 | level.order <- strsplit(opts$category_order,',')[[1]]
151 | expected.levels <- sort(unique(as.character(env)))
152 | if(!identical(sort(unique(level.order)),expected.levels)){
153 | stop(paste("--category_order list does not contain the same categories",
154 | "as the provided mapping file:",
155 | paste(sort(unique(env)),collapse=', '),'\n',sep=' '))
156 | }
157 | env <- factor(env,levels=level.order)
158 | }
159 |
160 | #plot.beeswarm.dt <- function(cols, x_axis_label, hit.ix, env, outdir) {
161 | # require(beeswarm, quietly=TRUE, warn.conflicts=FALSE)
162 |
163 | # cols <- #c(brewer.pal(9,'Set1'),brewer.pal(9,'Pastel1'),brewer.pal(8,'Dark2'),brewer.pal(8,'Accent'))[-6]
164 | # cols[1:2] <- cols[2:1]
165 | # cols <- sprintf('%sbb',cols)
166 | # if (!length(hit.ix)) hit.ix = seq(1,dim(x)[2])
167 | # #print(x[,1])
168 | # #print(env)
169 | # #pdf(filename.i,width=8.5,height=11)
170 | # #par(oma=rep(c(0,0),2),mar=c(12,8,8,3), cex.axis=.65, cex.lab=.65, cex=2)
171 | # for(i in hit.ix){
172 | # taxon <- x[,i]
173 | # taxon.name <- colnames(x)[i]
174 | # filename.i <- sprintf('%s/beeswarm-%s.pdf',outdir, taxon.name)
175 | # pdf(filename.i,width=8.5,height=11)
176 | # par(oma=rep(c(0,0),2),mar=c(12,8,8,3), cex.axis=.65, cex.lab=.65, cex=2)
177 | # cex.lab <- max(.45, 1 - strwidth(taxon.name, units='figure') / 4)
178 | # cex.lab <- .45
179 | # cex.axis <- .45
180 | # beeswarm(taxon ~ env,corral='random',las=2,
181 | # col='#000000bb',
182 | # bg=cols,
183 | # pch=21,ylab=taxon.name,xlab=x_axis_label,cex.lab=cex.lab,
184 | #cex.axis=cex.axis)
185 | # bxplot(taxon ~ env,add=TRUE)
186 | # dev.off()
187 | # }
188 | #}
189 |
190 | plot.beeswarm.dt(cols, opts$x_axis_label, hit.ix, env, opts$outdir)
191 |
--------------------------------------------------------------------------------
/examples/corediv/bdiv_even500/unweighted_unifrac_emperor_pcoa_plot/emperor_required_resources/emperor/js/animate.js:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * @author Yoshiki Vazquez Baeza
4 | * @copyright Copyright 2013, The Emperor Project
5 | * @credits Yoshiki Vazquez Baeza
6 | * @license BSD
7 | * @version 0.9.51
8 | * @maintainer Yoshiki Vazquez Baeza
9 | * @email yoshiki89@gmail.com
10 | * @status Release
11 | *
12 | */
13 |
14 | /**
15 | *
16 | * @name AnimationDirector
17 | *
18 | * @class This class represents an animation director for PCoA plots in the
19 | * Emperor visualization software.
20 | *
21 | * @property {float} [minimumDelta=null] A floating point value determining
22 | * what the minimum separation between samples along the gradients is. Will be
23 | * null until it is initialized to the values according to the inputed data.
24 | * @property {int} [maximumTrajectoryLength=null] Maximum length that the
25 | * groups
26 | * of samples have along a gradient.
27 | * @property {int} [currentFrame=-1] The current frame being served by the
28 | * director.
29 | * @property {Array} [trajectories=Array(0)] Array where each element in the
30 | * trajectory is a trajectory with the interpolated points in it.
31 | *
32 | */
33 |
34 | /**
35 | *
36 | * @name AnimationDirector
37 | *
38 | * @class This object represents an animation director, as the name implies, is
39 | * an object that manages an animation. Takes the for a plot (mapping file and
40 | * coordinates) as well as the metadata categories we want to animate over.
41 | * This object gets called in the main emperor module when an animation starts
42 | * and an instance will only be alive for one animation cycle i. e. until the
43 | * cycle hits the final frame of the animation.
44 | *
45 | * @param {mappingFileHeaders} an Array of strings containing metadata mapping
46 | * file headers (required).
47 | * @param {mappingFileData} an Array where the indices are sample identifiers
48 | * and each of the contained elements is an Array of strings where the first
49 | * element corresponds to the first data for the first column in the mapping
50 | * file (mappingFileHeaders) (required).
51 | * @param {coordinatesData} an Array of Objects where the indices are the
52 | * sample identifiers and each of the objects has the following properties: x,
53 | * y, z, name, color, P1, P2, P3, ... PN where N is the number of dimensions in
54 | * this dataset (required).
55 | * @param {gradientCategory} a string with the name of the mapping file header
56 | * where the data that spreads the samples over a gradient is contained,
57 | * usually time or days_since_epoch. Note that this should be an all numeric
58 | * category (required).
59 | * @param {trajectoryCategory} a string with the name of the mapping file
60 | * header where the data that groups the samples is contained, this will
61 | * usually be BODY_SITE, HOST_SUBJECT_ID, etc. (required).
62 | *
63 | * @return returns an animation director if the parameters passed in were all
64 | * valid.
65 | *
66 | * Note that this class will raise an Error in any of the following cases:
67 | * - One of the input arguments is undefined.
68 | * - If gradientCategory is not in the mappingFileHeaders.
69 | * - If trajectoryCategory is not in the mappingFileHeaders.
70 | *
71 | */
72 | function AnimationDirector(mappingFileHeaders, mappingFileData, coordinatesData,
73 | gradientCategory, trajectoryCategory){
74 |
75 | // all arguments are required
76 | if (mappingFileHeaders === undefined || mappingFileData === undefined ||
77 | coordinatesData === undefined || gradientCategory === undefined ||
78 | trajectoryCategory === undefined) {
79 | throw new Error("All arguments are required");
80 | }
81 |
82 | var index;
83 |
84 | index = mappingFileHeaders.indexOf(gradientCategory);
85 | if (index == -1) {
86 | throw new Error("Could not find the gradient category in the mapping"+
87 | " file");
88 | }
89 | index = mappingFileHeaders.indexOf(trajectoryCategory);
90 | if (index == -1) {
91 | throw new Error("Could not find the trajectory category in the mapping"+
92 | " file");
93 | }
94 |
95 | this.mappingFileHeaders = mappingFileHeaders;
96 | this.mappingFileData = mappingFileData;
97 | this.coordinatesData = coordinatesData;
98 | this.gradientCategory = gradientCategory;
99 | this.trajectoryCategory = trajectoryCategory;
100 |
101 | this.minimumDelta = null;
102 | this.maximumTrajectoryLength = null;
103 | this.currentFrame = -1;
104 | this.trajectories = new Array();
105 |
106 | this.initializeTrajectories();
107 | this.getMaximumTrajectoryLength();
108 |
109 | return this;
110 | }
111 |
112 | /**
113 | *
114 | * Initializes the trajectories that the director manages.
115 | *
116 | */
117 | AnimationDirector.prototype.initializeTrajectories = function(){
118 |
119 | var chewedData = null, trajectoryBuffer = null, minimumDelta;
120 | var sampleNamesBuffer = new Array(), gradientPointsBuffer = new Array();
121 | var coordinatesBuffer = new Array();
122 | var chewedDataBuffer = null;
123 |
124 | // compute a dictionary from where we will extract the germane data
125 | chewedData = getSampleNamesAndDataForSortedTrajectories(
126 | this.mappingFileHeaders, this.mappingFileData, this.coordinatesData,
127 | this.trajectoryCategory, this.gradientCategory);
128 |
129 | if (chewedData === null){
130 | throw new Error("Error initializing the trajectories, could not "+
131 | "compute the data");
132 | }
133 |
134 | // calculate the minimum delta per step
135 | this.minimumDelta = getMinimumDelta(chewedData);
136 |
137 | // we have to iterate over the keys because chewedData is a dictionary-like
138 | // object, if possible this should be changed in the future to be an Array
139 | for (var key in chewedData){
140 |
141 | // re-initalize the arrays, essentially dropping all the previously
142 | // existing information
143 | sampleNamesBuffer = [];
144 | gradientPointsBuffer = [];
145 | coordinatesBuffer = [];
146 |
147 | // buffer this to avoid the multiple look-ups below
148 | chewedDataBuffer = chewedData[key];
149 |
150 | // each of the keys is a trajectory name i. e. CONTROL, TREATMENT, etc
151 | // we are going to generate buffers so we can initialize the trajectory
152 | for (var index = 0; index < chewedDataBuffer.length; index++){
153 | // list of sample identifiers
154 | sampleNamesBuffer.push(chewedDataBuffer[index]['name']);
155 |
156 | // list of the value each sample has in the gradient
157 | gradientPointsBuffer.push(chewedDataBuffer[index]['value']);
158 |
159 | // x, y and z values for the coordinates data
160 | coordinatesBuffer.push({'x':chewedDataBuffer[index]['x'],
161 | 'y':chewedDataBuffer[index]['y'],
162 | 'z':chewedDataBuffer[index]['z']});
163 | }
164 |
165 | // don't add a new trajectory
166 | if (sampleNamesBuffer.length <= 1){
167 | continue;
168 | }
169 |
170 | // create the trajectory object
171 | trajectoryBuffer = new TrajectoryOfSamples(sampleNamesBuffer, key,
172 | gradientPointsBuffer, coordinatesBuffer, this.minimumDelta);
173 |
174 | this.trajectories.push(trajectoryBuffer);
175 |
176 | }
177 | return;
178 | }
179 |
180 | /**
181 | *
182 | * Retrieves the lengths of all the trajectories and figures out which of them
183 | * is the longest one, then assigns that value to the maximumTrajectoryLength
184 | * property.
185 | *
186 | */
187 | AnimationDirector.prototype.getMaximumTrajectoryLength = function (){
188 | if(this.maximumTrajectoryLength === null){
189 | this._computeN();
190 | }
191 |
192 | return this.maximumTrajectoryLength;
193 | }
194 |
195 | /**
196 | *
197 | * Helper function to compute the maximum length of the trajectories that the
198 | * director is in charge of.
199 | *
200 | */
201 | AnimationDirector.prototype._computeN = function (){
202 | var arrayOfLengths = new Array();
203 |
204 | // retrieve the length of all the trajectories
205 | for (var index = 0; index < this.trajectories.length; index++){
206 | arrayOfLengths.push(
207 | this.trajectories[index].interpolatedCoordinates.length);
208 | }
209 |
210 | // assign the value of the maximum value for these lengths
211 | this.maximumTrajectoryLength = _.max(arrayOfLengths);
212 | }
213 |
214 | /**
215 | *
216 | * Helper method to update the value of the currentFrame property.
217 | *
218 | */
219 | AnimationDirector.prototype.updateFrame = function (){
220 | if (this.animationCycleFinished() === false) {
221 | this.currentFrame = this.currentFrame + 1;
222 | }
223 | }
224 |
225 | /**
226 | *
227 | * Check whether or not the animation cycle has finished for this object.
228 | * @return {bool} True if the animation has reached it's end and False if the
229 | * animation still has frames to go.
230 | *
231 | */
232 | AnimationDirector.prototype.animationCycleFinished = function (){
233 | return this.currentFrame > this.getMaximumTrajectoryLength();
234 | }
235 |
--------------------------------------------------------------------------------