diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..b03a194 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +**/*.rda filter=lfs diff=lfs merge=lfs -text +**/*.rds filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ce62e59 --- /dev/null +++ b/.gitignore @@ -0,0 +1,49 @@ +# .gitignore for public github + +# History files +.Rhistory +.Rapp.history + +# Session Data files +.RData + +# Example code in package build process +*-Ex.R + +# Output files from R CMD build +/*.tar.gz + +# Output files from R CMD check +/*.Rcheck/ + +# RStudio files +.Rproj.user/ + +# produced vignettes +vignettes/*.html +vignettes/*.pdf + +# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 +.httr-oauth + +# knitr and R markdown default cache directories +/*_cache/ +/cache/ + +# Temporary files created by R markdown +*.utf8.md +*.knit.md + +# Shiny token, see https://shiny.rstudio.com/articles/shinyapps.html +rsconnect/ + +# Do not include external data files +DATA/EXTERNAL/ + +# Ignore result folder and Rmd output folder +REPORT/ +SCRIPTS/P15038_APOE_P2_MultiOmicsManuscript_files/ + +TMP/ + +README.html diff --git a/DATA/CITATION b/DATA/CITATION new file mode 100644 index 0000000..0ddd8ea --- /dev/null +++ b/DATA/CITATION @@ -0,0 +1,8 @@ +CITATION/REFERENCE + +HCOP_ORTHOLOGY_TABLE.rda +https://www.genenames.org/help/hcop/ +Wright MW, Eyre TA, Lush MJ, Povey S and Bruford EA. HCOP: The HGNC Comparison of Orthology Predictions Search Tool. Mamm Genome. 2005 Nov; 16(11):827-828. PMID:16284797 +Eyre TA, Wright MW, Lush MJ and Bruford EA. HCOP: a searchable database of human orthology predictions. Brief Bioinform. 2007 Jan;8(1):2-5. PMID:16951416 +Seal RL, Gordon SM, Lush MJ, Wright MW, Bruford EA. genenames.org: the HGNC resources in 2011. Nucleic Acids Res. 2011 Jan;39(Database issue):D519-9. PMID: 20929869 + diff --git a/DATA/DATA-P15038-S186400_APOE_P2_Lung_Mm_LIPSG.rda b/DATA/DATA-P15038-S186400_APOE_P2_Lung_Mm_LIPSG.rda new file mode 100644 index 0000000..cc61223 --- /dev/null +++ b/DATA/DATA-P15038-S186400_APOE_P2_Lung_Mm_LIPSG.rda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e241ef663033d4441836250d157e73eced2b490f1e900cd9d5ce352d6578e03 +size 1471626 diff --git a/DATA/DATA-Tissue_APOE_P2_Lung_Ms_METABOLOMICS.rda b/DATA/DATA-Tissue_APOE_P2_Lung_Ms_METABOLOMICS.rda new file mode 100644 index 0000000..ead59fc --- /dev/null +++ b/DATA/DATA-Tissue_APOE_P2_Lung_Ms_METABOLOMICS.rda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:36f31504022fda5ac236f574e202768e88f8c21043e2dad1fd451ffb713768e7 +size 686074 diff --git a/DATA/DATA-_APOE_P2_Lung_Mm_PEX.rda b/DATA/DATA-_APOE_P2_Lung_Mm_PEX.rda new file mode 100644 index 0000000..b8bfefd --- /dev/null +++ b/DATA/DATA-_APOE_P2_Lung_Mm_PEX.rda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3856387d952ab039a7e4e528dca9778d280b0d6b61e2e5d3e0bf5992d0842f7e +size 1855041 diff --git a/DATA/DATA_P15038-S185500_APOE_P2_Lung_Mm_MIRNA.rda b/DATA/DATA_P15038-S185500_APOE_P2_Lung_Mm_MIRNA.rda new file mode 100644 index 0000000..a0e289a --- /dev/null +++ b/DATA/DATA_P15038-S185500_APOE_P2_Lung_Mm_MIRNA.rda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e1853ce2f4f7bf10467b57007ae10a70d53e618d34fad8fa1475e15f62a069a2 +size 22648648 diff --git a/DATA/DATA_P15038-S185500_APOE_P2_Lung_Mm_MRNA.rda b/DATA/DATA_P15038-S185500_APOE_P2_Lung_Mm_MRNA.rda new file mode 100644 index 0000000..9fe58ad --- /dev/null +++ b/DATA/DATA_P15038-S185500_APOE_P2_Lung_Mm_MRNA.rda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd2c210d449847d01bea086b63fc2f0538c5e6b0674f0c2e94b963c1584a38be +size 56940762 diff --git a/DATA/GeneIDTable.Mm.rda b/DATA/GeneIDTable.Mm.rda new file mode 100644 index 0000000..ebf3697 --- /dev/null +++ b/DATA/GeneIDTable.Mm.rda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c583e4ad74ae45724caee8c12c0859e2a169fdbda4d681db7db37bb92dd6818 +size 915662 diff --git a/DATA/HCOP_ORTHOLOGY_TABLE.rda b/DATA/HCOP_ORTHOLOGY_TABLE.rda new file mode 100644 index 0000000..313e7bf --- /dev/null +++ b/DATA/HCOP_ORTHOLOGY_TABLE.rda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0a7e060cf02c3c59636509923292ef18caf9e6cc2ae0d79ddbcbb47edad5592b +size 3916373 diff --git a/DATA/HomologTable.rda b/DATA/HomologTable.rda new file mode 100644 index 0000000..df34c3b --- /dev/null +++ b/DATA/HomologTable.rda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ac99caad3a53886698e1116860161f11c9c305ef779141217d75446aee19090a +size 2037367 diff --git a/DATA/IDMAP-P15038-S186400_APOE_P2_Lung_Mm_LIPSG.rda b/DATA/IDMAP-P15038-S186400_APOE_P2_Lung_Mm_LIPSG.rda new file mode 100644 index 0000000..d97599e --- /dev/null +++ b/DATA/IDMAP-P15038-S186400_APOE_P2_Lung_Mm_LIPSG.rda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4ad6eae48b34cb672ac1545567ba422379685b03012d65b903346d3abae4a5d9 +size 2382392 diff --git a/DATA/IDMAP-Tissue_APOE_P2_Lung_Ms_METABOLOMICS.rda b/DATA/IDMAP-Tissue_APOE_P2_Lung_Ms_METABOLOMICS.rda new file mode 100644 index 0000000..75f19d7 --- /dev/null +++ b/DATA/IDMAP-Tissue_APOE_P2_Lung_Ms_METABOLOMICS.rda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0bfb5beb2d128635841b1a3e55d5b10de8a6257a9eff79fff6a714f3287a6eb9 +size 5571726 diff --git a/DATA/IDMAP-_APOE_P2_Lung_Mm_PEX.rda b/DATA/IDMAP-_APOE_P2_Lung_Mm_PEX.rda new file mode 100644 index 0000000..660fffe --- /dev/null +++ b/DATA/IDMAP-_APOE_P2_Lung_Mm_PEX.rda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:16d006ef5334cc160b5bca09812227c77e22f278a50a4ca326c2d3dbec469d73 +size 3705557 diff --git a/DATA/IDMAP_P15038-S185500_APOE_P2_Lung_Mm_MIRNA.rda b/DATA/IDMAP_P15038-S185500_APOE_P2_Lung_Mm_MIRNA.rda new file mode 100644 index 0000000..a26f158 --- /dev/null +++ b/DATA/IDMAP_P15038-S185500_APOE_P2_Lung_Mm_MIRNA.rda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e9fc0e691efab629f3183bc6385bc64473a96566e2c9473c28d711b6274df6d2 +size 24019608 diff --git a/DATA/IDMAP_P15038-S185500_APOE_P2_Lung_Mm_MRNA.rda b/DATA/IDMAP_P15038-S185500_APOE_P2_Lung_Mm_MRNA.rda new file mode 100644 index 0000000..3615382 --- /dev/null +++ b/DATA/IDMAP_P15038-S185500_APOE_P2_Lung_Mm_MRNA.rda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6c946e2449b37b069169d9de1c26b5b1dcffc59f8161210b81e7b93a92a385b +size 170454721 diff --git a/DATA/LICENSE b/DATA/LICENSE new file mode 100644 index 0000000..944dd3f --- /dev/null +++ b/DATA/LICENSE @@ -0,0 +1,17 @@ +This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. + +License applies to provided data files: +IDMAP_P15038-S185500_APOE_P2_Lung_Mm_MRNA.rda +NPALIST_P15038-S185500_APOE_P2_Lung_Mm_MRNA.rda +DATA-_APOE_P2_Lung_Mm_PEX.rda +IDMAP-P15038-S186400_APOE_P2_Lung_Mm_LIPSG.rda +P15038_APOE_P2_BALF_cells.rda +DATA_P15038-S185500_APOE_P2_Lung_Mm_MIRNA.rda +IDMAP-Tissue_APOE_P2_Lung_Ms_METABOLOMICS.rda +P15038_APOE_P2_Exposure.rda +DATA_P15038-S185500_APOE_P2_Lung_Mm_MRNA.rda +P15038_LungManuscript_LipidMappingTable3_bt.csv +DATA-P15038-S186400_APOE_P2_Lung_Mm_LIPSG.rda +IDMAP-_APOE_P2_Lung_Mm_PEX.rda +DATA-Tissue_APOE_P2_Lung_Ms_METABOLOMICS.rda +IDMAP_P15038-S185500_APOE_P2_Lung_Mm_MIRNA.rda \ No newline at end of file diff --git a/DATA/MapApprovedSynonyms.Hs.2014-11-27.rda b/DATA/MapApprovedSynonyms.Hs.2014-11-27.rda new file mode 100644 index 0000000..07b44ce --- /dev/null +++ b/DATA/MapApprovedSynonyms.Hs.2014-11-27.rda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2f76be8b48a4006ad15a200b9e66ca814d38b5112ecc6f99835c9c00187c21d6 +size 401774 diff --git a/DATA/MapApprovedSynonyms.Mm.2014-11-27.rda b/DATA/MapApprovedSynonyms.Mm.2014-11-27.rda new file mode 100644 index 0000000..7cd1686 --- /dev/null +++ b/DATA/MapApprovedSynonyms.Mm.2014-11-27.rda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f587a29934038b8fadb468aeaa641e06503ffe086b65083d537fad3b3aa04482 +size 552153 diff --git a/DATA/NPALIST_P15038-S185500_APOE_P2_Lung_Mm_MRNA.rda b/DATA/NPALIST_P15038-S185500_APOE_P2_Lung_Mm_MRNA.rda new file mode 100644 index 0000000..571c358 --- /dev/null +++ b/DATA/NPALIST_P15038-S185500_APOE_P2_Lung_Mm_MRNA.rda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0cce725e3355d244e1f6c3b4fe6b0e333577e7a59cc1b08ad9d8e166952d9cc3 +size 864141892 diff --git a/DATA/P15038_APOE_P2_BALF_cells.rda b/DATA/P15038_APOE_P2_BALF_cells.rda new file mode 100644 index 0000000..72f2b34 --- /dev/null +++ b/DATA/P15038_APOE_P2_BALF_cells.rda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d0189a750e6b75946875dba3efede70aa56ec19ce74cae1af8bcf6d02a3b4e3 +size 10176 diff --git a/DATA/P15038_APOE_P2_Exposure.rda b/DATA/P15038_APOE_P2_Exposure.rda new file mode 100644 index 0000000..4ce95d5 --- /dev/null +++ b/DATA/P15038_APOE_P2_Exposure.rda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:616ffd24053237a61180c27ba38733e416c9bd7f204745b42bef36d6b12932fc +size 21213 diff --git a/DATA/P15038_LungManuscript_LipidMappingTable3_bt.csv b/DATA/P15038_LungManuscript_LipidMappingTable3_bt.csv new file mode 100644 index 0000000..b7df1d2 --- /dev/null +++ b/DATA/P15038_LungManuscript_LipidMappingTable3_bt.csv @@ -0,0 +1,371 @@ +,Name_Metabolon,Name_PMI,KEGG,KEGG_ID_NOTES,Group.HMDB +201,myristoyl dihydrosphingomyelin (d18:0/14:0)*,Cer d18:0/14:0,,,HMDB12085 +195,N-palmitoyl-sphinganine (d18:0/16:0),Cer d18:0/16:0,,,HMDB11760 +196,N-palmitoyl-sphingosine (d18:1/16:0),Cer d18:0/16:0,,,HMDB04949 +202,palmitoyl dihydrosphingomyelin (d18:0/16:0)*,Cer d18:0/16:0,,, +203,behenoyl dihydrosphingomyelin (d18:0/22:0)*,Cer d18:0/22:0,,,HMDB12091 +200,glycosyl-N-palmitoyl-sphingosine (d18:1/16:0),Cer d18:1/16:0,,, +197,N-stearoyl-sphingosine (d18:1/18:0)*,Cer d18:1/18:0,,,HMDB04950 +199,"ceramide (d18:2/24:1, d18:1/24:2)*",Cer d18:1/24:2,,, +198,N-palmitoyl-sphingadienine (d18:2/16:0)*,Cer d18:2/16:0,,, +170,palmitoyl-myristoyl-glycerol (16:0/14:0) [2],DAG 30:0,C00165,GENERIC DAG ONLY,HMDB07095 +166,"diacylglycerol (12:0/18:1, 14:0/16:1, 16:0/14:1) [2]*",DAG 30:1,C00165,GENERIC DAG ONLY, +171,palmitoyl-palmitoyl-glycerol (16:0/16:0) [2]*,DAG 32:0,C00165,GENERIC DAG ONLY,HMDB07098 +167,"diacylglycerol (14:0/18:1, 16:0/16:1) [1]*",DAG 32:1,C00165,GENERIC DAG ONLY, +168,"diacylglycerol (14:0/18:1, 16:0/16:1) [2]*",DAG 32:1,C00165,GENERIC DAG ONLY, +172,palmitoyl-oleoyl-glycerol (16:0/18:1) [1]*,DAG 34:1,C13861,FROM METABOLON,HMDB07102 +173,palmitoyl-oleoyl-glycerol (16:0/18:1) [2]*,DAG 34:1,C13861,FROM METABOLON,HMDB07102 +174,palmitoyl-linoleoyl-glycerol (16:0/18:2) [1]*,DAG 34:2,C00165,GENERIC DAG ONLY,HMDB07103 +175,palmitoyl-linoleoyl-glycerol (16:0/18:2) [2]*,DAG 34:2,C00165,GENERIC DAG ONLY,HMDB07103 +169,"diacylglycerol (16:1/18:2 [2], 16:0/18:3 [1])*",DAG 34:3,C00165,GENERIC DAG ONLY, +176,palmitoleoyl-linoleoyl-glycerol (16:1/18:2) [1]*,DAG 34:3,C00165,GENERIC DAG ONLY,HMDB07132 +232,,DAG 35:3,C00165,GENERIC DAG ONLY, +182,stearoyl-linoleoyl-glycerol (18:0/18:2) [2]*,DAG 36:2,C00165,GENERIC DAG ONLY, +183,oleoyl-oleoyl-glycerol (18:1/18:1) [2]*,DAG 36:2,C00165,GENERIC DAG ONLY,HMDB07218 +177,palmitoyl-dihomo-linolenoyl-glycerol (16:0/20:3n3 or 6) [2]*,DAG 36:3,C00165,GENERIC DAG ONLY, +184,oleoyl-linoleoyl-glycerol (18:1/18:2) [1],DAG 36:3,C00165,GENERIC DAG ONLY,HMDB07219 +185,oleoyl-linoleoyl-glycerol (18:1/18:2) [2],DAG 36:3,C00165,GENERIC DAG ONLY,HMDB07219 +178,palmitoyl-arachidonoyl-glycerol (16:0/20:4) [1]*,DAG 36:4,C00165,GENERIC DAG ONLY,HMDB07112 +179,palmitoyl-arachidonoyl-glycerol (16:0/20:4) [2]*,DAG 36:4,C00165,GENERIC DAG ONLY,HMDB07112 +186,linoleoyl-linoleoyl-glycerol (18:2/18:2) [1]*,DAG 36:4,C00165,GENERIC DAG ONLY,HMDB07248 +187,linoleoyl-linolenoyl-glycerol (18:2/18:3) [2]*,DAG 36:5,C00165,GENERIC DAG ONLY,HMDB07250 +233,,DAG 38:1,C00165,GENERIC DAG ONLY, +188,stearoyl-arachidonoyl-glycerol (18:0/20:4) [1]*,DAG 38:4,C00165,GENERIC DAG ONLY, +189,stearoyl-arachidonoyl-glycerol (18:0/20:4) [2]*,DAG 38:4,C00165,GENERIC DAG ONLY, +190,oleoyl-arachidonoyl-glycerol (18:1/20:4) [2]*,DAG 38:5,C00165,GENERIC DAG ONLY,HMDB07228 +180,palmitoyl-docosahexaenoyl-glycerol (16:0/22:6) [1]*,DAG 38:6,C00165,GENERIC DAG ONLY,HMDB07121 +181,palmitoyl-docosahexaenoyl-glycerol (16:0/22:6) [2]*,DAG 38:6,C00165,GENERIC DAG ONLY,HMDB07121 +191,linoleoyl-arachidonoyl-glycerol (18:2/20:4) [2]*,DAG 38:6,C00165,GENERIC DAG ONLY,HMDB07257 +192,stearoyl-docosahexaenoyl-glycerol (18:0/22:6) [1]*,DAG 40:6,C00165,GENERIC DAG ONLY, +193,stearoyl-docosahexaenoyl-glycerol (18:0/22:6) [2]*,DAG 40:6,C00165,GENERIC DAG ONLY, +194,linoleoyl-docosahexaenoyl-glycerol (18:2/22:6) [2]*,DAG 40:8,C00165,GENERIC DAG ONLY,HMDB07266 +1,5-dodecenoate (12:1n7),FA 12:1,,,HMDB00529 +2,palmitate (16:0),FA 16:0,C00249,FROM METABOLON,HMDB00220 +3,palmitoleate (16:1n7),FA 16:1,C08362,FROM METABOLON,HMDB03229 +12,hexadecadienoate (16:2n6),FA 16:2,,,HMDB00477 +4,10-heptadecenoate (17:1n7),FA 17:1,,,HMDB60038 +5,stearate (18:0),FA 18:0,C01530,FROM METABOLON,HMDB00827 +6,oleate/vaccenate (18:1),FA 18:1,,, +19,linoleate (18:2n6),FA 18:2,C01595,FROM METABOLON,HMDB00673 +20,linolenate (18:3n3 or 3n6),FA 18:3,C06426,FROM METABOLON,HMDB03073 +13,stearidonate (18:4n3),FA 18:4,C16300,FROM METABOLON,HMDB06547 +7,nonadecanoate (19:0),FA 19:0,C16535,FROM METABOLON,HMDB00772 +8,10-nonadecenoate (19:1n9),FA 19:1,,,HMDB13622 +9,arachidate (20:0),FA 20:0,C06425,FROM METABOLON,HMDB02212 +10,eicosenoate (20:1n9 or 1n11),FA 20:1,C16526,FROM METABOLON,HMDB02231 +21,dihomolinolenate (20:3n3 or 3n6),FA 20:3,C03242,FROM METABOLON,HMDB02925 +14,eicosapentaenoate (EPA; 20:5n3),FA 20:5,C06428,FROM METABOLON,HMDB01999 +11,erucate (22:1n9),FA 22:1,C08316,FROM METABOLON,HMDB02068 +17,docosatrienoate (22:3n3),FA 22:3,C16534,FROM METABOLON,HMDB02823 +15,docosapentaenoate (DPA; 22:5n3),FA 22:5,C16513,FROM METABOLON,HMDB06528 +16,docosahexaenoate (DHA; 22:6n3),FA 22:6,C06429,FROM METABOLON,HMDB02183 +18,nisinate (24:6n3),FA 24:6,,,HMDB02007 +234,,LPC 14:0,C04230,GENERIC LPC ONLY, +235,,LPC 15:4,C04230,GENERIC LPC ONLY, +105,1-palmitoyl-GPC (16:0),LPC 16:0,C04230,GENERIC LPC ONLY,HMDB10382 +106,2-palmitoyl-GPC* (16:0)*,LPC 16:0,C04230,GENERIC LPC ONLY,HMDB61702 +107,1-palmitoleoyl-GPC* (16:1)*,LPC 16:1,C04230,GENERIC LPC ONLY,HMDB10383 +108,2-palmitoleoyl-GPC* (16:1)*,LPC 16:1,C04230,GENERIC LPC ONLY,HMDB10383 +236,,LPC 16:2,C04230,GENERIC LPC ONLY, +237,,LPC 16:5,C04230,GENERIC LPC ONLY, +109,1-stearoyl-GPC (18:0),LPC 18:0,C04230,GENERIC LPC ONLY,HMDB10384 +110,1-oleoyl-GPC (18:1),LPC 18:1,C04230,GENERIC LPC ONLY,HMDB02815 +111,1-linoleoyl-GPC (18:2),LPC 18:2,C04100,FROM METABOLON,HMDB10386 +112,1-linolenoyl-GPC (18:3)*,LPC 18:3,C04230,GENERIC LPC ONLY,HMDB10388 +238,,LPC 19:0,C04230,GENERIC LPC ONLY, +239,,LPC 20:2,C04230,GENERIC LPC ONLY, +113,1-arachidonoyl-GPC* (20:4)*,LPC 20:4,C05208,FROM METABOLON,HMDB10395 +240,,LPC 22:4,C04230,GENERIC LPC ONLY, +241,,LPC 22:6,C04230,GENERIC LPC ONLY, +114,1-lignoceroyl-GPC (24:0),LPC 24:0,C04230,GENERIC LPC ONLY,HMDB10405 +242,,LPC O- 14:2,,, +243,,LPC O- 16:0,,, +143,1-(1-enyl-palmitoyl)-GPC (P-16:0)*,LPCO 16:0,,,HMDB10407 +115,1-palmitoyl-GPE (16:0),LPE 16:0,C04438,GENERIC LPE ONLY,HMDB11503 +116,1-stearoyl-GPE (18:0),LPE 18:0,C04438,GENERIC LPE ONLY,HMDB11130 +117,2-stearoyl-GPE (18:0)*,LPE 18:0,C04438,GENERIC LPE ONLY,HMDB11129 +118,1-oleoyl-GPE (18:1),LPE 18:1,C04438,GENERIC LPE ONLY,HMDB11506 +119,1-linoleoyl-GPE (18:2)*,LPE 18:2,C04438,GENERIC LPE ONLY,HMDB11507 +244,,LPE 20:0,C04438,GENERIC LPE ONLY, +245,,LPE 20:1,C04438,GENERIC LPE ONLY, +246,,LPE 20:2,C04438,GENERIC LPE ONLY, +120,1-arachidonoyl-GPE (20:4n6)*,LPE 20:4,C04438,GENERIC LPE ONLY,HMDB11517 +247,,LPE 22:4,C04438,GENERIC LPE ONLY, +248,,LPE 22:5,C04438,GENERIC LPE ONLY, +249,,LPE 22:6,C04438,GENERIC LPE ONLY, +250,,LPE O- 18:2,,, +144,1-(1-enyl-palmitoyl)-GPE (P-16:0)*,LPEO 16:0,,, +146,1-(1-enyl-stearoyl)-GPE (P-18:0)*,LPEO 18:0,,, +145,1-(1-enyl-oleoyl)-GPE (P-18:1)*,LPEO 18:1,,, +124,1-palmitoyl-GPG (16:0)*,LPG 16:0,,, +125,1-stearoyl-GPG (18:0),LPG 18:0,,, +126,1-oleoyl-GPG (18:1)*,LPG 18:1,,, +127,1-linoleoyl-GPG (18:2)*,LPG 18:2,,, +128,1-palmitoyl-GPI* (16:0),LPI 16:0,,,HMDB61695 +129,1-stearoyl-GPI (18:0),LPI 18:0,,,HMDB61696 +130,1-oleoyl-GPI (18:1)*,LPI 18:1,,, +131,1-linoleoyl-GPI* (18:2)*,LPI 18:2,,, +132,1-arachidonoyl-GPI* (20:4)*,LPI 20:4,,,HMDB61690 +121,1-palmitoyl-GPS (16:0)*,LPS 16:0,,, +122,1-stearoyl-GPS (18:0)*,LPS 18:0,,, +123,1-oleoyl-GPS (18:1),LPS 18:1,,,HMDB61694 +147,1-myristoylglycerol (14:0),MAG 14:0,C01885,FROM METABOLON,HMDB11561 +157,2-myristoylglycerol (14:0),MAG 14:0,,,HMDB11530 +148,1-palmitoylglycerol (16:0),MAG 16:0,,,HMDB31074 +158,2-palmitoylglycerol (16:0),MAG 16:0,,,HMDB11533 +149,1-palmitoleoylglycerol (16:1)*,MAG 16:1,,,HMDB11565 +159,2-palmitoleoylglycerol (16:1)*,MAG 16:1,,,HMDB11565 +150,1-oleoylglycerol (18:1),MAG 18:1,,,HMDB11567 +160,2-oleoylglycerol (18:1),MAG 18:1,,,HMDB11537 +151,1-linoleoylglycerol (18:2),MAG 18:2,,, +161,2-linoleoylglycerol (18:2),MAG 18:2,,,HMDB11538 +152,1-linolenoylglycerol (18:3),MAG 18:3,,,HMDB11569 +153,2-dihomo-linoleoylglycerol (20:2)*,MAG 20:2,,, +165,1-dihomo-linoleoylglycerol (20:2),MAG 20:2,,, +154,1-dihomo-linolenylglycerol (20:3),MAG 20:3,,, +164,1-meadoylglycerol (20:3n9)*,MAG 20:3,,, +155,1-arachidonylglycerol (20:4),MAG 20:4,C13857,FROM METABOLON,HMDB11549 +162,2-arachidonoylglycerol (20:4),MAG 20:4,C13856,FROM METABOLON,HMDB04666 +156,1-docosahexaenoylglycerol (22:6),MAG 22:6,,,HMDB11587 +163,2-docosahexaenoylglycerol (22:6)*,MAG 22:6,,,HMDB11557 +251,,PA 32:0,,, +252,,PA 32:1,,, +253,,PA 34:1,,, +54,1-oleoyl-2-linoleoyl-GPA (18:1/18:2)*,PA 36:3,,, +254,,PA 36:4,,, +255,,PC 28:0,C00157,GENERIC PC ONLY, +55,1-myristoyl-2-palmitoyl-GPC (14:0/16:0),PC 30:0,C00157,GENERIC PC ONLY,HMDB07869 +256,,PC 30:1,C00157,GENERIC PC ONLY, +257,,PC 30:2,C00157,GENERIC PC ONLY, +258,,PC 31:0,C00157,GENERIC PC ONLY, +259,,PC 31:1,C00157,GENERIC PC ONLY, +57,"1,2-dipalmitoyl-GPC (16:0/16:0)",PC 32:0,C00157,GENERIC PC ONLY,HMDB00564 +58,1-palmitoyl-2-palmitoleoyl-GPC (16:0/16:1)*,PC 32:1,C00157,GENERIC PC ONLY,HMDB07969 +260,,PC 32:2,C00157,GENERIC PC ONLY, +261,,PC 33:0,C00157,GENERIC PC ONLY, +262,,PC 33:1,C00157,GENERIC PC ONLY, +263,,PC 33:2,C00157,GENERIC PC ONLY, +59,1-palmitoyl-2-stearoyl-GPC (16:0/18:0),PC 34:0,C00157,GENERIC PC ONLY,HMDB07970 +60,1-palmitoyl-2-oleoyl-GPC (16:0/18:1),PC 34:1,C00157,GENERIC PC ONLY,HMDB07972 +61,1-palmitoyl-2-linoleoyl-GPC (16:0/18:2),PC 34:2,C00157,GENERIC PC ONLY,HMDB07973 +62,1-palmitoyl-2-gamma-linolenoyl-GPC (16:0/18:3n6)*,PC 34:3,C00157,GENERIC PC ONLY,HMDB07974 +65,1-palmitoleoyl-2-linoleoyl-GPC (16:1/18:2)*,PC 34:3,C00157,GENERIC PC ONLY,HMDB08006 +56,1-myristoyl-2-arachidonoyl-GPC (14:0/20:4)*,PC 34:4,C00157,GENERIC PC ONLY,HMDB07883 +66,1-palmitoleoyl-2-linolenoyl-GPC (16:1/18:3)*,PC 34:4,C00157,GENERIC PC ONLY,HMDB08008 +264,,PC 35:2,C00157,GENERIC PC ONLY, +265,,PC 35:4,C00157,GENERIC PC ONLY, +67,"1,2-distearoyl-GPC (18:0/18:0)",PC 36:0,C00157,GENERIC PC ONLY,HMDB08036 +68,1-stearoyl-2-oleoyl-GPC (18:0/18:1),PC 36:1,C00157,GENERIC PC ONLY,HMDB08038 +69,1-stearoyl-2-linoleoyl-GPC (18:0/18:2)*,PC 36:2,C00157,GENERIC PC ONLY,HMDB08039 +72,1-oleoyl-2-linoleoyl-GPC (18:1/18:2)*,PC 36:3,C00157,GENERIC PC ONLY, +63,1-palmitoyl-2-arachidonoyl-GPC (16:0/20:4n6),PC 36:4,C00157,GENERIC PC ONLY,HMDB07982 +74,"1,2-dilinoleoyl-GPC (18:2/18:2)",PC 36:4,C00157,GENERIC PC ONLY,HMDB08138 +266,,PC 36:5,C00157,GENERIC PC ONLY, +267,,PC 36:6,C00157,GENERIC PC ONLY, +268,,PC 37:2,C00157,GENERIC PC ONLY, +269,,PC 37:3,C00157,GENERIC PC ONLY, +270,,PC 37:4,C00157,GENERIC PC ONLY, +271,,PC 37:5,C00157,GENERIC PC ONLY, +272,,PC 38:2,C00157,GENERIC PC ONLY, +70,1-stearoyl-2-arachidonoyl-GPC (18:0/20:4),PC 38:4,C00157,GENERIC PC ONLY,HMDB08048 +273,,PC 38:5,C00157,GENERIC PC ONLY, +64,1-palmitoyl-2-docosahexaenoyl-GPC (16:0/22:6),PC 38:6,C00157,GENERIC PC ONLY,HMDB07991 +75,1-linoleoyl-2-arachidonoyl-GPC (18:2/20:4n6)*,PC 38:6,C00157,GENERIC PC ONLY,HMDB08147 +274,,PC 39:4,C00157,GENERIC PC ONLY, +275,,PC 39:5,C00157,GENERIC PC ONLY, +276,,PC 39:6,C00157,GENERIC PC ONLY, +277,,PC 40:1,C00157,GENERIC PC ONLY, +278,,PC 40:2,C00157,GENERIC PC ONLY, +279,,PC 40:4,C00157,GENERIC PC ONLY, +280,,PC 40:5,C00157,GENERIC PC ONLY, +71,1-stearoyl-2-docosahexaenoyl-GPC (18:0/22:6),PC 40:6,C00157,GENERIC PC ONLY,HMDB08057 +73,1-oleoyl-2-docosahexaenoyl-GPC (18:1/22:6)*,PC 40:7,C00157,GENERIC PC ONLY,HMDB08123 +281,,PC 42:4,C00157,GENERIC PC ONLY, +282,,PC 42:5,C00157,GENERIC PC ONLY, +283,,PC 42:6,C00157,GENERIC PC ONLY, +135,1-(1-enyl-palmitoyl)-2-palmitoyl-GPC (P-16:0/16:0)*,PCO 32:0,C00958,GENERIC CHOLINE PLASMALOGEN,HMDB11206 +136,1-(1-enyl-palmitoyl)-2-palmitoleoyl-GPC (P-16:0/16:1)*,PCO 32:1,C00958,GENERIC CHOLINE PLASMALOGEN,HMDB11207 +284,,PCO 32:2,C00958,GENERIC CHOLINE PLASMALOGEN, +285,,PCO 32:3,C00958,GENERIC CHOLINE PLASMALOGEN, +138,1-(1-enyl-palmitoyl)-2-oleoyl-GPC (P-16:0/18:1)*,PCO 34:1,C00958,GENERIC CHOLINE PLASMALOGEN, +141,1-(1-enyl-palmitoyl)-2-linoleoyl-GPC (P-16:0/18:2)*,PCO 34:2,C00958,GENERIC CHOLINE PLASMALOGEN,HMDB11211 +286,,PCO 34:3,C00958,GENERIC CHOLINE PLASMALOGEN, +287,,PCO 36:2,C00958,GENERIC CHOLINE PLASMALOGEN, +140,1-(1-enyl-palmitoyl)-2-arachidonoyl-GPC (P-16:0/20:4)*,PCO 36:4,C00958,GENERIC CHOLINE PLASMALOGEN,HMDB11220 +288,,PCO 36:5,C00958,GENERIC CHOLINE PLASMALOGEN, +289,,PCO 38:2,C00958,GENERIC CHOLINE PLASMALOGEN, +290,,PCO 38:4,C00958,GENERIC CHOLINE PLASMALOGEN, +291,,PCO 38:5,C00958,GENERIC CHOLINE PLASMALOGEN, +292,,PCO 38:6,C00958,GENERIC CHOLINE PLASMALOGEN, +293,,PCO 38:7,C00958,GENERIC CHOLINE PLASMALOGEN, +294,,PCO 40:4,C00958,GENERIC CHOLINE PLASMALOGEN, +295,,PCO 40:5,C00958,GENERIC CHOLINE PLASMALOGEN, +296,,PCO 40:6,C00958,GENERIC CHOLINE PLASMALOGEN, +297,,PCO 40:7,C00958,GENERIC CHOLINE PLASMALOGEN, +76,"1,2-dipalmitoyl-GPE (16:0/16:0)*",PE 32:0,C00350,GENERIC PE ONLY,HMDB08923 +298,,PE 32:1,C00350,GENERIC PE ONLY, +299,,PE 32:2,C00350,GENERIC PE ONLY, +77,1-palmitoyl-2-oleoyl-GPE (16:0/18:1),PE 34:1,C00350,GENERIC PE ONLY,HMDB05320 +78,1-palmitoyl-2-linoleoyl-GPE (16:0/18:2),PE 34:2,C00350,GENERIC PE ONLY,HMDB05322 +300,,PE 35:1,C00350,GENERIC PE ONLY, +301,,PE 35:2,C00350,GENERIC PE ONLY, +81,1-stearoyl-2-oleoyl-GPE (18:0/18:1),PE 36:1,C00350,GENERIC PE ONLY,HMDB08993 +82,1-stearoyl-2-linoleoyl-GPE (18:0/18:2)*,PE 36:2,C00350,GENERIC PE ONLY,HMDB08994 +85,"1,2-dioleoyl-GPE (18:1/18:1)",PE 36:2,C00350,GENERIC PE ONLY, +86,1-oleoyl-2-linoleoyl-GPE (18:1/18:2)*,PE 36:3,C00350,GENERIC PE ONLY,HMDB05349 +79,1-palmitoyl-2-arachidonoyl-GPE (16:0/20:4)*,PE 36:4,C00350,GENERIC PE ONLY,HMDB05323 +89,"1,2-dilinoleoyl-GPE (18:2/18:2)*",PE 36:4,C00350,GENERIC PE ONLY,HMDB09093 +302,,PE 36:5,C00350,GENERIC PE ONLY, +303,,PE 37:4,C00350,GENERIC PE ONLY, +304,,PE 37:5,C00350,GENERIC PE ONLY, +305,,PE 38:1,C00350,GENERIC PE ONLY, +306,,PE 38:2,C00350,GENERIC PE ONLY, +83,1-stearoyl-2-arachidonoyl-GPE (18:0/20:4),PE 38:4,C00350,GENERIC PE ONLY,HMDB09003 +87,1-oleoyl-2-arachidonoyl-GPE (18:1/20:4)*,PE 38:5,C00350,GENERIC PE ONLY,HMDB09069 +80,1-palmitoyl-2-docosahexaenoyl-GPE (16:0/22:6)*,PE 38:6,C00350,GENERIC PE ONLY,HMDB05324 +90,1-linoleoyl-2-arachidonoyl-GPE (18:2/20:4)*,PE 38:6,C00350,GENERIC PE ONLY,HMDB09102 +307,,PE 40:2,C00350,GENERIC PE ONLY, +84,1-stearoyl-2-docosahexaenoyl-GPE (18:0/22:6)*,PE 40:6,C00350,GENERIC PE ONLY,HMDB05334 +88,1-oleoyl-2-docosahexaenoyl-GPE (18:1/22:6)*,PE 40:7,C00350,GENERIC PE ONLY, +308,,PEO 32:1,C04756,GENERIC ETHANOLAMINE PLASMALOGEN, +309,,PEO 32:2,C04756,GENERIC ETHANOLAMINE PLASMALOGEN, +133,1-(1-enyl-palmitoyl)-2-oleoyl-GPE (P-16:0/18:1)*,PEO 34:1,C04756,GENERIC ETHANOLAMINE PLASMALOGEN,HMDB11342 +134,1-(1-enyl-palmitoyl)-2-linoleoyl-GPE (P-16:0/18:2)*,PEO 34:2,C04756,GENERIC ETHANOLAMINE PLASMALOGEN,HMDB11343 +310,,PEO 35:2,C04756,GENERIC ETHANOLAMINE PLASMALOGEN, +139,1-(1-enyl-stearoyl)-2-oleoyl-GPE (P-18:0/18:1),PEO 36:1,C04756,GENERIC ETHANOLAMINE PLASMALOGEN,HMDB11375 +311,,PEO 36:2,C04756,GENERIC ETHANOLAMINE PLASMALOGEN, +312,,PEO 36:3,C04756,GENERIC ETHANOLAMINE PLASMALOGEN, +137,1-(1-enyl-palmitoyl)-2-arachidonoyl-GPE (P-16:0/20:4)*,PEO 36:4,C04756,GENERIC ETHANOLAMINE PLASMALOGEN,HMDB11352 +313,,PEO 36:5,C04756,GENERIC ETHANOLAMINE PLASMALOGEN, +314,,PEO 38:2,C04756,GENERIC ETHANOLAMINE PLASMALOGEN, +315,,PEO 38:3,C04756,GENERIC ETHANOLAMINE PLASMALOGEN, +142,1-(1-enyl-stearoyl)-2-arachidonoyl-GPE (P-18:0/20:4)*,PEO 38:4,C04756,GENERIC ETHANOLAMINE PLASMALOGEN,HMDB05779 +316,,PEO 38:5,C04756,GENERIC ETHANOLAMINE PLASMALOGEN, +317,,PEO 40:3,C04756,GENERIC ETHANOLAMINE PLASMALOGEN, +318,,PEO 40:5,C04756,GENERIC ETHANOLAMINE PLASMALOGEN, +319,,PEO 40:6,C04756,GENERIC ETHANOLAMINE PLASMALOGEN, +320,,PEO 40:7,C04756,GENERIC ETHANOLAMINE PLASMALOGEN, +321,,PEO 42:5,C04756,GENERIC ETHANOLAMINE PLASMALOGEN, +322,,PEO 42:6,C04756,GENERIC ETHANOLAMINE PLASMALOGEN, +323,,PEO 42:7,C04756,GENERIC ETHANOLAMINE PLASMALOGEN, +95,"1,2-dipalmitoyl-GPG (16:0/16:0)",PG 32:0,C00344 ,GENERIC PG ONLY,HMDB10570 +96,1-palmitoyl-2-palmitoleoyl-GPG (16:0/16:1)*,PG 32:1,C00344 ,GENERIC PG ONLY, +97,1-palmitoyl-2-oleoyl-GPG (16:0/18:1),PG 34:1,C00344 ,GENERIC PG ONLY, +98,1-palmitoyl-2-linoleoyl-GPG (16:0/18:2),PG 34:2,C00344 ,GENERIC PG ONLY,HMDB10575 +324,,PG 34:3,C00344 ,GENERIC PG ONLY, +325,,PG 35:1,C00344 ,GENERIC PG ONLY, +326,,PG 35:2,C00344 ,GENERIC PG ONLY, +327,,PG 35:3,C00344 ,GENERIC PG ONLY, +328,,PG 36:1,C00344 ,GENERIC PG ONLY, +99,1-stearoyl-2-linoleoyl-GPG (18:0/18:2)*,PG 36:2,C00344 ,GENERIC PG ONLY, +100,"1,2-dioleoyl-GPG (18:1/18:1)",PG 36:2,C00344 ,GENERIC PG ONLY, +329,,PG 36:3,C00344 ,GENERIC PG ONLY, +330,,PG 36:4,C00344 ,GENERIC PG ONLY, +331,,PG 36:5,C00344 ,GENERIC PG ONLY, +332,,PG 37:5,C00344 ,GENERIC PG ONLY, +333,,PG 38:2,C00344 ,GENERIC PG ONLY, +334,,PG 38:4,C00344 ,GENERIC PG ONLY, +335,,PG 38:5,C00344 ,GENERIC PG ONLY, +336,,PG 38:6,C00344 ,GENERIC PG ONLY, +337,,PI 34:0,,, +338,,PI 34:1,,, +101,1-palmitoyl-2-linoleoyl-GPI (16:0/18:2),PI 34:2,,,HMDB09784 +339,,PI 34:3,,, +340,,PI 35:0,,, +341,,PI 36:1,,, +342,,PI 36:2,,, +102,1-palmitoyl-2-arachidonoyl-GPI (16:0/20:4)*,PI 36:4,,,HMDB09789 +343,,PI 36:5,,, +344,,PI 37:4,,, +345,,PI 38:2,,, +103,1-stearoyl-2-arachidonoyl-GPI (18:0/20:4),PI 38:4,,,HMDB09815 +104,1-oleoyl-2-arachidonoyl-GPI (18:1/20:4) *,PI 38:5,,,HMDB09844 +346,,PI 38:6,,, +347,,PI 39:4,,, +348,,PI 40:5,,, +349,,PI 40:6,,, +350,,PS 32:0,C02737,GENERIC PS ONLY, +351,,PS 32:1,C02737,GENERIC PS ONLY, +352,,PS 34:0,C02737,GENERIC PS ONLY, +91,1-palmitoyl-2-oleoyl-GPS (16:0/18:1),PS 34:1,C13880,FROM METABOLON,HMDB12357 +92,1-palmitoyl-2-linoleoyl-GPS (16:0/18:2),PS 34:2,C02737,GENERIC PS ONLY,HMDB12358 +353,,PS 35:0,C02737,GENERIC PS ONLY, +354,,PS 36:0,C02737,GENERIC PS ONLY, +93,1-stearoyl-2-oleoyl-GPS (18:0/18:1),PS 36:1,C02737,GENERIC PS ONLY,HMDB10163 +355,,PS 36:3,C02737,GENERIC PS ONLY, +356,,PS 36:4,C02737,GENERIC PS ONLY, +357,,PS 37:0,C02737,GENERIC PS ONLY, +358,,PS 37:1,C02737,GENERIC PS ONLY, +359,,PS 38:0,C02737,GENERIC PS ONLY, +360,,PS 38:1,C02737,GENERIC PS ONLY, +361,,PS 38:2,C02737,GENERIC PS ONLY, +362,,PS 38:3,C02737,GENERIC PS ONLY, +94,1-stearoyl-2-arachidonoyl-GPS (18:0/20:4),PS 38:4,C02737,GENERIC PS ONLY,HMDB12383 +363,,PS 38:6,C02737,GENERIC PS ONLY, +364,,PS 39:1,C02737,GENERIC PS ONLY, +365,,PS 39:3,C02737,GENERIC PS ONLY, +366,,PS 40:0,C02737,GENERIC PS ONLY, +367,,PS 40:1,C02737,GENERIC PS ONLY, +368,,PS 40:2,C02737,GENERIC PS ONLY, +369,,PS 40:3,C02737,GENERIC PS ONLY, +370,,PS 40:4,C02737,GENERIC PS ONLY, +371,,PS 40:5,C02737,GENERIC PS ONLY, +372,,PS 40:6,C02737,GENERIC PS ONLY, +373,,PS 41:1,C02737,GENERIC PS ONLY, +374,,PS 41:2,C02737,GENERIC PS ONLY, +375,,PS 41:4,C02737,GENERIC PS ONLY, +376,,PS 41:6,C02737,GENERIC PS ONLY, +377,,PS 42:1,C02737,GENERIC PS ONLY, +378,,PS 42:3,C02737,GENERIC PS ONLY, +379,,PS 42:4,C02737,GENERIC PS ONLY, +380,,PS 42:5,C02737,GENERIC PS ONLY, +381,,SE 43:4,C02737,GENERIC PS ONLY, +382,,SE 44:4,C02737,GENERIC PS ONLY, +383,,SE 45:4,C02737,GENERIC PS ONLY, +384,,SE 47:4,C02737,GENERIC PS ONLY, +214,"sphingomyelin (d17:1/14:0, d16:1/15:0)*",SM 31:1;0,C00550 ,GENERIC SM, +215,"sphingomyelin (d18:1/14:0, d16:1/16:0)*",SM 32:1;0,C00550 ,GENERIC SM,HMDB12097 +216,"sphingomyelin (d18:2/14:0, d18:1/14:1)*",SM 32:2;0,C00550 ,GENERIC SM, +217,"sphingomyelin (d17:1/16:0, d18:1/15:0, d16:1/17:0)*",SM 33:1;0,C00550 ,GENERIC SM, +206,palmitoyl sphingomyelin (d18:1/16:0),SM 34:1;0,C00550 ,GENERIC SM, +218,"sphingomyelin (d18:2/16:0, d18:1/16:1)*",SM 34:2;0,C00550 ,GENERIC SM, +385,,SM 35:1;0,C00550 ,GENERIC SM, +204,"sphingomyelin (d18:0/18:0, d19:0/17:0)*",SM 36:0;0,C00550 ,GENERIC SM,HMDB12087 +207,stearoyl sphingomyelin (d18:1/18:0),SM 36:1;0,C00550,FROM METABOLON,HMDB01348 +219,"sphingomyelin (d18:1/18:1, d18:2/18:0)",SM 36:2;0,C00550 ,GENERIC SM,HMDB12101 +211,sphingomyelin (d18:2/18:1)*,SM 36:3;0,C00550 ,GENERIC SM, +220,"sphingomyelin (d18:1/19:0, d19:1/18:0)*",SM 37:1;0,C00550 ,GENERIC SM, +205,"sphingomyelin (d18:0/20:0, d16:0/22:0)*",SM 38:0;0,C00550 ,GENERIC SM, +221,"sphingomyelin (d18:1/20:0, d16:1/22:0)*",SM 38:1;0,C00550 ,GENERIC SM,HMDB12102 +222,"sphingomyelin (d18:1/20:1, d18:2/20:0)*",SM 38:2;0,C00550 ,GENERIC SM, +223,"sphingomyelin (d18:1/21:0, d17:1/22:0, d16:1/23:0)*",SM 39:1;0,C00550 ,GENERIC SM, +224,"sphingomyelin (d18:2/21:0, d16:2/23:0)*",SM 39:2;0,C00550 ,GENERIC SM, +208,behenoyl sphingomyelin (d18:1/22:0)*,SM 40:1;0,C00550 ,GENERIC SM,HMDB12103 +225,"sphingomyelin (d18:1/22:1, d18:2/22:0, d16:1/24:1)*",SM 40:2;0,C00550 ,GENERIC SM,HMDB12104 +226,"sphingomyelin (d18:1/22:2, d18:2/22:1, d16:1/24:2)*",SM 40:3;0,C00550 ,GENERIC SM, +209,tricosanoyl sphingomyelin (d18:1/23:0)*,SM 41:1;0,C00550 ,GENERIC SM,HMDB12105 +227,"sphingomyelin (d18:2/23:0, d18:1/23:1, d17:1/24:1)*",SM 41:2;0,C00550 ,GENERIC SM, +212,sphingomyelin (d18:2/23:1)*,SM 41:3;0,C00550 ,GENERIC SM, +210,lignoceroyl sphingomyelin (d18:1/24:0),SM 42:1;0,C00550 ,GENERIC SM, +386,,SM 42:1;1,C00550 ,GENERIC SM, +228,"sphingomyelin (d18:1/24:1, d18:2/24:0)*",SM 42:2;0,C00550 ,GENERIC SM,HMDB12107 +229,"sphingomyelin (d18:2/24:1, d18:1/24:2)*",SM 42:3;0,C00550 ,GENERIC SM, +213,sphingomyelin (d18:2/24:2)*,SM 42:4;0,C00550 ,GENERIC SM, +387,,SM 44:2;0,C00550 ,GENERIC SM, +388,,TAG 54:2, C00422,GENERIC TAG ONLY, +389,,TAG 54:4, C00422,GENERIC TAG ONLY, +390,,TAG 54:5, C00422,GENERIC TAG ONLY, +391,,TAG 55:5, C00422,GENERIC TAG ONLY, +392,,TAG 56:5, C00422,GENERIC TAG ONLY, +393,,TAG 56:6, C00422,GENERIC TAG ONLY, +394,,TAG 56:7, C00422,GENERIC TAG ONLY, +395,,TAG 56:8, C00422,GENERIC TAG ONLY, +396,,TAG 56:9, C00422,GENERIC TAG ONLY, +397,,TAG 58:4, C00422,GENERIC TAG ONLY, +398,,TAG 58:5, C00422,GENERIC TAG ONLY, +399,,TAG 58:6, C00422,GENERIC TAG ONLY, +400,,TAG 58:7, C00422,GENERIC TAG ONLY, +401,,TAG 58:8, C00422,GENERIC TAG ONLY, +402,,TAG 60:4, C00422,GENERIC TAG ONLY, +403,,TAG 60:5, C00422,GENERIC TAG ONLY, +404,,TAG 60:8, C00422,GENERIC TAG ONLY, diff --git a/INFO/15038_NA_NA_NA_NA_SelectedSampleListSysTox.xlsx b/INFO/15038_NA_NA_NA_NA_SelectedSampleListSysTox.xlsx new file mode 100644 index 0000000..35b23fe Binary files /dev/null and b/INFO/15038_NA_NA_NA_NA_SelectedSampleListSysTox.xlsx differ diff --git a/INFO/S186400_NA_LUNG-L_NA_NA_15038LipidomicsSliceTissue-SampleMetaData.xlsx b/INFO/S186400_NA_LUNG-L_NA_NA_15038LipidomicsSliceTissue-SampleMetaData.xlsx new file mode 100644 index 0000000..7edc230 Binary files /dev/null and b/INFO/S186400_NA_LUNG-L_NA_NA_15038LipidomicsSliceTissue-SampleMetaData.xlsx differ diff --git a/INFO/S186500_NA_LUNG-L_ITRAQ_NA_15038ProteomicsSliceTissue-SampleMetaData.xlsx b/INFO/S186500_NA_LUNG-L_ITRAQ_NA_15038ProteomicsSliceTissue-SampleMetaData.xlsx new file mode 100644 index 0000000..e6d8ce2 Binary files /dev/null and b/INFO/S186500_NA_LUNG-L_ITRAQ_NA_15038ProteomicsSliceTissue-SampleMetaData.xlsx differ diff --git a/INFO/report.latex b/INFO/report.latex new file mode 100644 index 0000000..5637ffa --- /dev/null +++ b/INFO/report.latex @@ -0,0 +1,303 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Original default rstudio/pandoc latex file +%% modified from https://github.com/jhollist/manuscriptPackage +%% upated by @jhollist 09/15/2014 +%% inspired by @cboetting https://github.com/cboettig/template and +%% @rmflight blog posts: +%% http://rmflight.github.io/posts/2014/07/analyses_as_packages.html +%% http://rmflight.github.io/posts/2014/07/vignetteAnalysis.html). +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$} +\usepackage[T1]{fontenc} +\usepackage{lmodern} +\usepackage{amssymb,amsmath} +\usepackage{ifxetex,ifluatex} +\usepackage{fixltx2e} % provides \textsubscript + +\providecommand{\tightlist}{% + \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} + +% use upquote if available, for straight quotes in verbatim environments +\IfFileExists{upquote.sty}{\usepackage{upquote}}{} +\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex + \usepackage[utf8]{inputenc} +$if(euro)$ + \usepackage{eurosym} +$endif$ +\else % if luatex or xelatex + \ifxetex + \usepackage{mathspec} + \usepackage{xltxtra,xunicode} + \else + \usepackage{fontspec} + \fi + \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase} + \newcommand{\euro}{€} +$if(mainfont)$ + \setmainfont{$mainfont$} +$endif$ +$if(sansfont)$ + \setsansfont{$sansfont$} +$endif$ +$if(monofont)$ + \setmonofont[Mapping=tex-ansi]{$monofont$} +$endif$ +$if(mathfont)$ + \setmathfont(Digits,Latin,Greek){$mathfont$} +$endif$ +\fi +% use microtype if available +\IfFileExists{microtype.sty}{\usepackage{microtype}}{} +$if(geometry)$ +\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry} +$endif$ +$if(natbib)$ +\usepackage{natbib} +\bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$} +$endif$ +$if(biblatex)$ +\usepackage{biblatex} +$if(biblio-files)$ +\bibliography{$biblio-files$} +$endif$ +$endif$ +$if(listings)$ +\usepackage{listings} +$endif$ +$if(lhs)$ +\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{} +$endif$ +$if(highlighting-macros)$ +$highlighting-macros$ +$endif$ +$if(verbatim-in-note)$ +\usepackage{fancyvrb} +$endif$ +$if(tables)$ +\usepackage{longtable,booktabs} +$endif$ +$if(graphics)$ +\usepackage{graphicx} +% Redefine \includegraphics so that, unless explicit options are +% given, the image width will not exceed the width of the page. +% Images get their normal width if they fit onto the page, but +% are scaled down if they would overflow the margins. +\makeatletter +\def\ScaleIfNeeded{% + \ifdim\Gin@nat@width>\linewidth + \linewidth + \else + \Gin@nat@width + \fi +} +\makeatother +\let\Oldincludegraphics\includegraphics +{% + \catcode`\@=11\relax% + \gdef\includegraphics{\@ifnextchar[{\Oldincludegraphics}{\Oldincludegraphics[width=\ScaleIfNeeded]}}% +}% +$endif$ +\ifxetex + \usepackage[setpagesize=false, % page size defined by xetex + unicode=false, % unicode breaks when used with xetex + xetex]{hyperref} +\else + \usepackage[unicode=true]{hyperref} +\fi +\hypersetup{breaklinks=true, + bookmarks=true, + pdfauthor={$author-meta$}, + pdftitle={$title-meta$}, + colorlinks=true, + citecolor=$if(citecolor)$$citecolor$$else$blue$endif$, + urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$, + linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$, + pdfborder={0 0 0}} +\urlstyle{same} % don't use monospace font for urls +$if(links-as-notes)$ +% Make links footnotes instead of hotlinks: +\renewcommand{\href}[2]{#2\footnote{\url{#1}}} +$endif$ +$if(strikeout)$ +\usepackage[normalem]{ulem} +% avoid problems with \sout in headers with hyperref: +\pdfstringdefDisableCommands{\renewcommand{\sout}{}} +$endif$ +\setlength{\parindent}{0pt} +\setlength{\parskip}{6pt plus 2pt minus 1pt} +\setlength{\emergencystretch}{3em} % prevent overfull lines +$if(numbersections)$ +\setcounter{secnumdepth}{5} +$else$ +\setcounter{secnumdepth}{0} +$endif$ +$if(verbatim-in-note)$ +\VerbatimFootnotes % allows verbatim text in footnotes +$endif$ +$if(lang)$ +\ifxetex + \usepackage{polyglossia} + \setmainlanguage{$mainlang$} +\else + \usepackage[$lang$]{babel} +\fi +$endif$ + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%Changes borrowed from @cboettig, added by @jhollist +% A modified page layout +\textwidth 6.75in +\oddsidemargin -0.15in +\evensidemargin -0.15in +\textheight 9in +\topmargin -0.5in +\usepackage{lineno} % add +$if(linenumbers)$ + \linenumbers % turns line numbering on +$endif$ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%Packages and layout changes by @jhollist 09/15/2014 +\usepackage{ragged2e} +\usepackage[font=$capsize$]{caption} +$if(spacing)$ + \usepackage[$spacing$]{setspace} +$endif$ +\usepackage{parskip} +\usepackage{fancyhdr} +\pagestyle{fancy} +\fancyhf{} +\renewcommand{\headrulewidth}{0pt} +$if(footerdate)$ + \rfoot{\today} +$endif$ +\lfoot{\thepage} +%%Changed default abstract width and added lines +\renewenvironment{abstract}{ + \hfill\begin{minipage}{1\textwidth} + \rule{\textwidth}{1pt}\vspace{5pt} + \normalsize + \begin{justify} + \bfseries\abstractname\vspace{5pt} + \end{justify}} + {\par\noindent\rule{\textwidth}{1pt}\end{minipage} +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +$if(title)$ +\title{$title$} +$endif$ +$if(subtitle)$ +\subtitle{$subtitle$} +$endif$ +\author{ +$for(author)$ +$if(author.name)$ +$author.name$ +$else$ +$author$ +$endif$ +$endfor$ +} +\date{$date$} +$for(header-includes)$ +$header-includes$ +$endfor$ + +\begin{document} +%%Edited by @jhollist 09/15/2014 +%%Adds title from YAML +%\begin{singlespace} +$if(title)$ +\begin{center} +\huge $title$ +\end{center} +$endif$ +%%Adds Author, correspond email asterisk, and affilnum from YAML +\begin{center} +\large +$for(author)$ +$if(author.name)$ +$author.name$$if(author.affilnum)$$if(author.email)$ \textsuperscript{*}$endif$ \textsuperscript{$author.affilnum$} $endif$ +$else$ +$author$ +$endif$ +$endfor$ +\end{center} +%%Adds affiliations from YAML +\begin{justify} +\footnotesize \emph{ +$for(affiliation)$ +\\* +\textsuperscript{$affiliation.affilnum$}$affiliation.affil$\\* +$endfor$ +} +%%Adds corresponding author email(s) from YAML +\newcounter{num} +\setcounter{num}{1} +\\[0.1cm] +\footnotesize \emph{ +$for(author)$ +$if(author.email)$ +\ifnum\value{num}=1% +\textsuperscript{*} corresponding author: +\fi +$author.email$ +\stepcounter{num} +$endif$ +$endfor$ +} +\end{justify} +%%Adds date from YAML +$if(date)$ +\begin{center} +\small \emph{$date$} \\ +\end{center} +$endif$ +\normalsize + +$if(abstract)$ +\begin{abstract} +$abstract$ +\end{abstract} +$endif$ +%\end{singlespace} + +$for(include-before)$ +$include-before$ + +$endfor$ +$if(toc)$ +{ +\hypersetup{linkcolor=black} +\setcounter{tocdepth}{$toc-depth$} +\tableofcontents +} +$endif$ + +$body$ + +$if(natbib)$ +$if(biblio-files)$ +$if(biblio-title)$ +$if(book-class)$ +\renewcommand\bibname{$biblio-title$} +$else$ +\renewcommand\refname{$biblio-title$} +$endif$ +$endif$ +\bibliography{$biblio-files$} + +$endif$ +$endif$ +$if(biblatex)$ +\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$ + +$endif$ +$for(include-after)$ +$include-after$ + +$endfor$ +\end{document} \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ecbc059 --- /dev/null +++ b/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. \ No newline at end of file diff --git a/Notices.txt b/Notices.txt new file mode 100644 index 0000000..472fcfb --- /dev/null +++ b/Notices.txt @@ -0,0 +1,4105 @@ + +Component Licenses: + +acepack 1.4.1 : (MIT License AND File License) +ape 5.2 : GNU General Public License v2.0 or later +assertthat 0.2.0 : GNU General Public License v3.0 only +backports 1.1.3 : GNU General Public License v2.0 only +base64enc 0.1-3 : (GNU General Public License v2.0 only OR GNU General Public License v3.0 only) +beeswarm 0.2.3 : Artistic License 2.0 +BH 1.66.0-1 : Boost Software License 1.0 +bindr 0.1.1 : (MIT License AND File License) +bindrcpp 0.2.2 : (MIT License AND File License) +bit 1.1-14 : GNU General Public License v2.0 only +bit64 0.9-7 : GNU General Public License v2.0 only +bitops 1.0-6 : GNU General Public License v2.0 or later +blob 1.1.1 : GNU General Public License v3.0 only +callr 3.1.0 : (MIT License AND File License) +caTools 1.17.1.1 : GNU General Public License v3.0 only +cellranger 1.1.0 : (MIT License AND File License) +checkmate 1.8.5 : (BSD 3-clause "New" or "Revised" License AND File License) +cli 1.0.1 : (MIT License AND File License) +cluster 2.0.7-1 : GNU General Public License v2.0 or later +codetools 0.2-15 : GNU General Public License v3.0 or later +colorspace 1.3-2 : (BSD 3-clause "New" or "Revised" License AND File License) +corpcor 1.6.9 : GNU General Public License v3.0 or later +corrplot 0.84 : GNU General Public License v3.0 or later +cowplot 0.9.3 : GNU General Public License v2.0 only +CRAN foreach 1.4.4 : Apache License 2.0 +crayon 1.3.4 : (MIT License AND File License) +curl 3.2 : (MIT License AND File License) +data.table 1.11.8 : (File License OR Mozilla Public License 2.0) +DBI 1.0.0 : GNU Library General Public License v2 or later +DEoptimR 1.0-8 : GNU General Public License v2.0 or later +desc 1.2.0 : (MIT License AND File License) +devtools 2.0.1 : GNU General Public License v2.0 or later +digest 0.6.18 : GNU General Public License v2.0 or later +dnet 1.1.4 : GNU General Public License v2.0 only +doParallel 1.0.14 : GNU General Public License v2.0 only +dplyr 0.7.8 : (MIT License AND File License) +dynamicTreeCut 1.63-1 : GNU General Public License v2.0 or later +egg 0.4.2 : GNU General Public License v3.0 only +ellipse 0.4.1 : GNU General Public License v2.0 or later +evaluate 0.12 : (MIT License AND File License) +fastcluster 1.1.25 : (GNU General Public License v2.0 only OR BSD 2-clause FreeBSD License OR File License) +fastmatch 1.1-0 : GNU General Public License v2.0 only +fit.models 0.5-14 : GNU General Public License v3.0 or later +foreign 0.8-71 : GNU General Public License v2.0 or later +Formula 1.2-3 : (GNU General Public License v2.0 only OR GNU General Public License v3.0 only) +fs 1.2.6 : GNU General Public License v3.0 only +GGally 1.4.0 : GNU General Public License v2.0 or later +ggbeeswarm 0.6.0 : GNU General Public License v2.0 or later +ggplot2 3.1.0 : (GNU General Public License v2.0 only OR File License) +ggpubr 0.2 : GNU General Public License v2.0 only +ggrepel 0.8.0 : (File License OR GNU General Public License v3.0 only) +glue 1.3.0 : (MIT License AND File License) +gplots 3.0.1 : GNU General Public License v2.0 only +gridExtra 2.3 : GNU General Public License v2.0 or later +gtable 0.2.0 : GNU General Public License v2.0 only +gtools 3.8.1 : GNU General Public License v2.0 only +h5py 2.9.0 : BSD 3-clause "New" or "Revised" License +hexbin 1.27.2 : GNU General Public License v2.0 only +highr 0.7 : GNU General Public License v3.0 or later +Hmisc 4.1-1 : GNU General Public License v2.0 or later +hms 0.4.2 : GNU General Public License v3.0 only +htmlTable 1.12 : GNU General Public License v3.0 or later +htmltools 0.3.6 : GNU General Public License v2.0 or later +htmlwidgets 1.3 : (MIT License AND File License) +httr 1.4.0 : (MIT License AND File License) +igraph library 1.2.2 : GNU General Public License v2.0 or later +iterators 1.0.10 : Apache License 2.0 +JavaCPP Presets for NumPy 1.16.2-1.5 : (Apache License 2.0 AND GNU General Public License v2.0 w/Classpath exception AND GNU General Public License v3.0 or later) +joblib 0.13.1 : BSD 3-clause "New" or "Revised" License +jsonlite 1.6 : (MIT License AND File License) +KernSmooth 2.23-15 : KernSmooth License +knitr 1.21 : GNU General Public License v3.0 or later +labeling 0.3 : MIT License +lattice 0.20-38 : GNU General Public License v2.0 or later +latticeExtra 0.6-28 : GNU General Public License v2.0 or later +lazyeval 0.2.1 : GNU General Public License v3.0 only +magrittr 1.5 : (MIT License AND File License) +MASS 7.3-51.1 : (GNU General Public License v2.0 only OR GNU General Public License v3.0 only) +Matrix 1.2-15 : (GNU General Public License v2.0 only OR GNU General Public License v3.0 only) +matrixStats 0.54.0 : Artistic License 2.0 +memoise 1.1.0 : (MIT License AND File License) +munsell 0.5.0 : (MIT License AND File License) +mvtnorm 1.0-8 : GNU General Public License v2.0 only +nlme 3.1-137 : (GNU General Public License v2.0 or later) +nnet 7.3-12 : (GNU General Public License v2.0 only OR GNU General Public License v3.0 only) +NumPy 1.14.0 : BSD 3-clause "New" or "Revised" License +numpy-base 1.16.0 : NumPy License +numpy-base 1.16.2 : NumPy License +openxlsx 4.1.0 : (MIT License AND File License) +otj-pg-embedded 0.13.0 : Apache License 2.0 +pandas 0.24.1 : BSD 3-clause "New" or "Revised" License +pcaPP 1.9-73 : GNU General Public License v3.0 or later +pillar 1.3.1 : GNU General Public License v3.0 only +pip 19.1.1 : MIT License +pkgbuild 1.0.2 : GNU General Public License v3.0 only +pkgconfig 2.0.2 : (MIT License AND File License) +pkgload 1.0.2 : GNU General Public License v3.0 only +plotrix 3.7-4 : GNU General Public License v2.0 or later +plyr 1.8.4 : (MIT License AND File License) +prettyunits 1.0.2 : (MIT License AND File License) +processx 3.2.1 : (MIT License AND File License) +ps 1.2.1 : (BSD 3-clause "New" or "Revised" License AND File License) +purrr 0.2.5 : (File License OR GNU General Public License v3.0 only) +py-numpy-dev 1.16.2 : BSD 3-clause "New" or "Revised" License +py-numpy-dev 1.16.4 : BSD 3-clause "New" or "Revised" License +python-dateutil 2.8.0 : BSD 3-clause "New" or "Revised" License +PyTZ - Python Time Zone Library 2018.9 : MIT License +PyTZ - Python Time Zone Library 2019.1 : MIT License +r-gdata 2.18.0 : GNU General Public License v2.0 only +R6 2.3.0 : (MIT License AND File License) +rARPACK 0.11-0 : (BSD 3-clause "New" or "Revised" License AND File License) +rcolorbrewer 1.1-2 : Apache License 2.0 +Rcpp 1.0.0 : GNU General Public License v2.0 or later +RCurl 1.95-4.11 : BSD 3-clause "New" or "Revised" License +readr 1.3.0 : (GNU General Public License v2.0 or later OR File License) +readxl 1.1.0 : GNU General Public License v3.0 or later +relations 0.6-8 : GNU General Public License v2.0 only +remotes 2.0.2 : GNU General Public License v2.0 or later +reshape 0.8.8 : (MIT License AND File License) +reshape2 1.4.3 : (MIT License AND File License) +reticulate 1.10 : Apache License 2.0 +rJava 0.9-10 : GNU General Public License v2.0 only +rjson 0.2.20 : GNU General Public License v2.0 only +rlang 0.3.0.1 : GNU General Public License v3.0 only +rmarkdown 1.11 : GNU General Public License v3.0 only +robust 0.4-18 : GNU General Public License v2.0 only +robustbase 0.93-3 : GNU General Public License v2.0 or later +rpart 4.1-13 : (GNU General Public License v2.0 only OR GNU General Public License v3.0 only) +rprojroot 1.3-2 : GNU General Public License v3.0 only +rrcov 1.4-7 : GNU General Public License v2.0 or later +RSpectra 0.13-1 : Mozilla Public License 2.0 +RSQLite 2.1.1 : GNU Library General Public License v2 or later +rstudioapi 0.8 : (MIT License AND File License) +scales 1.0.0 : (MIT License AND File License) +scikit-learn 0.21.1 : BSD 3-clause "New" or "Revised" License +SciPy: Scientific Library for Python 1.2.1 : BSD 3-clause "New" or "Revised" License +SciPy: Scientific Library for Python 1.3.0rc2 : BSD 3-clause "New" or "Revised" License +sessioninfo 1.1.1 : GNU General Public License v2.0 only +sets 1.0-18 : GNU General Public License v2.0 only +setuptools 40.7.3 : MIT License +slam 0.1-43 : GNU General Public License v2.0 only +SparseM 1.77 : GNU General Public License v2.0 or later +stringi 1.2.4 : File License +stringr 1.3.1 : (GNU General Public License v2.0 only OR File License) +survival 2.43-3 : GNU Library General Public License v2 or later +test-catkin-virtualenv-py3 0.1.3 : GNU General Public License v3.0 or later +testthat 2.0.1 : (MIT License AND File License) +tibble 1.4.2 : (MIT License AND File License) +tidyr 0.8.2 : (MIT License AND File License) +tidyselect 0.2.5 : GNU General Public License v3.0 only +usethis 1.4.0 : GNU General Public License v3.0 only +vipor 0.4.5 : GNU General Public License v2.0 or later +vis.js 4.20.1 : (Apache License 2.0 OR MIT License) +visNetwork 2.0.5 : (MIT License AND File License) +WGCNA 1.66 : GNU General Public License v2.0 or later +whisker 0.3-2 : GNU General Public License v3.0 only +withr 2.1.2 : GNU General Public License v2.0 or later +xfun 0.4 : (MIT License AND File License) +xlsx 0.6.1 : GNU General Public License v3.0 only +xlsxjars 0.6.1 : GNU General Public License v3.0 only +yaml 2.2.0 : (BSD 3-clause "New" or "Revised" License AND File License) +zip 1.0.0 : Creative Commons Zero v1.0 Universal + +Licenses: + +Apache License 2.0 +(CRAN foreach 1.4.4, iterators 1.0.10, JavaCPP Presets for NumPy 1.16.2-1.5, otj-pg-embedded 0.13.0, rcolorbrewer 1.1-2, reticulate 1.10, vis.js 4.20.1) + +Apache License +Version 2.0, January 2004 +========================= + + +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that entity. +For the purposes of this definition, "control" means (i) the power, direct or +indirect, to cause the direction or management of such entity, whether by +contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions +granted by this License. + +"Source" form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + +"Object" form shall mean any form resulting from mechanical transformation or +translation of a Source form, including but not limited to compiled object code, +generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made +available under the License, as indicated by a copyright notice that is included +in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is +based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by +name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative Works +thereof, that is intentionally submitted to Licensor for inclusion in the Work by +the copyright owner or by an individual or Legal Entity authorized to submit on +behalf of the copyright owner. For the purposes of this definition, "submitted" +means any form of electronic, verbal, or written communication sent to the +Licensor or its representatives, including but not limited to communication on +electronic mailing lists, source code control systems, and issue tracking systems +that are managed by, or on behalf of, the Licensor for the purpose of discussing +and improving the Work, but excluding communication that is conspicuously marked +or otherwise designated in writing by the copyright owner as "Not a +Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of +whom a Contribution has been received by Licensor and subsequently incorporated +within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this +License, each Contributor hereby grants to You a perpetual, worldwide, +non-exclusive, no-charge, royalty-free, irrevocable copyright license to +reproduce, prepare Derivative Works of, publicly display, publicly perform, +sublicense, and distribute the Work and such Derivative Works in Source or Object +form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, +each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) patent +license to make, have made, use, offer to sell, sell, import, and otherwise +transfer the Work, where such license applies only to those patent claims +licensable by such Contributor that are necessarily infringed by their +Contribution(s) alone or by combination of their Contribution(s) with the Work to +which such Contribution(s) was submitted. If You institute patent litigation +against any entity (including a cross-claim or counterclaim in a lawsuit) +alleging that the Work or a Contribution incorporated within the Work constitutes +direct or contributory patent infringement, then any patent licenses granted to +You under this License for that Work shall terminate as of the date such +litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or +Derivative Works thereof in any medium, with or without modifications, and in +Source or Object form, provided that You meet the following conditions: + + a. You must give any other recipients of the Work or Derivative Works a copy of + this License; and + + b. You must cause any modified files to carry prominent notices stating that + You changed the files; and + + c. You must retain, in the Source form of any Derivative Works that You + distribute, all copyright, patent, trademark, and attribution notices from + the Source form of the Work, excluding those notices that do not pertain to + any part of the Derivative Works; and + + d. If the Work includes a "NOTICE" text file as part of its distribution, then + any Derivative Works that You distribute must include a readable copy of the + attribution notices contained within such NOTICE file, excluding those + notices that do not pertain to any part of the Derivative Works, in at least + one of the following places: within a NOTICE text file distributed as part of + the Derivative Works; within the Source form or documentation, if provided + along with the Derivative Works; or, within a display generated by the + Derivative Works, if and wherever such third-party notices normally appear. + The contents of the NOTICE file are for informational purposes only and do + not modify the License. You may add Your own attribution notices within + Derivative Works that You distribute, alongside or as an addendum to the + NOTICE text from the Work, provided that such additional attribution notices + cannot be construed as modifying the License. + +You may add Your own copyright statement to Your modifications and may provide +additional or different license terms and conditions for use, reproduction, or +distribution of Your modifications, or for any such Derivative Works as a whole, +provided Your use, reproduction, and distribution of the Work otherwise complies +with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any +Contribution intentionally submitted for inclusion in the Work by You to the +Licensor shall be under the terms and conditions of this License, without any +additional terms or conditions. Notwithstanding the above, nothing herein shall +supersede or modify the terms of any separate license agreement you may have +executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, +trademarks, service marks, or product names of the Licensor, except as required +for reasonable and customary use in describing the origin of the Work and +reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in +writing, Licensor provides the Work (and each Contributor provides its +Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +either express or implied, including, without limitation, any warranties or +conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +PARTICULAR PURPOSE. You are solely responsible for determining the +appropriateness of using or redistributing the Work and assume any risks +associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in +tort (including negligence), contract, or otherwise, unless required by +applicable law (such as deliberate and grossly negligent acts) or agreed to in +writing, shall any Contributor be liable to You for damages, including any +direct, indirect, special, incidental, or consequential damages of any character +arising as a result of this License or out of the use or inability to use the +Work (including but not limited to damages for loss of goodwill, work stoppage, +computer failure or malfunction, or any and all other commercial damages or +losses), even if such Contributor has been advised of the possibility of such +damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or +Derivative Works thereof, You may choose to offer, and charge a fee for, +acceptance of support, warranty, indemnity, or other liability obligations and/or +rights consistent with this License. However, in accepting such obligations, You +may act only on Your own behalf and on Your sole responsibility, not on behalf of +any other Contributor, and only if You agree to indemnify, defend, and hold each +Contributor harmless for any liability incurred by, or claims asserted against, +such Contributor by reason of your accepting any such warranty or additional +liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets "[]" replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also recommend +that a file or class name and description of purpose be included on the same +"printed page" as the copyright notice for easier identification within +third-party archives. + + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the specific language + governing permissions and limitations under the License. + +--- + +Artistic License 2.0 +(beeswarm 0.2.3, matrixStats 0.54.0) + +Artistic License 2.0 +==================== + +Copyright (c) 2000-2006, The Perl Foundation. + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + + +Preamble + +This license establishes the terms under which a given free software Package may +be copied, modified, distributed, and/or redistributed. The intent is that the +Copyright Holder maintains some artistic control over the development of that +Package while still keeping the Package available as open source and free +software. + +You are always permitted to make arrangements wholly outside of this license +directly with the Copyright Holder of a given Package. If the terms of this +license do not permit the full use that you propose to make of the Package, you +should contact the Copyright Holder and seek a different licensing arrangement. + + +Definitions + +"Copyright Holder" means the individual(s) or organization(s) named in the +copyright notice for the entire Package. + +"Contributor" means any party that has contributed code or other material to the +Package, in accordance with the Copyright Holder's procedures. + +"You" and "your" means any person who would like to copy, distribute, or modify +the Package. + +"Package" means the collection of files distributed by the Copyright Holder, and +derivatives of that collection and/or of those files. A given Package may consist +of either the Standard Version, or a Modified Version. + +"Distribute" means providing a copy of the Package or making it accessible to +anyone else, or in the case of a company or organization, to others outside of +your company or organization. + +"Distributor Fee" means any fee that you charge for Distributing this Package or +providing support for this Package to another party. It does not mean licensing +fees. + +"Standard Version" refers to the Package if it has not been modified, or has been +modified only in ways explicitly requested by the Copyright Holder. + +"Modified Version" means the Package, if it has been changed, and such changes +were not explicitly requested by the Copyright Holder. + +"Original License" means this Artistic License as Distributed with the Standard +Version of the Package, in its current version or as it may be modified by The +Perl Foundation in the future. + +"Source" form means the source code, documentation source, and configuration +files for the Package. + +"Compiled" form means the compiled bytecode, object code, binary, or any other +form resulting from mechanical transformation or translation of the Source form. + + +Permission for Use and Modification Without Distribution + +(1) You are permitted to use the Standard Version and create and use Modified +Versions for any purpose without restriction, provided that you do not Distribute +the Modified Version. + + +Permissions for Redistribution of the Standard Version + +(2) You may Distribute verbatim copies of the Source form of the Standard Version +of this Package in any medium without restriction, either gratis or for a +Distributor Fee, provided that you duplicate all of the original copyright +notices and associated disclaimers. At your discretion, such verbatim copies may +or may not include a Compiled form of the Package. + +(3) You may apply any bug fixes, portability changes, and other modifications +made available from the Copyright Holder. The resulting Package will still be +considered the Standard Version, and as such will be subject to the Original +License. + + +Distribution of Modified Versions of the Package as Source + +(4) You may Distribute your Modified Version as Source (either gratis or for a +Distributor Fee, and with or without a Compiled form of the Modified Version) +provided that you clearly document how it differs from the Standard Version, +including, but not limited to, documenting any non-standard features, +executables, or modules, and provided that you do at least ONE of the following: + +(a) make the Modified Version available to the Copyright Holder of the Standard +Version, under the Original License, so that the Copyright Holder may include +your modifications in the Standard Version. +(b) ensure that installation of your Modified Version does not prevent the user +installing or running the Standard Version. In addition, the Modified Version +must bear a name that is different from the name of the Standard Version. +(c) allow anyone who receives a copy of the Modified Version to make the Source +form of the Modified Version available to others under +(i) the Original License or +(ii) a license that permits the licensee to freely copy, modify and redistribute +the Modified Version using the same licensing terms that apply to the copy that +the licensee received, and requires that the Source form of the Modified Version, +and of any works derived from it, be made freely available in that license fees +are prohibited but Distributor Fees are allowed. +Distribution of Compiled Forms of the Standard Version or Modified Versions +without the Source + +(5) You may Distribute Compiled forms of the Standard Version without the Source, +provided that you include complete instructions on how to get the Source of the +Standard Version. Such instructions must be valid at the time of your +distribution. If these instructions, at any time while you are carrying out such +distribution, become invalid, you must provide new instructions on demand or +cease further distribution. If you provide valid instructions or cease +distribution within thirty days after you become aware that the instructions are +invalid, then you do not forfeit any of your rights under this license. + +(6) You may Distribute a Modified Version in Compiled form without the Source, +provided that you comply with Section 4 with respect to the Source of the +Modified Version. + + +Aggregating or Linking the Package + +(7) You may aggregate the Package (either the Standard Version or Modified +Version) with other packages and Distribute the resulting aggregation provided +that you do not charge a licensing fee for the Package. Distributor Fees are +permitted, and licensing fees for other components in the aggregation are +permitted. The terms of this license apply to the use and Distribution of the +Standard or Modified Versions as included in the aggregation. + +(8) You are permitted to link Modified and Standard Versions with other works, to +embed the Package in a larger work of your own, or to build stand-alone binary or +bytecode versions of applications that include the Package, and Distribute the +result without restriction, provided the result does not expose a direct +interface to the Package. + + +Items That are Not Considered Part of a Modified Version + +(9) Works (including, but not limited to, modules and scripts) that merely extend +or make use of the Package, do not, by themselves, cause the Package to be a +Modified Version. In addition, such works are not considered parts of the Package +itself, and are not subject to the terms of this license. + + +General Provisions + +(10) Any use, modification, and distribution of the Standard or Modified Versions +is governed by this Artistic License. By using, modifying or distributing the +Package, you accept this license. Do not use, modify, or distribute the Package, +if you do not accept this license. + +(11) If your Modified Version has been derived from a Modified Version made by +someone other than you, you are nevertheless required to ensure that your +Modified Version complies with the requirements of this license. + +(12) This license does not grant you the right to use any trademark, service +mark, tradename, or logo of the Copyright Holder. + +(13) This license includes the non-exclusive, worldwide, free-of-charge patent +license to make, have made, use, offer to sell, sell, import and otherwise +transfer the Package with respect to any patent claims licensable by the +Copyright Holder that are necessarily infringed by the Package. If you institute +patent litigation (including a cross-claim or counterclaim) against any party +alleging that the Package constitutes direct or contributory patent infringement, +then this Artistic License to you shall terminate on the date that such +litigation is filed. + +(14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND +CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR +NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS +REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF +THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +--- + +Boost Software License 1.0 +(BH 1.66.0-1) + +Boost Software License - Version 1.0 +==================================== + + +August 17th, 2003 +----------------- + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by this +license (the "Software") to use, reproduce, display, distribute, execute, and +transmit the Software, and to prepare derivative works of the Software, and to +permit third-parties to whom the Software is furnished to do so, all subject to +the following: +The copyright notices in the Software and this entire statement, including the +above license grant, this restriction and the following disclaimer, must be +included in all copies of the Software, in whole or in part, and all derivative +works of the Software, unless such copies or derivative works are solely in the +form of machine-executable object code generated by a source language processor. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES +OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--- + +BSD 2-clause FreeBSD License +(fastcluster 1.1.25) + +The FreeBSD Copyright +===================== + +Copyright 1992-2012 The FreeBSD Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE FREEBSD PROJECT ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. + +--- + +BSD 3-clause "New" or "Revised" License +(yaml 2.2.0) + +============== + +Copyright (c) 2008-2016 Vanderbilt University +Copyright (c) 2016-2018 Vanderbilt University Medical Center + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + Neither the name of Vanderbilt University nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE + +--- + +BSD 3-clause "New" or "Revised" License +(NumPy 1.14.0) + +Copyright (c) 2006, Enthought, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Enthought, Inc. nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE + +--- + +BSD 3-clause "New" or "Revised" License +(checkmate 1.8.5, colorspace 1.3-2, h5py 2.9.0, joblib 0.13.1, pandas 0.24.1, ps 1.2.1, py-numpy-dev 1.16.2, py-numpy-dev 1.16.4, python-dateutil 2.8.0, rARPACK 0.11-0, RCurl 1.95-4.11, scikit-learn 0.21.1, SciPy: Scientific Library for Python 1.2.1, SciPy: Scientific Library for Python 1.3.0rc2) + +Copyright (c) , +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of the nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +--- + +Creative Commons Zero v1.0 Universal +(zip 1.0.0) + +Creative Commons CC0 1.0 Universal +================================== + + +Creative Commons Legal Code +--------------------------- + + +CC0 1.0 Universal +----------------- + +CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL +SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT +RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. +CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE +INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES +RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED +HEREUNDER. + + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator and +subsequent owner(s) (each and all, an "owner") of an original work of authorship +and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for the +purpose of contributing to a commons of creative, cultural and scientific works +("Commons") that the public can reliably and without fear of later claims of +infringement build upon, modify, incorporate in other works, reuse and +redistribute as freely as possible in any form whatsoever and for any purposes, +including without limitation commercial purposes. These owners may contribute to +the Commons to promote the ideal of a free culture and the further production of +creative, cultural and scientific works, or to gain reputation or greater +distribution for their Work in part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any expectation of +additional consideration or compensation, the person associating CC0 with a Work +(the "Affirmer"), to the extent that he or she is an owner of Copyright and +Related Rights in the Work, voluntarily elects to apply CC0 to the Work and +publicly distribute the Work under its terms, with knowledge of his or her +Copyright and Related Rights in the Work and the meaning and intended legal +effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be protected +by copyright and related or neighboring rights ("Copyright and Related Rights"). +Copyright and Related Rights include, but are not limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, communicate, + and translate a Work; + + ii. moral rights retained by the original author(s) and/or performer(s); + + iii. publicity and privacy rights pertaining to a person's image or likeness + depicted in a Work; + + iv. rights protecting against unfair competition in regards to a Work, subject + to the limitations in paragraph 4(a), below; + + v. rights protecting the extraction, dissemination, use and reuse of data in a + Work; + + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation thereof, + including any amended or successor version of such directive); and + + vii. other similar, equivalent or corresponding rights throughout the world + based on applicable law or treaty, and any national implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention of, +applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and +unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and +Related Rights and associated claims and causes of action, whether now known or +unknown (including existing as well as future claims and causes of action), in +the Work + + i. in all territories worldwide, + + ii. for the maximum duration provided by applicable law or treaty (including + future time extensions), + + iii. in any current or future medium and for any number of copies, and + + iv. for any purpose whatsoever, including without limitation commercial, + advertising or promotional purposes (the "Waiver"). + +Affirmer makes the Waiver for the benefit of each member of the public at large +and to the detriment of Affirmer's heirs and successors, fully intending that +such Waiver shall not be subject to revocation, rescission, cancellation, +termination, or any other legal or equitable action to disrupt the quiet +enjoyment of the Work by the public as contemplated by Affirmer's express +Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason be +judged legally invalid or ineffective under applicable law, then the Waiver shall +be preserved to the maximum extent permitted taking into account Affirmer's +express Statement of Purpose. In addition, to the extent the Waiver is so judged +Affirmer hereby grants to each affected person a royalty-free, non transferable, +non sublicensable, non exclusive, irrevocable and unconditional license to +exercise Affirmer's Copyright and Related Rights in the Work + + i. in all territories worldwide, + + ii. for the maximum duration provided by applicable law or treaty (including + future time extensions), + + iii. in any current or future medium and for any number of copies, and + + iv. for any purpose whatsoever, including without limitation commercial, + advertising or promotional purposes (the "License"). + +The License shall be deemed effective as of the date CC0 was applied by Affirmer +to the Work. Should any part of the License for any reason be judged legally +invalid or ineffective under applicable law, such partial invalidity or +ineffectiveness shall not invalidate the remainder of the License, and in such +case Affirmer hereby affirms that he or she will not + + i. exercise any of his or her remaining Copyright and Related Rights in the + Work or + + ii. assert any associated claims and causes of action with respect to the + Work, in either case contrary to Affirmer's express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + + b. Affirmer offers the Work as-is and makes no representations or warranties of + any kind concerning the Work, express, implied, statutory or otherwise, + including without limitation warranties of title, merchantability, fitness + for a particular purpose, non infringement, or the absence of latent or other + defects, accuracy, or the present or absence of errors, whether or not + discoverable, all to the greatest extent permissible under applicable law. + + c. Affirmer disclaims responsibility for clearing rights of other persons that + may apply to the Work or any use thereof, including without limitation any + person's Copyright and Related Rights in the Work. Further, Affirmer + disclaims responsibility for obtaining any necessary consents, permissions or + other rights required for any use of the Work. + + d. Affirmer understands and acknowledges that Creative Commons is not a party + to this document and has no duty or obligation with respect to this CC0 or + use of the Work. + +--- + +File License +(acepack 1.4.1, bindr 0.1.1, bindrcpp 0.2.2, callr 3.1.0, cellranger 1.1.0, checkmate 1.8.5, cli 1.0.1, colorspace 1.3-2, crayon 1.3.4, curl 3.2, data.table 1.11.8, desc 1.2.0, dplyr 0.7.8, evaluate 0.12, fastcluster 1.1.25, ggplot2 3.1.0, ggrepel 0.8.0, glue 1.3.0, htmlwidgets 1.3, httr 1.4.0, jsonlite 1.6, magrittr 1.5, memoise 1.1.0, munsell 0.5.0, openxlsx 4.1.0, pkgconfig 2.0.2, plyr 1.8.4, prettyunits 1.0.2, processx 3.2.1, ps 1.2.1, purrr 0.2.5, R6 2.3.0, rARPACK 0.11-0, readr 1.3.0, reshape 0.8.8, reshape2 1.4.3, rstudioapi 0.8, scales 1.0.0, stringi 1.2.4, stringr 1.3.1, testthat 2.0.1, tibble 1.4.2, tidyr 0.8.2, visNetwork 2.0.5, xfun 0.4, yaml 2.2.0) + +file License +============ + +See original source location of R package for contained license. + +--- + +GNU General Public License v2.0 only +(backports 1.1.3, base64enc 0.1-3, bit 1.1-14, bit64 0.9-7, cowplot 0.9.3, dnet 1.1.4, doParallel 1.0.14, fastcluster 1.1.25, fastmatch 1.1-0, Formula 1.2-3, ggplot2 3.1.0, ggpubr 0.2, gplots 3.0.1, gtable 0.2.0, gtools 3.8.1, hexbin 1.27.2, MASS 7.3-51.1, Matrix 1.2-15, mvtnorm 1.0-8, nnet 7.3-12, r-gdata 2.18.0, relations 0.6-8, rJava 0.9-10, rjson 0.2.20, robust 0.4-18, rpart 4.1-13, sessioninfo 1.1.1, sets 1.0-18, slam 0.1-43, stringr 1.3.1) + +The GNU General Public License (GPL) +==================================== + + +Version 2, June 1991 +-------------------- + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to share +and change it. By contrast, the GNU General Public License is intended to +guarantee your freedom to share and change free software--to make sure the +software is free for all its users. This General Public License applies to most +of the Free Software Foundation's software and to any other program whose authors +commit to using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to your +programs, too. + +When we speak of free software, we are referring to freedom, not price. Our +General Public Licenses are designed to make sure that you have the freedom to +distribute copies of free software (and charge for this service if you wish), +that you receive source code or can get it if you want it, that you can change +the software or use pieces of it in new free programs; and that you know you can +do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny +you these rights or to ask you to surrender the rights. These restrictions +translate to certain responsibilities for you if you distribute copies of the +software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for a +fee, you must give the recipients all the rights that you have. You must make +sure that they, too, receive or can get the source code. And you must show them +these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) offer +you this license which gives you legal permission to copy, distribute and/or +modify the software. + +Also, for each author's protection and ours, we want to make certain that +everyone understands that there is no warranty for this free software. If the +software is modified by someone else and passed on, we want its recipients to +know that what they have is not the original, so that any problems introduced by +others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We wish +to avoid the danger that redistributors of a free program will individually +obtain patent licenses, in effect making the program proprietary. To prevent +this, we have made it clear that any patent must be licensed for everyone's free +use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification +follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a notice +placed by the copyright holder saying it may be distributed under the terms of +this General Public License. The "Program", below, refers to any such program or +work, and a "work based on the Program" means either the Program or any +derivative work under copyright law: that is to say, a work containing the +Program or a portion of it, either verbatim or with modifications and/or +translated into another language. (Hereinafter, translation is included without +limitation in the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not covered by +this License; they are outside its scope. The act of running the Program is not +restricted, and the output from the Program is covered only if its contents +constitute a work based on the Program (independent of having been made by +running the Program). Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source code as +you receive it, in any medium, provided that you conspicuously and appropriately +publish on each copy an appropriate copyright notice and disclaimer of warranty; +keep intact all the notices that refer to this License and to the absence of any +warranty; and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may at +your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, thus +forming a work based on the Program, and copy and distribute such modifications +or work under the terms of Section 1 above, provided that you also meet all of +these conditions: + + a) You must cause the modified files to carry prominent notices stating + that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in whole or + in part contains or is derived from the Program or any part thereof, to be + licensed as a whole at no charge to all third parties under the terms of + this License. + + c) If the modified program normally reads commands interactively when run, + you must cause it, when started running for such interactive use in the + most ordinary way, to print or display an announcement including an + appropriate copyright notice and a notice that there is no warranty (or + else, saying that you provide a warranty) and that users may redistribute + the program under these conditions, and telling the user how to view a copy + of this License. (Exception: if the Program itself is interactive but does + not normally print such an announcement, your work based on the Program is + not required to print an announcement.) + +These requirements apply to the modified work as a whole. If identifiable +sections of that work are not derived from the Program, and can be reasonably +considered independent and separate works in themselves, then this License, and +its terms, do not apply to those sections when you distribute them as separate +works. But when you distribute the same sections as part of a whole which is a +work based on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the entire whole, +and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your rights +to work written entirely by you; rather, the intent is to exercise the right to +control the distribution of derivative or collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program with the +Program (or with a work based on the Program) on a volume of a storage or +distribution medium does not bring the other work under the scope of this +License. + +3. You may copy and distribute the Program (or a work based on it, under Section +2) in object code or executable form under the terms of Sections 1 and 2 above +provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable source + code, which must be distributed under the terms of Sections 1 and 2 above + on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three years, to + give any third party, for a charge no more than your cost of physically + performing source distribution, a complete machine-readable copy of the + corresponding source code, to be distributed under the terms of Sections 1 + and 2 above on a medium customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to + distribute corresponding source code. (This alternative is allowed only for + noncommercial distribution + +and only if you received the program in object code or executable form with such +an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for making +modifications to it. For an executable work, complete source code means all the +source code for all modules it contains, plus any associated interface definition +files, plus the scripts used to control compilation and installation of the +executable. However, as a special exception, the source code distributed need not +include anything that is normally distributed (in either source or binary form) +with the major components (compiler, kernel, and so on) of the operating system +on which the executable runs, unless that component itself accompanies the +executable. + +If distribution of executable or object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the source code +from the same place counts as distribution of the source code, even though third +parties are not compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except as +expressly provided under this License. Any attempt otherwise to copy, modify, +sublicense or distribute the Program is void, and will automatically terminate +your rights under this License. However, parties who have received copies, or +rights, from you under this License will not have their licenses terminated so +long as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed it. +However, nothing else grants you permission to modify or distribute the Program +or its derivative works. These actions are prohibited by law if you do not accept +this License. Therefore, by modifying or distributing the Program (or any work +based on the Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying the Program +or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), the +recipient automatically receives a license from the original licensor to copy, +distribute or modify the Program subject to these terms and conditions. You may +not impose any further restrictions on the recipients' exercise of the rights +granted herein. You are not responsible for enforcing compliance by third parties +to this License. + +7. If, as a consequence of a court judgment or allegation of patent infringement +or for any other reason (not limited to patent issues), conditions are imposed on +you (whether by court order, agreement or otherwise) that contradict the +conditions of this License, they do not excuse you from the conditions of this +License. If you cannot distribute so as to satisfy simultaneously your +obligations under this License and any other pertinent obligations, then as a +consequence you may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by all those +who receive copies directly or indirectly through you, then the only way you +could satisfy both it and this License would be to refrain entirely from +distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply and the +section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or +other property right claims or to contest validity of any such claims; this +section has the sole purpose of protecting the integrity of the free software +distribution system, which is implemented by public license practices. Many +people have made generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that system; it is +up to the author/donor to decide if he or she is willing to distribute software +through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a +consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain +countries either by patents or by copyrighted interfaces, the original copyright +holder who places the Program under this License may add an explicit geographical +distribution limitation excluding those countries, so that distribution is +permitted only in or among countries not thus excluded. In such case, this +License incorporates the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions of the +General Public License from time to time. Such new versions will be similar in +spirit to the present version, but may differ in detail to address new problems +or concerns. + +Each version is given a distinguishing version number. If the Program specifies a +version number of this License which applies to it and "any later version", you +have the option of following the terms and conditions either of that version or +of any later version published by the Free Software Foundation. If the Program +does not specify a version number of this License, you may choose any version +ever published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs +whose distribution conditions are different, write to the author to ask for +permission. For software which is copyrighted by the Free Software Foundation, +write to the Free Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status of all +derivatives of our free software and of promoting the sharing and reuse of +software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE +PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED +IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL +ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE +PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, +SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY +TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF +THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER +PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + +--- + +GNU General Public License v2.0 or later +(ape 5.2, bitops 1.0-6, cluster 2.0.7-1, DEoptimR 1.0-8, devtools 2.0.1, digest 0.6.18, dynamicTreeCut 1.63-1, ellipse 0.4.1, foreign 0.8-71, GGally 1.4.0, ggbeeswarm 0.6.0, gridExtra 2.3, Hmisc 4.1-1, htmltools 0.3.6, igraph library 1.2.2, lattice 0.20-38, latticeExtra 0.6-28, nlme 3.1-137, plotrix 3.7-4, Rcpp 1.0.0, readr 1.3.0, remotes 2.0.2, robustbase 0.93-3, rrcov 1.4-7, SparseM 1.77, vipor 0.4.5, WGCNA 1.66, withr 2.1.2) + +The GNU General Public License (GPL) +==================================== + + +Version 2, June 1991 +-------------------- + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +59 Temple Place, Suite 330, Boston, MA 02111-1307 USAEveryone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to share +and change it. By contrast, the GNU General Public License is intended to +guarantee your freedom to share and change free software--to make sure the +software is free for all its users. This General Public License applies to most +of the Free Software Foundation's software and to any other program whose authors +commit to using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to your +programs, too. + +When we speak of free software, we are referring to freedom, not price. Our +General Public Licenses are designed to make sure that you have the freedom to +distribute copies of free software (and charge for this service if you wish), +that you receive source code or can get it if you want it, that you can change +the software or use pieces of it in new free programs; and that you know you can +do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny +you these rights or to ask you to surrender the rights. These restrictions +translate to certain responsibilities for you if you distribute copies of the +software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for a +fee, you must give the recipients all the rights that you have. You must make +sure that they, too, receive or can get the source code. And you must show them +these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) offer +you this license which gives you legal permission to copy, distribute and/or +modify the software. + +Also, for each author's protection and ours, we want to make certain that +everyone understands that there is no warranty for this free software. If the +software is modified by someone else and passed on, we want its recipients to +know that what they have is not the original, so that any problems introduced by +others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We wish +to avoid the danger that redistributors of a free program will individually +obtain patent licenses, in effect making the program proprietary. To prevent +this, we have made it clear that any patent must be licensed for everyone's free +use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification +follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 1. This License applies to any program or other work which contains a notice + placed by the copyright holder saying it may be distributed under the terms + of this General Public License. The "Program", below, refers to any such + program or work, and a "work based on the Program" means either the Program + or any derivative work under copyright law: that is to say, a work containing + the Program or a portion of it, either verbatim or with modifications and/or + translated into another language. (Hereinafter, translation is included + without limitation in the term "modification".) Each licensee is addressed as + "you". + + Activities other than copying, distribution and modification are not covered + by this License; they are outside its scope. The act of running the Program + is not restricted, and the output from the Program is covered only if its + contents constitute a work based on the Program (independent of having been + made by running the Program). Whether that is true depends on what the + Program does. + + 2. You may copy and distribute verbatim copies of the Program's source code as + you receive it, in any medium, provided that you conspicuously and + appropriately publish on each copy an appropriate copyright notice and + disclaimer of warranty; keep intact all the notices that refer to this + License and to the absence of any warranty; and give any other recipients of + the Program a copy of this License along with the Program. + + You may charge a fee for the physical act of transferring a copy, and you may + at your option offer warranty protection in exchange for a fee. + + 3. You may modify your copy or copies of the Program or any portion of it, thus + forming a work based on the Program, and copy and distribute such + modifications or work under the terms of Section 1 above, provided that you + also meet all of these conditions: + + a. You must cause the modified files to carry prominent notices stating + that you changed the files and the date of any change. + + b. You must cause any work that you distribute or publish, that in whole or + in part contains or is derived from the Program or any part thereof, to + be licensed as a whole at no charge to all third parties under the terms + of this License. + + c. If the modified program normally reads commands interactively when run, + you must cause it, when started running for such interactive use in the + most ordinary way, to print or display an announcement including an + appropriate copyright notice and a notice that there is no warranty (or + else, saying that you provide a warranty) and that users may redistribute + the program under these conditions, and telling the user how to view a + copy of this License. (Exception: if the Program itself is interactive + but does not normally print such an announcement, your work based on the + Program is not required to print an announcement.) + + These requirements apply to the modified work as a whole. If identifiable + sections of that work are not derived from the Program, and can be reasonably + considered independent and separate works in themselves, then this License, + and its terms, do not apply to those sections when you distribute them as + separate works. But when you distribute the same sections as part of a whole + which is a work based on the Program, the distribution of the whole must be + on the terms of this License, whose permissions for other licensees extend to + the entire whole, and thus to each and every part regardless of who wrote it. + + Thus, it is not the intent of this section to claim rights or contest your + rights to work written entirely by you; rather, the intent is to exercise the + right to control the distribution of derivative or collective works based on + the Program. + + In addition, mere aggregation of another work not based on the Program with + the Program (or with a work based on the Program) on a volume of a storage or + distribution medium does not bring the other work under the scope of this + License. + + 4. You may copy and distribute the Program (or a work based on it, under + Section 2) in object code or executable form under the terms of Sections 1 + and 2 above provided that you also do one of the following: + + a. Accompany it with the complete corresponding machine-readable source + code, which must be distributed under the terms of Sections 1 and 2 above + on a medium customarily used for software interchange; or, + + b. Accompany it with a written offer, valid for at least three years, to + give any third party, for a charge no more than your cost of physically + performing source distribution, a complete machine-readable copy of the + corresponding source code, to be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + c. Accompany it with the information you received as to the offer to + distribute corresponding source code. (This alternative is allowed only + for noncommercial distribution and only if you received the program in + object code or executable form with such an offer, in accord with + Subsection b above.) + + The source code for a work means the preferred form of the work for making + modifications to it. For an executable work, complete source code means all + the source code for all modules it contains, plus any associated interface + definition files, plus the scripts used to control compilation and + installation of the executable. However, as a special exception, the source + code distributed need not include anything that is normally distributed (in + either source or binary form) with the major components (compiler, kernel, + and so on) of the operating system on which the executable runs, unless that + component itself accompanies the executable. + + If distribution of executable or object code is made by offering access to + copy from a designated place, then offering equivalent access to copy the + source code from the same place counts as distribution of the source code, + even though third parties are not compelled to copy the source along with the + object code. + + 5. You may not copy, modify, sublicense, or distribute the Program except as + expressly provided under this License. Any attempt otherwise to copy, modify, + sublicense or distribute the Program is void, and will automatically + terminate your rights under this License. However, parties who have received + copies, or rights, from you under this License will not have their licenses + terminated so long as such parties remain in full compliance. + + 6. You are not required to accept this License, since you have not signed it. + However, nothing else grants you permission to modify or distribute the + Program or its derivative works. These actions are prohibited by law if you + do not accept this License. Therefore, by modifying or distributing the + Program (or any work based on the Program), you indicate your acceptance of + this License to do so, and all its terms and conditions for copying, + distributing or modifying the Program or works based on it. + + 7. Each time you redistribute the Program (or any work based on the Program), + the recipient automatically receives a license from the original licensor to + copy, distribute or modify the Program subject to these terms and conditions. + You may not impose any further restrictions on the recipients' exercise of + the rights granted herein. You are not responsible for enforcing compliance + by third parties to this License. + + 8. If, as a consequence of a court judgment or allegation of patent + infringement or for any other reason (not limited to patent issues), + conditions are imposed on you (whether by court order, agreement or + otherwise) that contradict the conditions of this License, they do not excuse + you from the conditions of this License. If you cannot distribute so as to + satisfy simultaneously your obligations under this License and any other + pertinent obligations, then as a consequence you may not distribute the + Program at all. For example, if a patent license would not permit + royalty-free redistribution of the Program by all those who receive copies + directly or indirectly through you, then the only way you could satisfy both + it and this License would be to refrain entirely from distribution of the + Program. + + If any portion of this section is held invalid or unenforceable under any + particular circumstance, the balance of the section is intended to apply and + the section as a whole is intended to apply in other circumstances. + + It is not the purpose of this section to induce you to infringe any patents + or other property right claims or to contest validity of any such claims; + this section has the sole purpose of protecting the integrity of the free + software distribution system, which is implemented by public license + practices. Many people have made generous contributions to the wide range of + software distributed through that system in reliance on consistent + application of that system; it is up to the author/donor to decide if he or + she is willing to distribute software through any other system and a licensee + cannot impose that choice. + + This section is intended to make thoroughly clear what is believed to be a + consequence of the rest of this License. + + 9. If the distribution and/or use of the Program is restricted in certain + countries either by patents or by copyrighted interfaces, the original + copyright holder who places the Program under this License may add an + explicit geographical distribution limitation excluding those countries, so + that distribution is permitted only in or among countries not thus excluded. + In such case, this License incorporates the limitation as if written in the + body of this License. + + 10. The Free Software Foundation may publish revised and/or new versions of the + General Public License from time to time. Such new versions will be similar + in spirit to the present version, but may differ in detail to address new + problems or concerns. + + Each version is given a distinguishing version number. If the Program + specifies a version number of this License which applies to it and "any later + version", you have the option of following the terms and conditions either of + that version or of any later version published by the Free Software + Foundation. If the Program does not specify a version number of this License, + you may choose any version ever published by the Free Software Foundation. + + 11. If you wish to incorporate parts of the Program into other free programs + whose distribution conditions are different, write to the author to ask for + permission. For software which is copyrighted by the Free Software + Foundation, write to the Free Software Foundation; we sometimes make + exceptions for this. Our decision will be guided by the two goals of + preserving the free status of all derivatives of our free software and of + promoting the sharing and reuse of software generally. + + NO WARRANTY + + 12. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR + THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE + STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE + PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, + YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 13. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL + ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE + THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY + GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE + OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR + DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR + A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH + HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use +to the public, the best way to achieve this is to make it free software which +everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach +them to the start of each source file to most effectively convey the exclusion of +warranty; and each file should have at least the "copyright" line and a pointer +to where the full notice is found. + +one line to give the program's name and a brief idea of what it does.Copyright (C) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this when it +starts in an interactive mode: + +Gnomovision version 69, Copyright (C) year name of author +Gnomovision comes with ABSOLUTELY NO WARRANTY; for details +type `show w'. This is free software, and you are welcome +to redistribute it under certain conditions; type `show c' +for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts +of the General Public License. Of course, the commands you use may be called +something other than `show w' and `show c'; they could even be mouse-clicks or +menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your school, +if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a +sample; alter the names: + +Yoyodyne, Inc., hereby disclaims all copyright +interest in the program `Gnomovision' +(which makes passes at compilers) written +by James Hacker. + +signature of Ty Coon, 1 April 1989 +Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may consider +it more useful to permit linking proprietary applications with the library. If +this is what you want to do, use the GNU Library General Public License instead +of this License. + +--- + +GNU General Public License v2.0 w/Classpath exception +(JavaCPP Presets for NumPy 1.16.2-1.5) + +GNU Classpath License +===================== + +  + + +The GNU General Public License (GPL) +------------------------------------ + + +Version 2, June 1991 +-------------------- + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to share +and change it. By contrast, the GNU General Public License is intended to +guarantee your freedom to share and change free software--to make sure the +software is free for all its users. This General Public License applies to most +of the Free Software Foundation's software and to any other program whose authors +commit to using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to your +programs, too. + +When we speak of free software, we are referring to freedom, not price. Our +General Public Licenses are designed to make sure that you have the freedom to +distribute copies of free software (and charge for this service if you wish), +that you receive source code or can get it if you want it, that you can change +the software or use pieces of it in new free programs; and that you know you can +do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny +you these rights or to ask you to surrender the rights. These restrictions +translate to certain responsibilities for you if you distribute copies of the +software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for a +fee, you must give the recipients all the rights that you have. You must make +sure that they, too, receive or can get the source code. And you must show them +these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) offer +you this license which gives you legal permission to copy, distribute and/or +modify the software. + +Also, for each author's protection and ours, we want to make certain that +everyone understands that there is no warranty for this free software. If the +software is modified by someone else and passed on, we want its recipients to +know that what they have is not the original, so that any problems introduced by +others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We wish +to avoid the danger that redistributors of a free program will individually +obtain patent licenses, in effect making the program proprietary. To prevent +this, we have made it clear that any patent must be licensed for everyone's free +use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification +follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a notice +placed by the copyright holder saying it may be distributed under the terms of +this General Public License. The "Program", below, refers to any such program or +work, and a "work based on the Program" means either the Program or any +derivative work under copyright law: that is to say, a work containing the +Program or a portion of it, either verbatim or with modifications and/or +translated into another language. (Hereinafter, translation is included without +limitation in the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not covered by +this License; they are outside its scope. The act of running the Program is not +restricted, and the output from the Program is covered only if its contents +constitute a work based on the Program (independent of having been made by +running the Program). Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source code as +you receive it, in any medium, provided that you conspicuously and appropriately +publish on each copy an appropriate copyright notice and disclaimer of warranty; +keep intact all the notices that refer to this License and to the absence of any +warranty; and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may at +your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, thus +forming a work based on the Program, and copy and distribute such modifications +or work under the terms of Section 1 above, provided that you also meet all of +these conditions: + + a) You must cause the modified files to carry prominent notices stating + that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in whole or + in part contains or is derived from the Program or any part thereof, to be + licensed as a whole at no charge to all third parties under the terms of + this License. + + c) If the modified program normally reads commands interactively when run, + you must cause it, when started running for such interactive use in the + most ordinary way, to print or display an announcement including an + appropriate copyright notice and a notice that there is no warranty (or + else, saying that you provide a warranty) and that users may redistribute + the program under these conditions, and telling the user how to view a copy + of this License. (Exception: if the Program itself is interactive but does + not normally print such an announcement, your work based on the Program is + not required to print an announcement.) + +These requirements apply to the modified work as a whole. If identifiable +sections of that work are not derived from the Program, and can be reasonably +considered independent and separate works in themselves, then this License, and +its terms, do not apply to those sections when you distribute them as separate +works. But when you distribute the same sections as part of a whole which is a +work based on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the entire whole, +and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your rights +to work written entirely by you; rather, the intent is to exercise the right to +control the distribution of derivative or collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program with the +Program (or with a work based on the Program) on a volume of a storage or +distribution medium does not bring the other work under the scope of this +License. + +3. You may copy and distribute the Program (or a work based on it, under Section +2) in object code or executable form under the terms of Sections 1 and 2 above +provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable source + code, which must be distributed under the terms of Sections 1 and 2 above + on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three years, to + give any third party, for a charge no more than your cost of physically + performing source distribution, a complete machine-readable copy of the + corresponding source code, to be distributed under the terms of Sections 1 + and 2 above on a medium customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to + distribute corresponding source code. (This alternative is allowed only for + noncommercial distribution + +and only if you received the program in object code or executable form with such +an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for making +modifications to it. For an executable work, complete source code means all the +source code for all modules it contains, plus any associated interface definition +files, plus the scripts used to control compilation and installation of the +executable. However, as a special exception, the source code distributed need not +include anything that is normally distributed (in either source or binary form) +with the major components (compiler, kernel, and so on) of the operating system +on which the executable runs, unless that component itself accompanies the +executable. + +If distribution of executable or object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the source code +from the same place counts as distribution of the source code, even though third +parties are not compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except as +expressly provided under this License. Any attempt otherwise to copy, modify, +sublicense or distribute the Program is void, and will automatically terminate +your rights under this License. However, parties who have received copies, or +rights, from you under this License will not have their licenses terminated so +long as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed it. +However, nothing else grants you permission to modify or distribute the Program +or its derivative works. These actions are prohibited by law if you do not accept +this License. Therefore, by modifying or distributing the Program (or any work +based on the Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying the Program +or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), the +recipient automatically receives a license from the original licensor to copy, +distribute or modify the Program subject to these terms and conditions. You may +not impose any further restrictions on the recipients' exercise of the rights +granted herein. You are not responsible for enforcing compliance by third parties +to this License. + +7. If, as a consequence of a court judgment or allegation of patent infringement +or for any other reason (not limited to patent issues), conditions are imposed on +you (whether by court order, agreement or otherwise) that contradict the +conditions of this License, they do not excuse you from the conditions of this +License. If you cannot distribute so as to satisfy simultaneously your +obligations under this License and any other pertinent obligations, then as a +consequence you may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by all those +who receive copies directly or indirectly through you, then the only way you +could satisfy both it and this License would be to refrain entirely from +distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply and the +section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or +other property right claims or to contest validity of any such claims; this +section has the sole purpose of protecting the integrity of the free software +distribution system, which is implemented by public license practices. Many +people have made generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that system; it is +up to the author/donor to decide if he or she is willing to distribute software +through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a +consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain +countries either by patents or by copyrighted interfaces, the original copyright +holder who places the Program under this License may add an explicit geographical +distribution limitation excluding those countries, so that distribution is +permitted only in or among countries not thus excluded. In such case, this +License incorporates the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions of the +General Public License from time to time. Such new versions will be similar in +spirit to the present version, but may differ in detail to address new problems +or concerns. + +Each version is given a distinguishing version number. If the Program specifies a +version number of this License which applies to it and "any later version", you +have the option of following the terms and conditions either of that version or +of any later version published by the Free Software Foundation. If the Program +does not specify a version number of this License, you may choose any version +ever published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs +whose distribution conditions are different, write to the author to ask for +permission. For software which is copyrighted by the Free Software Foundation, +write to the Free Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status of all +derivatives of our free software and of promoting the sharing and reuse of +software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE +PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED +IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL +ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE +PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, +SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY +TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF +THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER +PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use +to the public, the best way to achieve this is to make it free software which +everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach +them to the start of each source file to most effectively convey the exclusion of +warranty; and each file should have at least the "copyright" line and a pointer +to where the full notice is found. + + one line to give the program's name and a brief idea of what it does. + + Copyright (C) + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., 59 + Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this when it +starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes + with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free + software, and you are welcome to redistribute it under certain conditions; + type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts +of the General Public License. Of course, the commands you use may be called +something other than `show w' and `show c'; they could even be mouse-clicks or +menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your school, +if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a +sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest + + in the program `Gnomovision' (which makes passes at compilers) + + written by James Hacker. + + signature of Ty Coon, 1 April 1989 + + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may consider +it more useful to permit linking proprietary applications with the library. If +this is what you want to do, use the GNU Library General Public License instead +of this License. + +Classpath is distributed under the terms of the GNU General Public License with +the following clarification and special exception. + +Linking this library statically or dynamically with other modules is making a +combined work based on this library. Thus, the terms and conditions of the GNU +General Public License cover the whole combination. + +As a special exception, the copyright holders of this library give you permission +to link this library with independent modules to produce an executable, +regardless of the license terms of these independent modules, and to copy and +distribute the resulting executable under terms of your choice, provided that you +also meet, for each linked independent module, the terms and conditions of the +license of that module. An independent module is a module which is not derived +from or based on this library. If you modify this library, you may extend this +exception to your version of the library, but you are not obligated to do so. If +you do not wish to do so, delete this exception statement from your version. + +As such, it can be used to run, create and distribute a large class of +applications and applets. When GNU Classpath is used unmodified as the core class +library for a virtual machine, compiler for the java languge, or for a program +written in the java programming language it does not affect the licensing for +distributing those programs directly. + +--- + +GNU General Public License v3.0 only +(assertthat 0.2.0, base64enc 0.1-3, blob 1.1.1, caTools 1.17.1.1, egg 0.4.2, Formula 1.2-3, fs 1.2.6, ggrepel 0.8.0, hms 0.4.2, lazyeval 0.2.1, MASS 7.3-51.1, Matrix 1.2-15, nnet 7.3-12, pillar 1.3.1, pkgbuild 1.0.2, pkgload 1.0.2, purrr 0.2.5, rlang 0.3.0.1, rmarkdown 1.11, rpart 4.1-13, rprojroot 1.3-2, tidyselect 0.2.5, usethis 1.4.0, whisker 0.3-2, xlsx 0.6.1, xlsxjars 0.6.1) + +"This program is free software: you can redistribute it and/or modify it under +the terms of version 3 of the GNU General Public License as published by the Free +Software Foundation." + + + +GNU GENERAL PUBLIC LICENSE +========================== + +Version 3,  29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + + +Preamble + +The GNU General Public License is a free, copyleft license for software and other +kinds of works. + +The licenses for most software and other practical works are designed to take +away your freedom to share and change the works. By contrast, the GNU General +Public License is intended to guarantee your freedom to share and change all +versions of a program--to make sure it remains free software for all its users. +We, the Free Software Foundation, use the GNU General Public License for most of +our software; it applies also to any other work released this way by its authors. +You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our +General Public Licenses are designed to make sure that you have the freedom to +distribute copies of free software (and charge for them if you wish), that you +receive source code or can get it if you want it, that you can change the +software or use pieces of it in new free programs, and that you know you can do +these things. + +To protect your rights, we need to prevent others from denying you these rights +or asking you to surrender the rights. Therefore, you have certain +responsibilities if you distribute copies of the software, or if you modify it: +responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether gratis or for a +fee, you must pass on to the recipients the same freedoms that you received. You +must make sure that they, too, receive or can get the source code. And you must +show them these terms so they know their rights. + +Developers that use the GNU GPL protect your rights with two steps: (1) assert +copyright on the software, and (2) offer you this License giving you legal +permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains that there +is no warranty for this free software. For both users' and authors' sake, the GPL +requires that modified versions be marked as changed, so that their problems will +not be attributed erroneously to authors of previous versions. + +Some devices are designed to deny users access to install or run modified +versions of the software inside them, although the manufacturer can do so. This +is fundamentally incompatible with the aim of protecting users' freedom to change +the software. The systematic pattern of such abuse occurs in the area of products +for individuals to use, which is precisely where it is most unacceptable. +Therefore, we have designed this version of the GPL to prohibit the practice for +those products. If such problems arise substantially in other domains, we stand +ready to extend this provision to those domains in future versions of the GPL, as +needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. States +should not allow patents to restrict development and use of software on +general-purpose computers, but in those that do, we wish to avoid the special +danger that patents applied to a free program could make it effectively +proprietary. To prevent this, the GPL assures that patents cannot be used to +render the program non-free. + +The precise terms and conditions for copying, distribution and modification +follow. + + +TERMS AND CONDITIONS + +0. Definitions. + +“This License” refers to version 3 of the GNU General Public License. + +“Copyright” also means copyright-like laws that apply to other kinds of works, +such as semiconductor masks. + +“The Program” refers to any copyrightable work licensed under this License. Each +licensee is addressed as “you”. “Licensees” and “recipients” may be individuals +or organizations. + +To “modify” a work means to copy from or adapt all or part of the work in a +fashion requiring copyright permission, other than the making of an exact copy. +The resulting work is called a “modified version” of the earlier work or a work +“based on” the earlier work. + +A “covered work” means either the unmodified Program or a work based on the +Program. + +To “propagate” a work means to do anything with it that, without permission, +would make you directly or secondarily liable for infringement under applicable +copyright law, except executing it on a computer or modifying a private copy. +Propagation includes copying, distribution (with or without modification), making +available to the public, and in some countries other activities as well. + +To “convey” a work means any kind of propagation that enables other parties to +make or receive copies. Mere interaction with a user through a computer network, +with no transfer of a copy, is not conveying. + +An interactive user interface displays “Appropriate Legal Notices” to the extent +that it includes a convenient and prominently visible feature that (1) displays +an appropriate copyright notice, and (2) tells the user that there is no warranty +for the work (except to the extent that warranties are provided), that licensees +may convey the work under this License, and how to view a copy of this License. +If the interface presents a list of user commands or options, such as a menu, a +prominent item in the list meets this criterion. + +1. Source Code. + +The “source code” for a work means the preferred form of the work for making +modifications to it. “Object code” means any non-source form of a work. + +A “Standard Interface” means an interface that either is an official standard +defined by a recognized standards body, or, in the case of interfaces specified +for a particular programming language, one that is widely used among developers +working in that language. + +The “System Libraries” of an executable work include anything, other than the +work as a whole, that (a) is included in the normal form of packaging a Major +Component, but which is not part of that Major Component, and (b) serves only to +enable use of the work with that Major Component, or to implement a Standard +Interface for which an implementation is available to the public in source code +form. A “Major Component”, in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system (if any) on +which the executable work runs, or a compiler used to produce the work, or an +object code interpreter used to run it. + +The “Corresponding Source” for a work in object code form means all the source +code needed to generate, install, and (for an executable work) run the object +code and to modify the work, including scripts to control those activities. +However, it does not include the work's System Libraries, or general-purpose +tools or generally available free programs which are used unmodified in +performing those activities but which are not part of the work. For example, +Corresponding Source includes interface definition files associated with source +files for the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, such as by +intimate data communication or control flow between those subprograms and other +parts of the work. + +The Corresponding Source need not include anything that users can regenerate +automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same work. + +2. Basic Permissions. + +All rights granted under this License are granted for the term of copyright on +the Program, and are irrevocable provided the stated conditions are met. This +License explicitly affirms your unlimited permission to run the unmodified +Program. The output from running a covered work is covered by this License only +if the output, given its content, constitutes a covered work. This License +acknowledges your rights of fair use or other equivalent, as provided by +copyright law. + +You may make, run and propagate covered works that you do not convey, without +conditions so long as your license otherwise remains in force. You may convey +covered works to others for the sole purpose of having them make modifications +exclusively for you, or provide you with facilities for running those works, +provided that you comply with the terms of this License in conveying all material +for which you do not control copyright. Those thus making or running the covered +works for you must do so exclusively on your behalf, under your direction and +control, on terms that prohibit them from making any copies of your copyrighted +material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the conditions +stated below. Sublicensing is not allowed; section 10 makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological measure under +any applicable law fulfilling obligations under article 11 of the WIPO copyright +treaty adopted on 20 December 1996, or similar laws prohibiting or restricting +circumvention of such measures. + +When you convey a covered work, you waive any legal power to forbid circumvention +of technological measures to the extent such circumvention is effected by +exercising rights under this License with respect to the covered work, and you +disclaim any intention to limit operation or modification of the work as a means +of enforcing, against the work's users, your or third parties' legal rights to +forbid circumvention of technological measures. + +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you receive it, in +any medium, provided that you conspicuously and appropriately publish on each +copy an appropriate copyright notice; keep intact all notices stating that this +License and any non-permissive terms added in accord with section 7 apply to the +code; keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, and you may +offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to produce it +from the Program, in the form of source code under the terms of section 4, +provided that you also meet all of these conditions: + + * a) The work must carry prominent notices stating that you modified it, and + giving a relevant date. + + * b) The work must carry prominent notices stating that it is released under + this License and any conditions added under section 7. This requirement + modifies the requirement in section 4 to “keep intact all notices”. + + * c) You must license the entire work, as a whole, under this License to anyone + who comes into possession of a copy. This License will therefore apply, along + with any applicable section 7 additional terms, to the whole of the work, and + all its parts, regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not invalidate + such permission if you have separately received it. + + * d) If the work has interactive user interfaces, each must display Appropriate + Legal Notices; however, if the Program has interactive interfaces that do not + display Appropriate Legal Notices, your work need not make them do so. + +A compilation of a covered work with other separate and independent works, which +are not by their nature extensions of the covered work, and which are not +combined with it such as to form a larger program, in or on a volume of a storage +or distribution medium, is called an “aggregate” if the compilation and its +resulting copyright are not used to limit the access or legal rights of the +compilation's users beyond what the individual works permit. Inclusion of a +covered work in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms of sections 4 +and 5, provided that you also convey the machine-readable Corresponding Source +under the terms of this License, in one of these ways: + + * a) Convey the object code in, or embodied in, a physical product (including a + physical distribution medium), accompanied by the Corresponding Source fixed + on a durable physical medium customarily used for software interchange. + + * b) Convey the object code in, or embodied in, a physical product (including a + physical distribution medium), accompanied by a written offer, valid for at + least three years and valid for as long as you offer spare parts or customer + support for that product model, to give anyone who possesses the object code + either (1) a copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical medium + customarily used for software interchange, for a price no more than your + reasonable cost of physically performing this conveying of source, or (2) + access to copy the Corresponding Source from a network server at no charge. + + * c) Convey individual copies of the object code with a copy of the written + offer to provide the Corresponding Source. This alternative is allowed only + occasionally and noncommercially, and only if you received the object code + with such an offer, in accord with subsection 6b. + + * d) Convey the object code by offering access from a designated place (gratis + or for a charge), and offer equivalent access to the Corresponding Source in + the same way through the same place at no further charge. You need not + require recipients to copy the Corresponding Source along with the object + code. If the place to copy the object code is a network server, the + Corresponding Source may be on a different server (operated by you or a third + party) that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the Corresponding + Source, you remain obligated to ensure that it is available for as long as + needed to satisfy these requirements. + + * e) Convey the object code using peer-to-peer transmission, provided you + inform other peers where the object code and Corresponding Source of the work + are being offered to the general public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded from the +Corresponding Source as a System Library, need not be included in conveying the +object code work. + +A “User Product” is either (1) a “consumer product”, which means any tangible +personal property which is normally used for personal, family, or household +purposes, or (2) anything designed or sold for incorporation into a dwelling. In +determining whether a product is a consumer product, doubtful cases shall be +resolved in favor of coverage. For a particular product received by a particular +user, “normally used” refers to a typical or common use of that class of product, +regardless of the status of the particular user or of the way in which the +particular user actually uses, or expects or is expected to use, the product. A +product is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent the only +significant mode of use of the product. + +“Installation Information” for a User Product means any methods, procedures, +authorization keys, or other information required to install and execute modified +versions of a covered work in that User Product from a modified version of its +Corresponding Source. The information must suffice to ensure that the continued +functioning of the modified object code is in no case prevented or interfered +with solely because modification has been made. + +If you convey an object code work under this section in, or with, or specifically +for use in, a User Product, and the conveying occurs as part of a transaction in +which the right of possession and use of the User Product is transferred to the +recipient in perpetuity or for a fixed term (regardless of how the transaction is +characterized), the Corresponding Source conveyed under this section must be +accompanied by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install modified object +code on the User Product (for example, the work has been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates for a +work that has been modified or installed by the recipient, or for the User +Product in which it has been modified or installed. Access to a network may be +denied when the modification itself materially and adversely affects the +operation of the network or violates the rules and protocols for communication +across the network. + +Corresponding Source conveyed, and Installation Information provided, in accord +with this section must be in a format that is publicly documented (and with an +implementation available to the public in source code form), and must require no +special password or key for unpacking, reading or copying. + +7. Additional Terms. + +“Additional permissions” are terms that supplement the terms of this License by +making exceptions from one or more of its conditions. Additional permissions that +are applicable to the entire Program shall be treated as though they were +included in this License, to the extent that they are valid under applicable law. +If additional permissions apply only to part of the Program, that part may be +used separately under those permissions, but the entire Program remains governed +by this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option remove any +additional permissions from that copy, or from any part of it. (Additional +permissions may be written to require their own removal in certain cases when you +modify the work.) You may place additional permissions on material, added by you +to a covered work, for which you have or can give appropriate copyright +permission. + +Notwithstanding any other provision of this License, for material you add to a +covered work, you may (if authorized by the copyright holders of that material) +supplement the terms of this License with terms: + + * a) Disclaiming warranty or limiting liability differently from the terms of + sections 15 and 16 of this License; or + + * b) Requiring preservation of specified reasonable legal notices or author + attributions in that material or in the Appropriate Legal Notices displayed + by works containing it; or + + * c) Prohibiting misrepresentation of the origin of that material, or requiring + that modified versions of such material be marked in reasonable ways as + different from the original version; or + + * d) Limiting the use for publicity purposes of names of licensors or authors + of the material; or + + * e) Declining to grant rights under trademark law for use of some trade names, + trademarks, or service marks; or + + * f) Requiring indemnification of licensors and authors of that material by + anyone who conveys the material (or modified versions of it) with contractual + assumptions of liability to the recipient, for any liability that these + contractual assumptions directly impose on those licensors and authors. + +All other non-permissive additional terms are considered “further restrictions” +within the meaning of section 10. If the Program as you received it, or any part +of it, contains a notice stating that it is governed by this License along with a +term that is a further restriction, you may remove that term. If a license +document contains a further restriction but permits relicensing or conveying +under this License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does not survive +such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you must place, +in the relevant source files, a statement of the additional terms that apply to +those files, or a notice indicating where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the form of a +separately written license, or stated as exceptions; the above requirements apply +either way. + +8. Termination. + +You may not propagate or modify a covered work except as expressly provided under +this License. Any attempt otherwise to propagate or modify it is void, and will +automatically terminate your rights under this License (including any patent +licenses granted under the third paragraph of section 11). + +However, if you cease all violation of this License, then your license from a +particular copyright holder is reinstated (a) provisionally, unless and until the +copyright holder explicitly and finally terminates your license, and (b) +permanently, if the copyright holder fails to notify you of the violation by some +reasonable means prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is reinstated +permanently if the copyright holder notifies you of the violation by some +reasonable means, this is the first time you have received notice of violation of +this License (for any work) from that copyright holder, and you cure the +violation prior to 30 days after your receipt of the notice. + +Termination of your rights under this section does not terminate the licenses of +parties who have received copies or rights from you under this License. If your +rights have been terminated and not permanently reinstated, you do not qualify to +receive new licenses for the same material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or run a copy of +the Program. Ancillary propagation of a covered work occurring solely as a +consequence of using peer-to-peer transmission to receive a copy likewise does +not require acceptance. However, nothing other than this License grants you +permission to propagate or modify any covered work. These actions infringe +copyright if you do not accept this License. Therefore, by modifying or +propagating a covered work, you indicate your acceptance of this License to do +so. + +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically receives a +license from the original licensors, to run, modify and propagate that work, +subject to this License. You are not responsible for enforcing compliance by +third parties with this License. + +An “entity transaction” is a transaction transferring control of an organization, +or substantially all assets of one, or subdividing an organization, or merging +organizations. If propagation of a covered work results from an entity +transaction, each party to that transaction who receives a copy of the work also +receives whatever licenses to the work the party's predecessor in interest had or +could give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if the +predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the rights granted +or affirmed under this License. For example, you may not impose a license fee, +royalty, or other charge for exercise of rights granted under this License, and +you may not initiate litigation (including a cross-claim or counterclaim in a +lawsuit) alleging that any patent claim is infringed by making, using, selling, +offering for sale, or importing the Program or any portion of it. + +11. Patents. + +A “contributor” is a copyright holder who authorizes use under this License of +the Program or a work on which the Program is based. The work thus licensed is +called the contributor's “contributor version”. + +A contributor's “essential patent claims” are all patent claims owned or +controlled by the contributor, whether already acquired or hereafter acquired, +that would be infringed by some manner, permitted by this License, of making, +using, or selling its contributor version, but do not include claims that would +be infringed only as a consequence of further modification of the contributor +version. For purposes of this definition, “control” includes the right to grant +patent sublicenses in a manner consistent with the requirements of this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free patent +license under the contributor's essential patent claims, to make, use, sell, +offer for sale, import and otherwise run, modify and propagate the contents of +its contributor version. + +In the following three paragraphs, a “patent license” is any express agreement or +commitment, however denominated, not to enforce a patent (such as an express +permission to practice a patent or covenant not to sue for patent infringement). +To “grant” such a patent license to a party means to make such an agreement or +commitment not to enforce a patent against the party. + +If you convey a covered work, knowingly relying on a patent license, and the +Corresponding Source of the work is not available for anyone to copy, free of +charge and under the terms of this License, through a publicly available network +server or other readily accessible means, then you must either (1) cause the +Corresponding Source to be so available, or (2) arrange to deprive yourself of +the benefit of the patent license for this particular work, or (3) arrange, in a +manner consistent with the requirements of this License, to extend the patent +license to downstream recipients. “Knowingly relying” means you have actual +knowledge that, but for the patent license, your conveying the covered work in a +country, or your recipient's use of the covered work in a country, would infringe +one or more identifiable patents in that country that you have reason to believe +are valid. + +If, pursuant to or in connection with a single transaction or arrangement, you +convey, or propagate by procuring conveyance of, a covered work, and grant a +patent license to some of the parties receiving the covered work authorizing them +to use, propagate, modify or convey a specific copy of the covered work, then the +patent license you grant is automatically extended to all recipients of the +covered work and works based on it. + +A patent license is “discriminatory” if it does not include within the scope of +its coverage, prohibits the exercise of, or is conditioned on the non-exercise of +one or more of the rights that are specifically granted under this License. You +may not convey a covered work if you are a party to an arrangement with a third +party that is in the business of distributing software, under which you make +payment to the third party based on the extent of your activity of conveying the +work, and under which the third party grants, to any of the parties who would +receive the covered work from you, a discriminatory patent license (a) in +connection with copies of the covered work conveyed by you (or copies made from +those copies), or (b) primarily for and in connection with specific products or +compilations that contain the covered work, unless you entered into that +arrangement, or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting any implied +license or other defenses to infringement that may otherwise be available to you +under applicable patent law. + +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or otherwise) +that contradict the conditions of this License, they do not excuse you from the +conditions of this License. If you cannot convey a covered work so as to satisfy +simultaneously your obligations under this License and any other pertinent +obligations, then as a consequence you may not convey it at all. For example, if +you agree to terms that obligate you to collect a royalty for further conveying +from those to whom you convey the Program, the only way you could satisfy both +those terms and this License would be to refrain entirely from conveying the +Program. + +13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have permission to link +or combine any covered work with a work licensed under version 3 of the GNU +Affero General Public License into a single combined work, and to convey the +resulting work. The terms of this License will continue to apply to the part +which is the covered work, but the special requirements of the GNU Affero General +Public License, section 13, concerning interaction through a network will apply +to the combination as such. + +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of the GNU +General Public License from time to time. Such new versions will be similar in +spirit to the present version, but may differ in detail to address new problems +or concerns. + +Each version is given a distinguishing version number. If the Program specifies +that a certain numbered version of the GNU General Public License “or any later +version” applies to it, you have the option of following the terms and conditions +either of that numbered version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of the GNU +General Public License, you may choose any version ever published by the Free +Software Foundation. + +If the Program specifies that a proxy can decide which future versions of the GNU +General Public License can be used, that proxy's public statement of acceptance +of a version permanently authorizes you to choose that version for the Program. + +Later license versions may give you additional or different permissions. However, +no additional obligations are imposed on any author or copyright holder as a +result of your choosing to follow a later version. + +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER +PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER +EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE +DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY +COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS +PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE +THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED +INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE +PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY +HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided above cannot +be given local legal effect according to their terms, reviewing courts shall +apply local law that most closely approximates an absolute waiver of all civil +liability in connection with the Program, unless a warranty or assumption of +liability accompanies a copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use +to the public, the best way to achieve this is to make it free software which +everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach +them to the start of each source file to most effectively state the exclusion of +warranty; and each file should have at least the “copyright” line and a pointer +to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short notice like this +when it starts in an interactive mode: + + Copyright (C) + + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts +of the General Public License. Of course, your program's commands might be +different; for a GUI interface, you would use an “about box”. + +You should also get your employer (if you work as a programmer) or school, if +any, to sign a “copyright disclaimer” for the program, if necessary. For more +information on this, and how to apply and follow the GNU GPL, see +. + +The GNU General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may consider +it more useful to permit linking proprietary applications with the library. If +this is what you want to do, use the GNU Lesser General Public License instead of +this License. But first, please read +. + +--- + +GNU General Public License v3.0 or later +(codetools 0.2-15, corpcor 1.6.9, corrplot 0.84, fit.models 0.5-14, highr 0.7, htmlTable 1.12, JavaCPP Presets for NumPy 1.16.2-1.5, knitr 1.21, pcaPP 1.9-73, readxl 1.1.0, test-catkin-virtualenv-py3 0.1.3) + +GNU GENERAL PUBLIC LICENSE +========================== + +Version 3,  29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + + +Preamble + +The GNU General Public License is a free, copyleft license for software and other +kinds of works. + +The licenses for most software and other practical works are designed to take +away your freedom to share and change the works. By contrast, the GNU General +Public License is intended to guarantee your freedom to share and change all +versions of a program--to make sure it remains free software for all its users. +We, the Free Software Foundation, use the GNU General Public License for most of +our software; it applies also to any other work released this way by its authors. +You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our +General Public Licenses are designed to make sure that you have the freedom to +distribute copies of free software (and charge for them if you wish), that you +receive source code or can get it if you want it, that you can change the +software or use pieces of it in new free programs, and that you know you can do +these things. + +To protect your rights, we need to prevent others from denying you these rights +or asking you to surrender the rights. Therefore, you have certain +responsibilities if you distribute copies of the software, or if you modify it: +responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether gratis or for a +fee, you must pass on to the recipients the same freedoms that you received. You +must make sure that they, too, receive or can get the source code. And you must +show them these terms so they know their rights. + +Developers that use the GNU GPL protect your rights with two steps: (1) assert +copyright on the software, and (2) offer you this License giving you legal +permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains that there +is no warranty for this free software. For both users' and authors' sake, the GPL +requires that modified versions be marked as changed, so that their problems will +not be attributed erroneously to authors of previous versions. + +Some devices are designed to deny users access to install or run modified +versions of the software inside them, although the manufacturer can do so. This +is fundamentally incompatible with the aim of protecting users' freedom to change +the software. The systematic pattern of such abuse occurs in the area of products +for individuals to use, which is precisely where it is most unacceptable. +Therefore, we have designed this version of the GPL to prohibit the practice for +those products. If such problems arise substantially in other domains, we stand +ready to extend this provision to those domains in future versions of the GPL, as +needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. States +should not allow patents to restrict development and use of software on +general-purpose computers, but in those that do, we wish to avoid the special +danger that patents applied to a free program could make it effectively +proprietary. To prevent this, the GPL assures that patents cannot be used to +render the program non-free. + +The precise terms and conditions for copying, distribution and modification +follow. + + +TERMS AND CONDITIONS + +0. Definitions. + +“This License” refers to version 3 of the GNU General Public License. + +“Copyright” also means copyright-like laws that apply to other kinds of works, +such as semiconductor masks. + +“The Program” refers to any copyrightable work licensed under this License. Each +licensee is addressed as “you”. “Licensees” and “recipients” may be individuals +or organizations. + +To “modify” a work means to copy from or adapt all or part of the work in a +fashion requiring copyright permission, other than the making of an exact copy. +The resulting work is called a “modified version” of the earlier work or a work +“based on” the earlier work. + +A “covered work” means either the unmodified Program or a work based on the +Program. + +To “propagate” a work means to do anything with it that, without permission, +would make you directly or secondarily liable for infringement under applicable +copyright law, except executing it on a computer or modifying a private copy. +Propagation includes copying, distribution (with or without modification), making +available to the public, and in some countries other activities as well. + +To “convey” a work means any kind of propagation that enables other parties to +make or receive copies. Mere interaction with a user through a computer network, +with no transfer of a copy, is not conveying. + +An interactive user interface displays “Appropriate Legal Notices” to the extent +that it includes a convenient and prominently visible feature that (1) displays +an appropriate copyright notice, and (2) tells the user that there is no warranty +for the work (except to the extent that warranties are provided), that licensees +may convey the work under this License, and how to view a copy of this License. +If the interface presents a list of user commands or options, such as a menu, a +prominent item in the list meets this criterion. + +1. Source Code. + +The “source code” for a work means the preferred form of the work for making +modifications to it. “Object code” means any non-source form of a work. + +A “Standard Interface” means an interface that either is an official standard +defined by a recognized standards body, or, in the case of interfaces specified +for a particular programming language, one that is widely used among developers +working in that language. + +The “System Libraries” of an executable work include anything, other than the +work as a whole, that (a) is included in the normal form of packaging a Major +Component, but which is not part of that Major Component, and (b) serves only to +enable use of the work with that Major Component, or to implement a Standard +Interface for which an implementation is available to the public in source code +form. A “Major Component”, in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system (if any) on +which the executable work runs, or a compiler used to produce the work, or an +object code interpreter used to run it. + +The “Corresponding Source” for a work in object code form means all the source +code needed to generate, install, and (for an executable work) run the object +code and to modify the work, including scripts to control those activities. +However, it does not include the work's System Libraries, or general-purpose +tools or generally available free programs which are used unmodified in +performing those activities but which are not part of the work. For example, +Corresponding Source includes interface definition files associated with source +files for the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, such as by +intimate data communication or control flow between those subprograms and other +parts of the work. + +The Corresponding Source need not include anything that users can regenerate +automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same work. + +2. Basic Permissions. + +All rights granted under this License are granted for the term of copyright on +the Program, and are irrevocable provided the stated conditions are met. This +License explicitly affirms your unlimited permission to run the unmodified +Program. The output from running a covered work is covered by this License only +if the output, given its content, constitutes a covered work. This License +acknowledges your rights of fair use or other equivalent, as provided by +copyright law. + +You may make, run and propagate covered works that you do not convey, without +conditions so long as your license otherwise remains in force. You may convey +covered works to others for the sole purpose of having them make modifications +exclusively for you, or provide you with facilities for running those works, +provided that you comply with the terms of this License in conveying all material +for which you do not control copyright. Those thus making or running the covered +works for you must do so exclusively on your behalf, under your direction and +control, on terms that prohibit them from making any copies of your copyrighted +material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the conditions +stated below. Sublicensing is not allowed; section 10 makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological measure under +any applicable law fulfilling obligations under article 11 of the WIPO copyright +treaty adopted on 20 December 1996, or similar laws prohibiting or restricting +circumvention of such measures. + +When you convey a covered work, you waive any legal power to forbid circumvention +of technological measures to the extent such circumvention is effected by +exercising rights under this License with respect to the covered work, and you +disclaim any intention to limit operation or modification of the work as a means +of enforcing, against the work's users, your or third parties' legal rights to +forbid circumvention of technological measures. + +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you receive it, in +any medium, provided that you conspicuously and appropriately publish on each +copy an appropriate copyright notice; keep intact all notices stating that this +License and any non-permissive terms added in accord with section 7 apply to the +code; keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, and you may +offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to produce it +from the Program, in the form of source code under the terms of section 4, +provided that you also meet all of these conditions: + + * a) The work must carry prominent notices stating that you modified it, and + giving a relevant date. + + * b) The work must carry prominent notices stating that it is released under + this License and any conditions added under section 7. This requirement + modifies the requirement in section 4 to “keep intact all notices”. + + * c) You must license the entire work, as a whole, under this License to anyone + who comes into possession of a copy. This License will therefore apply, along + with any applicable section 7 additional terms, to the whole of the work, and + all its parts, regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not invalidate + such permission if you have separately received it. + + * d) If the work has interactive user interfaces, each must display Appropriate + Legal Notices; however, if the Program has interactive interfaces that do not + display Appropriate Legal Notices, your work need not make them do so. + +A compilation of a covered work with other separate and independent works, which +are not by their nature extensions of the covered work, and which are not +combined with it such as to form a larger program, in or on a volume of a storage +or distribution medium, is called an “aggregate” if the compilation and its +resulting copyright are not used to limit the access or legal rights of the +compilation's users beyond what the individual works permit. Inclusion of a +covered work in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms of sections 4 +and 5, provided that you also convey the machine-readable Corresponding Source +under the terms of this License, in one of these ways: + + * a) Convey the object code in, or embodied in, a physical product (including a + physical distribution medium), accompanied by the Corresponding Source fixed + on a durable physical medium customarily used for software interchange. + + * b) Convey the object code in, or embodied in, a physical product (including a + physical distribution medium), accompanied by a written offer, valid for at + least three years and valid for as long as you offer spare parts or customer + support for that product model, to give anyone who possesses the object code + either (1) a copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical medium + customarily used for software interchange, for a price no more than your + reasonable cost of physically performing this conveying of source, or (2) + access to copy the Corresponding Source from a network server at no charge. + + * c) Convey individual copies of the object code with a copy of the written + offer to provide the Corresponding Source. This alternative is allowed only + occasionally and noncommercially, and only if you received the object code + with such an offer, in accord with subsection 6b. + + * d) Convey the object code by offering access from a designated place (gratis + or for a charge), and offer equivalent access to the Corresponding Source in + the same way through the same place at no further charge. You need not + require recipients to copy the Corresponding Source along with the object + code. If the place to copy the object code is a network server, the + Corresponding Source may be on a different server (operated by you or a third + party) that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the Corresponding + Source, you remain obligated to ensure that it is available for as long as + needed to satisfy these requirements. + + * e) Convey the object code using peer-to-peer transmission, provided you + inform other peers where the object code and Corresponding Source of the work + are being offered to the general public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded from the +Corresponding Source as a System Library, need not be included in conveying the +object code work. + +A “User Product” is either (1) a “consumer product”, which means any tangible +personal property which is normally used for personal, family, or household +purposes, or (2) anything designed or sold for incorporation into a dwelling. In +determining whether a product is a consumer product, doubtful cases shall be +resolved in favor of coverage. For a particular product received by a particular +user, “normally used” refers to a typical or common use of that class of product, +regardless of the status of the particular user or of the way in which the +particular user actually uses, or expects or is expected to use, the product. A +product is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent the only +significant mode of use of the product. + +“Installation Information” for a User Product means any methods, procedures, +authorization keys, or other information required to install and execute modified +versions of a covered work in that User Product from a modified version of its +Corresponding Source. The information must suffice to ensure that the continued +functioning of the modified object code is in no case prevented or interfered +with solely because modification has been made. + +If you convey an object code work under this section in, or with, or specifically +for use in, a User Product, and the conveying occurs as part of a transaction in +which the right of possession and use of the User Product is transferred to the +recipient in perpetuity or for a fixed term (regardless of how the transaction is +characterized), the Corresponding Source conveyed under this section must be +accompanied by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install modified object +code on the User Product (for example, the work has been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates for a +work that has been modified or installed by the recipient, or for the User +Product in which it has been modified or installed. Access to a network may be +denied when the modification itself materially and adversely affects the +operation of the network or violates the rules and protocols for communication +across the network. + +Corresponding Source conveyed, and Installation Information provided, in accord +with this section must be in a format that is publicly documented (and with an +implementation available to the public in source code form), and must require no +special password or key for unpacking, reading or copying. + +7. Additional Terms. + +“Additional permissions” are terms that supplement the terms of this License by +making exceptions from one or more of its conditions. Additional permissions that +are applicable to the entire Program shall be treated as though they were +included in this License, to the extent that they are valid under applicable law. +If additional permissions apply only to part of the Program, that part may be +used separately under those permissions, but the entire Program remains governed +by this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option remove any +additional permissions from that copy, or from any part of it. (Additional +permissions may be written to require their own removal in certain cases when you +modify the work.) You may place additional permissions on material, added by you +to a covered work, for which you have or can give appropriate copyright +permission. + +Notwithstanding any other provision of this License, for material you add to a +covered work, you may (if authorized by the copyright holders of that material) +supplement the terms of this License with terms: + + * a) Disclaiming warranty or limiting liability differently from the terms of + sections 15 and 16 of this License; or + + * b) Requiring preservation of specified reasonable legal notices or author + attributions in that material or in the Appropriate Legal Notices displayed + by works containing it; or + + * c) Prohibiting misrepresentation of the origin of that material, or requiring + that modified versions of such material be marked in reasonable ways as + different from the original version; or + + * d) Limiting the use for publicity purposes of names of licensors or authors + of the material; or + + * e) Declining to grant rights under trademark law for use of some trade names, + trademarks, or service marks; or + + * f) Requiring indemnification of licensors and authors of that material by + anyone who conveys the material (or modified versions of it) with contractual + assumptions of liability to the recipient, for any liability that these + contractual assumptions directly impose on those licensors and authors. + +All other non-permissive additional terms are considered “further restrictions” +within the meaning of section 10. If the Program as you received it, or any part +of it, contains a notice stating that it is governed by this License along with a +term that is a further restriction, you may remove that term. If a license +document contains a further restriction but permits relicensing or conveying +under this License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does not survive +such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you must place, +in the relevant source files, a statement of the additional terms that apply to +those files, or a notice indicating where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the form of a +separately written license, or stated as exceptions; the above requirements apply +either way. + +8. Termination. + +You may not propagate or modify a covered work except as expressly provided under +this License. Any attempt otherwise to propagate or modify it is void, and will +automatically terminate your rights under this License (including any patent +licenses granted under the third paragraph of section 11). + +However, if you cease all violation of this License, then your license from a +particular copyright holder is reinstated (a) provisionally, unless and until the +copyright holder explicitly and finally terminates your license, and (b) +permanently, if the copyright holder fails to notify you of the violation by some +reasonable means prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is reinstated +permanently if the copyright holder notifies you of the violation by some +reasonable means, this is the first time you have received notice of violation of +this License (for any work) from that copyright holder, and you cure the +violation prior to 30 days after your receipt of the notice. + +Termination of your rights under this section does not terminate the licenses of +parties who have received copies or rights from you under this License. If your +rights have been terminated and not permanently reinstated, you do not qualify to +receive new licenses for the same material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or run a copy of +the Program. Ancillary propagation of a covered work occurring solely as a +consequence of using peer-to-peer transmission to receive a copy likewise does +not require acceptance. However, nothing other than this License grants you +permission to propagate or modify any covered work. These actions infringe +copyright if you do not accept this License. Therefore, by modifying or +propagating a covered work, you indicate your acceptance of this License to do +so. + +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically receives a +license from the original licensors, to run, modify and propagate that work, +subject to this License. You are not responsible for enforcing compliance by +third parties with this License. + +An “entity transaction” is a transaction transferring control of an organization, +or substantially all assets of one, or subdividing an organization, or merging +organizations. If propagation of a covered work results from an entity +transaction, each party to that transaction who receives a copy of the work also +receives whatever licenses to the work the party's predecessor in interest had or +could give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if the +predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the rights granted +or affirmed under this License. For example, you may not impose a license fee, +royalty, or other charge for exercise of rights granted under this License, and +you may not initiate litigation (including a cross-claim or counterclaim in a +lawsuit) alleging that any patent claim is infringed by making, using, selling, +offering for sale, or importing the Program or any portion of it. + +11. Patents. + +A “contributor” is a copyright holder who authorizes use under this License of +the Program or a work on which the Program is based. The work thus licensed is +called the contributor's “contributor version”. + +A contributor's “essential patent claims” are all patent claims owned or +controlled by the contributor, whether already acquired or hereafter acquired, +that would be infringed by some manner, permitted by this License, of making, +using, or selling its contributor version, but do not include claims that would +be infringed only as a consequence of further modification of the contributor +version. For purposes of this definition, “control” includes the right to grant +patent sublicenses in a manner consistent with the requirements of this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free patent +license under the contributor's essential patent claims, to make, use, sell, +offer for sale, import and otherwise run, modify and propagate the contents of +its contributor version. + +In the following three paragraphs, a “patent license” is any express agreement or +commitment, however denominated, not to enforce a patent (such as an express +permission to practice a patent or covenant not to sue for patent infringement). +To “grant” such a patent license to a party means to make such an agreement or +commitment not to enforce a patent against the party. + +If you convey a covered work, knowingly relying on a patent license, and the +Corresponding Source of the work is not available for anyone to copy, free of +charge and under the terms of this License, through a publicly available network +server or other readily accessible means, then you must either (1) cause the +Corresponding Source to be so available, or (2) arrange to deprive yourself of +the benefit of the patent license for this particular work, or (3) arrange, in a +manner consistent with the requirements of this License, to extend the patent +license to downstream recipients. “Knowingly relying” means you have actual +knowledge that, but for the patent license, your conveying the covered work in a +country, or your recipient's use of the covered work in a country, would infringe +one or more identifiable patents in that country that you have reason to believe +are valid. + +If, pursuant to or in connection with a single transaction or arrangement, you +convey, or propagate by procuring conveyance of, a covered work, and grant a +patent license to some of the parties receiving the covered work authorizing them +to use, propagate, modify or convey a specific copy of the covered work, then the +patent license you grant is automatically extended to all recipients of the +covered work and works based on it. + +A patent license is “discriminatory” if it does not include within the scope of +its coverage, prohibits the exercise of, or is conditioned on the non-exercise of +one or more of the rights that are specifically granted under this License. You +may not convey a covered work if you are a party to an arrangement with a third +party that is in the business of distributing software, under which you make +payment to the third party based on the extent of your activity of conveying the +work, and under which the third party grants, to any of the parties who would +receive the covered work from you, a discriminatory patent license (a) in +connection with copies of the covered work conveyed by you (or copies made from +those copies), or (b) primarily for and in connection with specific products or +compilations that contain the covered work, unless you entered into that +arrangement, or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting any implied +license or other defenses to infringement that may otherwise be available to you +under applicable patent law. + +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or otherwise) +that contradict the conditions of this License, they do not excuse you from the +conditions of this License. If you cannot convey a covered work so as to satisfy +simultaneously your obligations under this License and any other pertinent +obligations, then as a consequence you may not convey it at all. For example, if +you agree to terms that obligate you to collect a royalty for further conveying +from those to whom you convey the Program, the only way you could satisfy both +those terms and this License would be to refrain entirely from conveying the +Program. + +13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have permission to link +or combine any covered work with a work licensed under version 3 of the GNU +Affero General Public License into a single combined work, and to convey the +resulting work. The terms of this License will continue to apply to the part +which is the covered work, but the special requirements of the GNU Affero General +Public License, section 13, concerning interaction through a network will apply +to the combination as such. + +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of the GNU +General Public License from time to time. Such new versions will be similar in +spirit to the present version, but may differ in detail to address new problems +or concerns. + +Each version is given a distinguishing version number. If the Program specifies +that a certain numbered version of the GNU General Public License “or any later +version” applies to it, you have the option of following the terms and conditions +either of that numbered version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of the GNU +General Public License, you may choose any version ever published by the Free +Software Foundation. + +If the Program specifies that a proxy can decide which future versions of the GNU +General Public License can be used, that proxy's public statement of acceptance +of a version permanently authorizes you to choose that version for the Program. + +Later license versions may give you additional or different permissions. However, +no additional obligations are imposed on any author or copyright holder as a +result of your choosing to follow a later version. + +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER +PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER +EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE +DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY +COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS +PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE +THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED +INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE +PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY +HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided above cannot +be given local legal effect according to their terms, reviewing courts shall +apply local law that most closely approximates an absolute waiver of all civil +liability in connection with the Program, unless a warranty or assumption of +liability accompanies a copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use +to the public, the best way to achieve this is to make it free software which +everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach +them to the start of each source file to most effectively state the exclusion of +warranty; and each file should have at least the “copyright” line and a pointer +to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short notice like this +when it starts in an interactive mode: + + Copyright (C) + + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts +of the General Public License. Of course, your program's commands might be +different; for a GUI interface, you would use an “about box”. + +You should also get your employer (if you work as a programmer) or school, if +any, to sign a “copyright disclaimer” for the program, if necessary. For more +information on this, and how to apply and follow the GNU GPL, see +. + +The GNU General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may consider +it more useful to permit linking proprietary applications with the library. If +this is what you want to do, use the GNU Lesser General Public License instead of +this License. But first, please read +. + +--- + +GNU Library General Public License v2 or later +(DBI 1.0.0, RSQLite 2.1.1, survival 2.43-3) + +GNU Library General Public License +================================== + +Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Everyone is permitted to copy and distribute verbatim copies + + of this license document, but changing it is not allowed. + + [This is the first released version of the Library GPL. It is numbered 2 + because it goes with version 2 of the ordinary GPL.] + + +Preamble +-------- + +The licenses for most software are designed to take away your freedom to share +and change it. By contrast, the GNU General Public Licenses are intended to +guarantee your freedom to share and change free software--to make sure the +software is free for all its users. + +This license, the Library General Public License, applies to some specially +designated Free Software Foundation software, and to other libraries whose +authors who decide to use it. You can use it for your libraries too. + +When we speak of free software, we are referring to freedom, not price. Our +General Public Licenses are designed to make sure that you have the freedom to +distribute copies of free software (and charge for this service if you wish), +that you receive source code or can get it if you want it, that you can change +the software or use pieces of it in new free programs; and that you know you can +do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny +you these rights or to ask you to surrender the rights. These restrictions +translate to certain responsibilities for you if you distribute copies of the +library, or if you modify it. + +For example, if you distribute copies of the library, whether gratis or for a +fee, you must give the recipients all the rights that we gave you. You must make +sure that they, too, receive or can get the source code. If you link a program +with the library, you must provide complete object files to the recipients so +that they can relink them with the library after making changes to the library +and recompiling it. And you must show them these terms so they know their rights. + +Our method of protecting your rights has two steps: (1) copyright the library, +and (2) offer you this license, which gives you legal permission to copy, +distribute and/or modify the library. + +Also, for each distributor's protection, we want to make certain that everyone +understands that there is no warranty for this free library. If the library is +modified by someone else and passed on, we want its recipients to know that what +they have is not the original version, so that any problems introduced by others +will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We wish +to avoid the danger that companies distributing free software will individually +obtain patent licenses, thus in effect transforming the program into proprietary +software. To prevent this, we have made it clear that any patent must be licensed +for everyone's free use or not licensed at all. + +Most GNU software, including some libraries, is covered by the ordinary GNU +General Public License, which was designed for utility programs. This license, +the GNU Library General Public License, applies to certain designated libraries. +This license is quite different from the ordinary one; be sure to read it in +full, and don't assume that anything in it is the same as in the ordinary +license. + +The reason we have a separate public license for some libraries is that they blur +the distinction we usually make between modifying or adding to a program and +simply using it. Linking a program with a library, without changing the library, +is in some sense simply using the library, and is analogous to running a utility +program or application program. However, in a textual and legal sense, the linked +executable is a combined work, a derivative of the original library, and the +ordinary General Public License treats it as such. + +Because of this blurred distinction, using the ordinary General Public License +for libraries did not effectively promote software sharing, because most +developers did not use the libraries. We concluded that weaker conditions might +promote sharing better. + +However, unrestricted linking of non-free programs would deprive the users of +those programs of all benefit from the free status of the libraries themselves. +This Library General Public License is intended to permit developers of non-free +programs to use free libraries, while preserving your freedom as a user of such +programs to change the free libraries that are incorporated in them. (We have not +seen how to achieve this as regards changes in header files, but we have achieved +it as regards changes in the actual functions of the Library.) The hope is that +this will lead to faster development of free libraries. + +The precise terms and conditions for copying, distribution and modification +follow. Pay close attention to the difference between a "work based on the +library" and a "work that uses the library". The former contains code derived +from the library, while the latter only works together with the library. + +Note that it is possible for a library to be covered by the ordinary General +Public License rather than by this special one. + + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION +--------------------------------------------------------------- + +0. This License Agreement applies to any software library which contains a notice +placed by the copyright holder or other authorized party saying it may be +distributed under the terms of this Library General Public License (also called +"this License"). Each licensee is addressed as "you". + +A "library" means a collection of software functions and/or data prepared so as +to be conveniently linked with application programs (which use some of those +functions and data) to form executables. + +The "Library", below, refers to any such software library or work which has been +distributed under these terms. A "work based on the Library" means either the +Library or any derivative work under copyright law: that is to say, a work +containing the Library or a portion of it, either verbatim or with modifications +and/or translated straightforwardly into another language. (Hereinafter, +translation is included without limitation in the term "modification".) + +"Source code" for a work means the preferred form of the work for making +modifications to it. For a library, complete source code means all the source +code for all modules it contains, plus any associated interface definition files, +plus the scripts used to control compilation and installation of the library. + +Activities other than copying, distribution and modification are not covered by +this License; they are outside its scope. The act of running a program using the +Library is not restricted, and output from such a program is covered only if its +contents constitute a work based on the Library (independent of the use of the +Library in a tool for writing it). Whether that is true depends on what the +Library does and what the program that uses the Library does. + +1. You may copy and distribute verbatim copies of the Library's complete source +code as you receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice and disclaimer +of warranty; keep intact all the notices that refer to this License and to the +absence of any warranty; and distribute a copy of this License along with the +Library. + +You may charge a fee for the physical act of transferring a copy, and you may at +your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Library or any portion of it, thus +forming a work based on the Library, and copy and distribute such modifications +or work under the terms of Section 1 above, provided that you also meet all of +these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices stating + that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no charge to all + third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a table of + data to be supplied by an application program that uses the facility, other + than as an argument passed when the facility is invoked, then you must make + a good faith effort to ensure that, in the event an application does not + supply such function or table, the facility still operates, and performs + whatever part of its purpose remains meaningful. + + (For example, a function in a library to compute square roots has a purpose + that is entirely well-defined independent of the application. Therefore, + Subsection 2d requires that any application-supplied function or table used + by this function must be optional: if the application does not supply it, + the square root function must still compute square roots.) + + These requirements apply to the modified work as a whole. If identifiable + sections of that work are not derived from the Library, and can be + reasonably considered independent and separate works in themselves, then + this License, and its terms, do not apply to those sections when you + distribute them as separate works. But when you distribute the same + sections as part of a whole which is a work based on the Library, the + distribution of the whole must be on the terms of this License, whose + permissions for other licensees extend to the entire whole, and thus to + each and every part regardless of who wrote it. + + Thus, it is not the intent of this section to claim rights or contest your + rights to work written entirely by you; rather, the intent is to exercise + the right to control the distribution of derivative or collective works + based on the Library. + + In addition, mere aggregation of another work not based on the Library with + the Library (or with a work based on the Library) on a volume of a storage + or distribution medium does not bring the other work under the scope of + this License. + +3. You may opt to apply the terms of the ordinary GNU General Public License +instead of this License to a given copy of the Library. To do this, you must +alter all the notices that refer to this License, so that they refer to the +ordinary GNU General Public License, version 2, instead of to this License. (If a +newer version than version 2 of the ordinary GNU General Public License has +appeared, then you can specify that version instead if you wish.) Do not make any +other change in these notices. + +Once this change is made in a given copy, it is irreversible for that copy, so +the ordinary GNU General Public License applies to all subsequent copies and +derivative works made from that copy. + +This option is useful when you wish to copy part of the code of the Library into +a program that is not a library. + +4. You may copy and distribute the Library (or a portion or derivative of it, +under Section 2) in object code or executable form under the terms of Sections 1 +and 2 above provided that you accompany it with the complete corresponding +machine-readable source code, which must be distributed under the terms of +Sections 1 and 2 above on a medium customarily used for software interchange. + +If distribution of object code is made by offering access to copy from a +designated place, then offering equivalent access to copy the source code from +the same place satisfies the requirement to distribute the source code, even +though third parties are not compelled to copy the source along with the object +code. + +5. A program that contains no derivative of any portion of the Library, but is +designed to work with the Library by being compiled or linked with it, is called +a "work that uses the Library". Such a work, in isolation, is not a derivative +work of the Library, and therefore falls outside the scope of this License. + +However, linking a "work that uses the Library" with the Library creates an +executable that is a derivative of the Library (because it contains portions of +the Library), rather than a "work that uses the library". The executable is +therefore covered by this License. Section 6 states terms for distribution of +such executables. + +When a "work that uses the Library" uses material from a header file that is part +of the Library, the object code for the work may be a derivative work of the +Library even though the source code is not. Whether this is true is especially +significant if the work can be linked without the Library, or if the work is +itself a library. The threshold for this to be true is not precisely defined by +law. + +If such an object file uses only numerical parameters, data structure layouts and +accessors, and small macros and small inline functions (ten lines or less in +length), then the use of the object file is unrestricted, regardless of whether +it is legally a derivative work. (Executables containing this object code plus +portions of the Library will still fall under Section 6.) + +Otherwise, if the work is a derivative of the Library, you may distribute the +object code for the work under the terms of Section 6. Any executables containing +that work also fall under Section 6, whether or not they are linked directly with +the Library itself. + +6. As an exception to the Sections above, you may also compile or link a "work +that uses the Library" with the Library to produce a work containing portions of +the Library, and distribute that work under terms of your choice, provided that +the terms permit modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + +You must give prominent notice with each copy of the work that the Library is +used in it and that the Library and its use are covered by this License. You must +supply a copy of this License. If the work during execution displays copyright +notices, you must include the copyright notice for the Library among them, as +well as a reference directing the user to the copy of this License. Also, you +must do one of these things: + + a) Accompany the work with the complete corresponding machine-readable + source code for the Library including whatever changes were used in the + work (which must be distributed under Sections 1 and 2 above); and, if the + work is an executable linked with the Library, with the complete + machine-readable "work that uses the Library", as object code and/or source + code, so that the user can modify the Library and then relink to produce a + modified executable containing the modified Library. (It is understood that + the user who changes the contents of definitions files in the Library will + not necessarily be able to recompile the application to use the modified + definitions.) + + b) Accompany the work with a written offer, valid for at least three years, + to give the same user the materials specified in Subsection 6a, above, for + a charge no more than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy from a + designated place, offer equivalent access to copy the above specified + materials from the same place. + + d) Verify that the user has already received a copy of these materials or + that you have already sent this user a copy. + +For an executable, the required form of the "work that uses the Library" must +include any data and utility programs needed for reproducing the executable from +it. However, as a special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary form) with the +major components (compiler, kernel, and so on) of the operating system on which +the executable runs, unless that component itself accompanies the executable. + +It may happen that this requirement contradicts the license restrictions of other +proprietary libraries that do not normally accompany the operating system. Such a +contradiction means you cannot use both them and the Library together in an +executable that you distribute. + +7. You may place library facilities that are a work based on the Library +side-by-side in a single library together with other library facilities not +covered by this License, and distribute such a combined library, provided that +the separate distribution of the work based on the Library and of the other +library facilities is otherwise permitted, and provided that you do these two +things: + + a) Accompany the combined library with a copy of the same work based on the + Library, uncombined with any other library facilities. This must be + distributed under the terms of the Sections above. + + b) Give prominent notice with the combined library of the fact that part of + it is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + +8. You may not copy, modify, sublicense, link with, or distribute the Library +except as expressly provided under this License. Any attempt otherwise to copy, +modify, sublicense, link with, or distribute the Library is void, and will +automatically terminate your rights under this License. However, parties who have +received copies, or rights, from you under this License will not have their +licenses terminated so long as such parties remain in full compliance. + +9. You are not required to accept this License, since you have not signed it. +However, nothing else grants you permission to modify or distribute the Library +or its derivative works. These actions are prohibited by law if you do not accept +this License. Therefore, by modifying or distributing the Library (or any work +based on the Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying the Library +or works based on it. + +10. Each time you redistribute the Library (or any work based on the Library), +the recipient automatically receives a license from the original licensor to +copy, distribute, link with or modify the Library subject to these terms and +conditions. You may not impose any further restrictions on the recipients' +exercise of the rights granted herein. You are not responsible for enforcing +compliance by third parties to this License. + +11. If, as a consequence of a court judgment or allegation of patent infringement +or for any other reason (not limited to patent issues), conditions are imposed on +you (whether by court order, agreement or otherwise) that contradict the +conditions of this License, they do not excuse you from the conditions of this +License. If you cannot distribute so as to satisfy simultaneously your +obligations under this License and any other pertinent obligations, then as a +consequence you may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by all those +who receive copies directly or indirectly through you, then the only way you +could satisfy both it and this License would be to refrain entirely from +distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, and the +section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or +other property right claims or to contest validity of any such claims; this +section has the sole purpose of protecting the integrity of the free software +distribution system which is implemented by public license practices. Many people +have made generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that system; it is +up to the author/donor to decide if he or she is willing to distribute software +through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a +consequence of the rest of this License. + +12. If the distribution and/or use of the Library is restricted in certain +countries either by patents or by copyrighted interfaces, the original copyright +holder who places the Library under this License may add an explicit geographical +distribution limitation excluding those countries, so that distribution is +permitted only in or among countries not thus excluded. In such case, this +License incorporates the limitation as if written in the body of this License. + +13. The Free Software Foundation may publish revised and/or new versions of the +Library General Public License from time to time. Such new versions will be +similar in spirit to the present version, but may differ in detail to address new +problems or concerns. + +Each version is given a distinguishing version number. If the Library specifies a +version number of this License which applies to it and "any later version", you +have the option of following the terms and conditions either of that version or +of any later version published by the Free Software Foundation. If the Library +does not specify a license version number, you may choose any version ever +published by the Free Software Foundation. + +14. If you wish to incorporate parts of the Library into other free programs +whose distribution conditions are incompatible with these, write to the author to +ask for permission. For software which is copyrighted by the Free Software +Foundation, write to the Free Software Foundation; we sometimes make exceptions +for this. Our decision will be guided by the two goals of preserving the free +status of all derivatives of our free software and of promoting the sharing and +reuse of software generally. + +NO WARRANTY + +15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE +LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED +IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL +ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE +LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, +SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY +TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF +THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER +PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + +END OF TERMS AND CONDITIONS + + +How to Apply These Terms to Your New Libraries +---------------------------------------------- + +If you develop a new library, and you want it to be of the greatest possible use +to the public, we recommend making it free software that everyone can +redistribute and change. You can do so by permitting redistribution under these +terms (or, alternatively, under the terms of the ordinary General Public +License). + +To apply these terms, attach the following notices to the library. It is safest +to attach them to the start of each source file to most effectively convey the +exclusion of warranty; and each file should have at least the "copyright" line +and a pointer to where the full notice is found. + + one line to give the library's name and an idea of what it does. + + Copyright (C) year name of author + + This library is free software; you can redistribute it and/or + + modify it under the terms of the GNU Library General Public + + License as published by the Free Software Foundation; either + + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + + but WITHOUT ANY WARRANTY; without even the implied warranty of + + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + + License along with this library; if not, write to the Free Software + + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your school, +if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a +sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in + + the library `Frob' (a library for tweaking knobs) written + + by James Random Hacker. + + signature of Ty Coon, 1 April 1990 + + Ty Coon, President of Vice + +That's all there is to it! + +--- + +KernSmooth License +(KernSmooth 2.23-15) + +KernSmooth License +================== + +By agreement with Dr Wand (1998-June-22), the R port can be used and distributed +freely, superseding the comments in orig/KernSmooth.tex. + +The original S code is copyright Matt Wand, the R port copyright Brian Ripley + +--- + +MIT License +(acepack 1.4.1, bindr 0.1.1, bindrcpp 0.2.2, callr 3.1.0, cellranger 1.1.0, cli 1.0.1, crayon 1.3.4, curl 3.2, desc 1.2.0, dplyr 0.7.8, evaluate 0.12, glue 1.3.0, htmlwidgets 1.3, httr 1.4.0, jsonlite 1.6, labeling 0.3, magrittr 1.5, memoise 1.1.0, munsell 0.5.0, openxlsx 4.1.0, pip 19.1.1, pkgconfig 2.0.2, plyr 1.8.4, processx 3.2.1, PyTZ - Python Time Zone Library 2018.9, PyTZ - Python Time Zone Library 2019.1, R6 2.3.0, reshape 0.8.8, reshape2 1.4.3, rstudioapi 0.8, scales 1.0.0, setuptools 40.7.3, testthat 2.0.1, tibble 1.4.2, tidyr 0.8.2, visNetwork 2.0.5, xfun 0.4) + +The MIT License +=============== + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in the +Software without restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the +Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--- + +MIT License +(vis.js 4.20.1) + +The MIT License (MIT) + + + +Copyright (c) 2014-2017 Almende B.V. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE + +--- + +MIT License +(prettyunits 1.0.2) + +Upstream-Contact: Gabor Csardi +Source: https://cran.r-project.org/package=prettyunits + +Files: * +Copyright: 2014-2015 Gabor Csardi +License: MIT +Comment: + +Files: debian/* +Copyright: 2016 Andreas Tille +License: MIT + +License: MIT + +Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + . + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE + +--- + +Mozilla Public License 2.0 +(data.table 1.11.8, RSpectra 0.13-1) + +Mozilla Public License +Version 2.0 +====================== + + +1. Definitions +-------------- + + 1.1. "Contributor" + + means each individual or legal entity that creates, contributes to the creation + of, or owns Covered Software. + + 1.2. "Contributor Version" + + means the combination of the Contributions of others (if any) used by a + Contributor and that particular Contributor's Contribution. + + 1.3. "Contribution" + + means Covered Software of a particular Contributor. + + 1.4. "Covered Software" + + means Source Code Form to which the initial Contributor has attached the notice + in Exhibit A, the Executable Form of such Source Code Form, and Modifications + of such Source Code Form, in each case including portions thereof. + + 1.5. "Incompatible With Secondary Licenses" + + means + + a. + + that the initial Contributor has attached the notice described in Exhibit B + to the Covered Software; or + + b. + + that the Covered Software was made available under the terms of version 1.1 + or earlier of the License, but not also under the terms of a Secondary + License. + + 1.6. "Executable Form" + + means any form of the work other than Source Code Form. + + 1.7. "Larger Work" + + means a work that combines Covered Software with other material, in a separate + file or files, that is not Covered Software. + + 1.8. "License" + + means this document. + + 1.9. "Licensable" + + means having the right to grant, to the maximum extent possible, whether at the + time of the initial grant or subsequently, any and all of the rights conveyed + by this License. + + 1.10. "Modifications" + + means any of the following: + + a. + + any file in Source Code Form that results from an addition to, deletion + from, or modification of the contents of Covered Software; or + + b. + + any new file in Source Code Form that contains any Covered Software. + + 1.11. "Patent Claims" of a Contributor + + means any patent claim(s), including without limitation, method, process, and + apparatus claims, in any patent Licensable by such Contributor that would be + infringed, but for the grant of the License, by the making, using, selling, + offering for sale, having made, import, or transfer of either its Contributions + or its Contributor Version. + + 1.12. "Secondary License" + + means either the GNU General Public License, Version 2.0, the GNU Lesser + General Public License, Version 2.1, the GNU Affero General Public License, + Version 3.0, or any later versions of those licenses. + + 1.13. "Source Code Form" + + means the form of the work preferred for making modifications. + + 1.14. "You" (or "Your") + + means an individual or a legal entity exercising rights under this License. For + legal entities, "You" includes any entity that controls, is controlled by, or + is under common control with You. For purposes of this definition, "control" + means (a) the power, direct or indirect, to cause the direction or management + of such entity, whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial ownership of such + entity. + + +2. License Grants and Conditions +-------------------------------- + + + 2.1. Grants + + Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive + license: + + a. + + under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, modify, + display, perform, distribute, and otherwise exploit its Contributions, + either on an unmodified basis, with Modifications, or as part of a Larger + Work; and + + b. + + under Patent Claims of such Contributor to make, use, sell, offer for sale, + have made, import, and otherwise transfer either its Contributions or its + Contributor Version. + + + 2.2. Effective Date + + The licenses granted in Section 2.1 with respect to any Contribution become + effective for each Contribution on the date the Contributor first distributes + such Contribution. + + + 2.3. Limitations on Grant Scope + + The licenses granted in this Section 2 are the only rights granted under this + License. No additional rights or licenses will be implied from the distribution + or licensing of Covered Software under this License. Notwithstanding + Section 2.1(b) above, no patent license is granted by a Contributor: + + a. + + for any code that a Contributor has removed from Covered Software; or + + b. + + for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + + c. + + under Patent Claims infringed by Covered Software in the absence of its + Contributions. + + This License does not grant any rights in the trademarks, service marks, or + logos of any Contributor (except as may be necessary to comply with the notice + requirements in Section 3.4). + + + 2.4. Subsequent Licenses + + No Contributor makes additional grants as a result of Your choice to distribute + the Covered Software under a subsequent version of this License (see + Section 10.2) or under the terms of a Secondary License (if permitted under the + terms of Section 3.3). + + + 2.5. Representation + + Each Contributor represents that the Contributor believes its Contributions are + its original creation(s) or it has sufficient rights to grant the rights to its + Contributions conveyed by this License. + + + 2.6. Fair Use + + This License is not intended to limit any rights You have under applicable + copyright doctrines of fair use, fair dealing, or other equivalents. + + + 2.7. Conditions + + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in + Section 2.1. + + +3. Responsibilities +------------------- + + + 3.1. Distribution of Source Form + + All distribution of Covered Software in Source Code Form, including any + Modifications that You create or to which You contribute, must be under the + terms of this License. You must inform recipients that the Source Code Form of + the Covered Software is governed by the terms of this License, and how they can + obtain a copy of this License. You may not attempt to alter or restrict the + recipients' rights in the Source Code Form. + + + 3.2. Distribution of Executable Form + + If You distribute Covered Software in Executable Form then: + + a. + + such Covered Software must also be made available in Source Code Form, as + described in Section 3.1, and You must inform recipients of the Executable + Form how they can obtain a copy of such Source Code Form by reasonable + means in a timely manner, at a charge no more than the cost of distribution + to the recipient; and + + b. + + You may distribute such Executable Form under the terms of this License, or + sublicense it under different terms, provided that the license for the + Executable Form does not attempt to limit or alter the recipients' rights + in the Source Code Form under this License. + + + 3.3. Distribution of a Larger Work + + You may create and distribute a Larger Work under terms of Your choice, + provided that You also comply with the requirements of this License for the + Covered Software. If the Larger Work is a combination of Covered Software with + a work governed by one or more Secondary Licenses, and the Covered Software is + not Incompatible With Secondary Licenses, this License permits You to + additionally distribute such Covered Software under the terms of such Secondary + License(s), so that the recipient of the Larger Work may, at their option, + further distribute the Covered Software under the terms of either this License + or such Secondary License(s). + + + 3.4. Notices + + You may not remove or alter the substance of any license notices (including + copyright notices, patent notices, disclaimers of warranty, or limitations of + liability) contained within the Source Code Form of the Covered Software, + except that You may alter any license notices to the extent required to remedy + known factual inaccuracies. + + + 3.5. Application of Additional Terms + + You may choose to offer, and to charge a fee for, warranty, support, indemnity + or liability obligations to one or more recipients of Covered Software. + However, You may do so only on Your own behalf, and not on behalf of any + Contributor. You must make it absolutely clear that any such warranty, support, + indemnity, or liability obligation is offered by You alone, and You hereby + agree to indemnify every Contributor for any liability incurred by such + Contributor as a result of warranty, support, indemnity or liability terms You + offer. You may include additional disclaimers of warranty and limitations of + liability specific to any jurisdiction. + + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this License with +respect to some or all of the Covered Software due to statute, judicial order, or +regulation then You must: (a) comply with the terms of this License to the +maximum extent possible; and (b) describe the limitations and the code they +affect. Such description must be placed in a text file included with all +distributions of the Covered Software under this License. Except to the extent +prohibited by statute or regulation, such description must be sufficiently +detailed for a recipient of ordinary skill to be able to understand it. + + +5. Termination +-------------- + + 5.1. The rights granted under this License will terminate automatically if You + fail to comply with any of its terms. However, if You become compliant, then + the rights granted under this License from a particular Contributor are + reinstated (a) provisionally, unless and until such Contributor explicitly and + finally terminates Your grants, and (b) on an ongoing basis, if such + Contributor fails to notify You of the non-compliance by some reasonable means + prior to 60 days after You have come back into compliance. Moreover, Your + grants from a particular Contributor are reinstated on an ongoing basis if such + Contributor notifies You of the non-compliance by some reasonable means, this + is the first time You have received notice of non-compliance with this License + from such Contributor, and You become compliant prior to 30 days after Your + receipt of the notice. + + 5.2. If You initiate litigation against any entity by asserting a patent + infringement claim (excluding declaratory judgment actions, counter-claims, and + cross-claims) alleging that a Contributor Version directly or indirectly + infringes any patent, then the rights granted to You by any and all + Contributors for the Covered Software under Section 2.1 of this License shall + terminate. + + 5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user + license agreements (excluding distributors and resellers) which have been + validly granted by You or Your distributors under this License prior to + termination shall survive termination. + + +6. Disclaimer of Warranty +------------------------- + +Covered Software is provided under this License on an "as is" basis, without +warranty of any kind, either expressed, implied, or statutory, including, without +limitation, warranties that the Covered Software is free of defects, +merchantable, fit for a particular purpose or non-infringing. The entire risk as +to the quality and performance of the Covered Software is with You. Should any +Covered Software prove defective in any respect, You (not any Contributor) assume +the cost of any necessary servicing, repair, or correction. This disclaimer of +warranty constitutes an essential part of this License. No use of any Covered +Software is authorized under this License except under this disclaimer. + + +7. Limitation of Liability +-------------------------- + +Under no circumstances and under no legal theory, whether tort (including +negligence), contract, or otherwise, shall any Contributor, or anyone who +distributes Covered Software as permitted above, be liable to You for any direct, +indirect, special, incidental, or consequential damages of any character +including, without limitation, damages for lost profits, loss of goodwill, work +stoppage, computer failure or malfunction, or any and all other commercial +damages or losses, even if such party shall have been informed of the possibility +of such damages. This limitation of liability shall not apply to liability for +death or personal injury resulting from such party's negligence to the extent +applicable law prohibits such limitation. Some jurisdictions do not allow the +exclusion or limitation of incidental or consequential damages, so this exclusion +and limitation may not apply to You. + + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the courts of a +jurisdiction where the defendant maintains its principal place of business and +such litigation shall be governed by laws of that jurisdiction, without reference +to its conflict-of-law provisions. Nothing in this Section shall prevent a +party's ability to bring cross-claims or counter-claims. + + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it enforceable. +Any law or regulation which provides that the language of a contract shall be +construed against the drafter shall not be used to construe this License against +a Contributor. + + +10. Versions of the License +--------------------------- + + + 10.1. New Versions + + Mozilla Foundation is the license steward. Except as provided in Section 10.3, + no one other than the license steward has the right to modify or publish new + versions of this License. Each version will be given a distinguishing version + number. + + + 10.2. Effect of New Versions + + You may distribute the Covered Software under the terms of the version of the + License under which You originally received the Covered Software, or under the + terms of any subsequent version published by the license steward. + + + 10.3. Modified Versions + + If you create software not governed by this License, and you want to create a + new license for such software, you may create and use a modified version of + this License if you rename the license and remove any references to the name of + the license steward (except to note that such modified license differs from + this License). + + + 10.4. Distributing Source Code Form that is Incompatible With Secondary + Licenses + + If You choose to distribute Source Code Form that is Incompatible With + Secondary Licenses under the terms of this version of the License, the notice + described in Exhibit B of this License must be attached. + + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public License, + v. 2.0. If a copy of the MPL was not distributed with this file, You can + obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular file, then +You may include the notice in a location (such as a LICENSE file in a relevant +directory) where a recipient would be likely to look for such a notice. + +You may add additional accurate notices of copyright ownership. + + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as defined + by the Mozilla Public License, v. 2.0. + +--- + +NumPy license +Copyright © 2005-2019, NumPy Developers. +All rights reserved. +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +Neither the name of the NumPy Developers nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/README.md b/README.md new file mode 100644 index 0000000..13ac9a5 --- /dev/null +++ b/README.md @@ -0,0 +1,251 @@ +# Multi-omics systems toxicology of lung tissue reveals reduced biological effects of two heat-not-burn tobacco products compared with cigarette smoke + +This repository contains the R analysis code and R data objects for +the analysis of lung multi-omics data reported in Titz et +al. (submitted). + +## Content + +* **SCRIPTS/P15038_APOE_P2_MultiOmicsManuscript.Rmd** : Rmd file with + the analysis code +* **DATA/** : Folder with data files for each omics modality +* **DATA/EXTERNAL/** : Folder with external data files supporting the + analysis (see below how to obtain external files) +* **INFO/** : Folder with additional annotation files + +## Installation + +### R + +We have used R version 3.5.1, a more recent version of R should work +but hasn't been tested. + +### Install CRAN packages: + +```{r} + req_packages <- c("knitr", + "gridExtra", + "RColorBrewer", + "ggplot2", + "egg", + "reshape2", + "xlsx", + "readxl", + "openxlsx", + "tools", + "plotrix", + "gdata", + "plyr", + "dplyr", + "stringi", + "ggbeeswarm", + "visNetwork", + "devtools") + req_packages <- req_packages[!req_packages %in% rownames(installed.packages())] + if (length(req_packages) > 0) { + install.packages(req_packages) + } +``` + +### Install Bioconductor packages: + +```{r} + if (!requireNamespace("BiocManager", quietly = TRUE)) + install.packages("BiocManager") + BiocManager::install() + + req_packages <- c("limma", + "MOFA", + "mixOmics") + + req_packages <- req_packages[!req_packages %in% rownames(installed.packages())] + if (length(req_packages) > 0) { + BiocManager::install(req_packages) + } +``` + +Consult vignette of MOFA package for further details on the +installation, including the setup of the python environment. + +### Install github packages: + +```{r} + if (!"PCSF" %in% rownames(installed.packages())) { + BiocManager::install("topGO") + devtools::install_github("IOR-Bioinformatics/PCSF", repos=BiocManager::repositories(), + dependencies=TRUE, type="source", force=TRUE) + } + + if (!"NPA" %in% rownames(installed.packages())) { + devtools::install_github("philipmorrisintl/NPAModels", + dependencies=TRUE, + type="source") + devtools::install_github("philipmorrisintl/NPA", + dependencies=TRUE, + type="source") + } + + #available from Bioconductor (see above) + #devtools::install_github("bioFAM/MOFA", build_opts = c("--no-resave-data")) + +``` + +### Python + +Any Python3 version should be ok, we used 3.6.4. +Please note Python < 2.7 is not supported. + +* Create a Python virtualenv + +You can create it anywhere you have access. +```bash +$ python3 -m venv . +``` + +Activate it and install the necessary `mofapy`. +```bash +$ source bin/activate + +$ pip install -U pip setuptools +(...) +Successfully installed pip-19.1.1 setuptools-41.0.1 + +$ pip install mofapy +(...) +Successfully installed argparse-1.4.0 h5py-2.9.0 joblib-0.13.2 mofapy-1.2 numpy-1.16.4 pandas-0.24.2 python-dateutil-2.8.0 pytz-2019.1 scikit-learn-0.21.2 scipy-1.3.0 six-1.12.0 sklearn-0.0 +``` +Please note the version numbers are just an example. + +At any time you can deactivate the venv with the following command. +```bash +$ deactivate +``` +### Download this code/data package from github + +Create a new folder for the project which could be the same as the +Python's virtualenv, but this is not required, download and unzip +the repository (example, if done from R environment): + +```{r} +#set destination folder +project_folder = "path/to/project/folder" + +#create folder +dir.create(project_folder) +setwd(project_folder) + +#download from github +download.file(url = "https://github.com/philipmorrisintl/MouseLungMultiOmics/archive/1.0.0.zip", + destfile = "Lung_MultiOmics.zip") + +#unzip +unzip(zipfile = "Lung_MultiOmics.zip") + +#list content +list.files() + +``` + +### Obtain gene-set collections & network files +* mSigDB + + Check license terms before download + + Download gene-set collection files (gmt format) from + http://software.broadinstitute.org/gsea/downloads.jsp + + c2.all.v6.2.symbols.gmt and h.v6.2.symbols.gmt are required + + Save both files in DATA/EXTERNAL folder of project + +* StringDB + + Check license terms before download + + Download functional interaction network files from + https://version-10-5.string-db.org/cgi/download.pl?species_text=Mus+musculus + + 10090.protein.aliases.v10.5.txt and + 10090.protein.links.detailed.v10.5.txt are required (version + 10.5, unzip required) + + Save both txt files in DATA/EXTERNAL folder + +* miRTarBase + + Check license terms before download + + Download + http://mirtarbase.mbc.nctu.edu.tw/cache/download/7.0/mmu_MTI.xls + + We downloaded the version of 10 July 2018 (version 7.0) + + Save in DATA/EXTERNAL folder with name + mirTarBase_Mm_10July2018.xls (or adjust file name in script) + +* Reactome + + Check license terms before download + + Download und unzip https://reactome.org/download/current/ReactomePathways.gmt.zip + + We downloaded the version of 23 Apr 2018 + + Save gmt file as 'ReactomePathways_23Apr2018.gmt' + in DATA/EXTERNAL folder (or adjust file name in script) + +* KEGG (optional) + + Special license required see: https://www.kegg.jp/kegg/download/ + + Download und unzip kegg/genes/organisms/mmu/mmu_link.tar.gz + + Download und unzip kegg/genes/organisms/mmu/T01002.kff.gz + + Download und unzip kegg/ligand/reaction.tar.gz + + Save reaction_ko.list, reaction_mapformula.lst, and T01002.kff + in DATA/EXTERNAL folder + +## Run analysis +* Activate the previously created Python virtual environment +* Start R and change directory to the main project folder + (the folder with this README file). +* Adjust run options in script as necessary (force_rerun_mofa, + force_rerun_pcsf, force_recreate_network). Note that + a KEGG license is required to obtain the corresponding files, + creating the integrated network, and running the PCSF analysis. +* Execute the analysis and render the PDF file with the following command: + +```{r} + rmarkdown::render("SCRIPTS/P15038_APOE_P2_MultiOmicsManuscript.Rmd", + output_dir = "REPORT", + intermediates_dir = "REPORT", + clean = FALSE) + +``` + +The generated files, figures, and the rendered PDF report are located +in the **REPORT/** folder. + +## License + +We are releasing the analysis code (SCRIPTS/ folder) under the following license: + +> Copyright 2019 Philip Morris Products SA +> +> This program is free software; you can redistribute it and/or +> modify it under the terms of the GNU General Public License +> as published by the Free Software Foundation; either version 2 +> of the License, or (at your option) any later version. +> +> This program is distributed in the hope that it will be useful, +> but WITHOUT ANY WARRANTY; without even the implied warranty of +> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +> GNU General Public License for more details. +> +> You should have received a copy of the GNU General Public License +> along with this program; if not, write to the Free Software +> Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +Also, see Notices.txt for the licenses of the used packages/libraries. + + +For the shared data (DATA/ & INFO/ folders) : + +Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. + +## References +Titz et al. Multi-omics systems toxicology of lung tissue reveals +reduced biological effects of two heat-not-burn tobacco products +compared with cigarette smoke. *submitted* + + +## Related Repositories +- NPA (Network Perturbation Amplitude): +- NPAModels (R package and data for NPA models): + +## Contact +Bjoern Titz () + + diff --git a/SCRIPTS/FUNCTIONS/GetApproved.R b/SCRIPTS/FUNCTIONS/GetApproved.R new file mode 100644 index 0000000..12a1370 --- /dev/null +++ b/SCRIPTS/FUNCTIONS/GetApproved.R @@ -0,0 +1,68 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +#' This function GetApproved substitute synonyms with approved gene symbols. Note: it works for both character vector and idmap. +#' @export +#' @param Gene.Symbol is a \code{character} vector, or idmap. +#' @param species is a \code{string} which shouldd be "Hs", or "Mm", or "Rn". +#' @param nomatch is a \code{character} string. +#' @param ordered.Gene.Symbol is a \code{logical} string - returned result to be reordered. +#' @return A \code{character} vector if the input Gene.Symbol is a character vector, or and reordered idmap (by default) if Gene.Symbol is an idmap. +#' @author Yang Xiang \email{yang.xiang@@pmi.com} +GetApproved <- function(Gene.Symbol, species = c("Hs", "Mm", "Rn")[1], nomatch = c("Synonyms", "NA")[1], ordered.Gene.Symbol = TRUE) { + useLatest <- FALSE + + if (is.list(Gene.Symbol)) { # Gene.Symbol is idmap. + inputIsidmap <- TRUE + idmap <- Gene.Symbol + #if (!CheckNodeLabel(idmap)) stop("In function GetApproved, the first input is an idmap but with different nodeLabel for different contrasts. Please check its nodeLabel.") + # Gene.Symbol <- + Gene.Symbol <- gsub("^exp\\(|\\)$", "", as.character(idmap[[1]]$nodeLabel), ignore = TRUE) + } else { + inputIsidmap <- FALSE + } + + geneIDTable <- GetGeneIDTable(species = species, useLatest = useLatest) + approvedTable <- GetApprovedTable(species = species, useLatest = useLatest) + approvedSymbol <- geneIDTable[geneIDTable[, "type"] == "Approved", "Gene.Symbol"] + ind.syn <- which(!Gene.Symbol %in% approvedSymbol) + if (length(ind.syn) != 0) { + syn <- Gene.Symbol[ind.syn] + syn.mem <- syn + ind <- match(syn, approvedTable[, "Synonyms"]) + if (nomatch == "NA") { + syn <- approvedTable[, "Approved.Symbol"][ind] + } else { + syn[!is.na(ind)] <- approvedTable[, "Approved.Symbol"][ind[!is.na(ind)]] + } + Gene.Symbol[ind.syn] <- syn + } else { + cat("All the gene symbols are approved.\n") + } + + if (inputIsidmap) { + idmap.new <- lapply(idmap, function(x) { + x$nodeLabel <- paste("exp(", Gene.Symbol, ")", sep = "") + if (ordered.Gene.Symbol) x <- x[order(x$nodeLabel), ] + x$nodeLabel <- factor(x$nodeLabel) + return(x) + }) + return(idmap.new) + } + + return(Gene.Symbol) +} diff --git a/SCRIPTS/FUNCTIONS/GetApprovedTable.R b/SCRIPTS/FUNCTIONS/GetApprovedTable.R new file mode 100644 index 0000000..b0e358f --- /dev/null +++ b/SCRIPTS/FUNCTIONS/GetApprovedTable.R @@ -0,0 +1,27 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +GetApprovedTable <- function(species = c("Hs", "Mm", "Rn")[1]) { + fn <- sort(dir(pattern = paste("MapApprovedSynonyms.", + species, + sep = "" + ), path = file.path( + "../DATA" + ), full.names = FALSE), decreasing = TRUE)[1] + MapApprovedSynonyms <- load(fn) + return(MapApprovedSynonyms) +} diff --git a/SCRIPTS/FUNCTIONS/GetGeneIDTable.R b/SCRIPTS/FUNCTIONS/GetGeneIDTable.R new file mode 100644 index 0000000..ba3e392 --- /dev/null +++ b/SCRIPTS/FUNCTIONS/GetGeneIDTable.R @@ -0,0 +1,28 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +GetGeneIDTable <- function(species = c("Hs", "Mm", "Rn")[1], + dir.save = getwd()) { + dir.fun <- getwd() + + dataset.name <- paste0("GeneIDTable.", species) + + GeneIDTable <- load2(paste0("../DATA/", dataset.name)) + + setwd(dir.fun) + return(GeneIDTable) +} diff --git a/SCRIPTS/FUNCTIONS/GetHomologTable.R b/SCRIPTS/FUNCTIONS/GetHomologTable.R new file mode 100644 index 0000000..6c19fcc --- /dev/null +++ b/SCRIPTS/FUNCTIONS/GetHomologTable.R @@ -0,0 +1,113 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +#' This function GetHomologTable give the map table for homolog genes. Some core codes are from Bjoern Titz. +#' @export +#' @param build is a \code{character} \code{vector} with length 1. The latest version from NCBI website will be used if it is "current"; The latest saved version will be used if build is "saved"; Different build version will be used if build is "build*". for reproducibility, normal user can only use "saved" version. +#' @param species2code is an \code{list} which gives the taxonomy id for different species (http://www.ncbi.nlm.nih.gov/Taxonomy/taxonomyhome.html/). If we add more species in species2code, then the mapping of the additional species will be added. For example, "Taxonomy ID" of zebrafish is 7955, so if we use species2code=list(Mm=10090, Rn = 10116, Hs = 9606, Zebrafish=7955), zebrafish will be added. +#' @param A saved version with file name useThisFile will be used if useThisFile is not NULL. Default is NULL. +#' @return A list. +#' @author Yang Xiang \email{yang.xiang@@pmi.com}; Bjoern Titz \email{bjorn.titz@@pmi.com} +#' @examples +#' # HomologTable <- GetHomologTable(); +#' ## Or you can do for saved version +#' # data(HomologTable) +#' # if("from Hs to Mm" %in% names(HomologTable)) {stopifnot(c("C4b", "C4a") %in% as.vector(as.matrix(HomologTable$"from Hs to Mm"[HomologTable$"from Hs to Mm"$cluster_id == 36030 & HomologTable$"from Hs to Mm"$Gene.Symbol.x == "C4B", "Gene.Symbol.y"])))} +GetHomologTable <- function(build = c("current", "saved", "build67", "build68")[2], + species2code = list(Hs = 9606, Mm = 10090, Rn = 10116), + dir.save = getwd(), + useThisFile = NULL, + source.homolog = c("NCBI", "HCOP")[2]) { + if (build != "saved") { + warning("Only saved version is used for reproducibility of our analysis result. Please contact the developer or administrator for current (latest) or previous build.") + build <- "saved" # To keep stable result, only the developer or administrator can use this option. + } + if (!is.null(useThisFile)) build <- "saved" + ## Main section. + + dir.fun <- getwd() + CO <- expand.grid(names(species2code), names(species2code)) + CO <- as.matrix(CO[CO[, 1] != CO[, 2], ]) + colnames(CO) <- c("from_species", "to_species") + + res.2 <- vector("list", nrow(CO)) + names(res.2) <- paste("from ", CO[, 1], " to ", CO[, 2], sep = "") + + if (build != "saved") { + if (source.homolog == "HCOP") { + cat("ERROR\n") + cat("Use hcopCreateHomologTable() to create updated hcop table\n") + stop("use different function to create hcop orthology table") + } + fn <- paste("ftp://ftp.ncbi.nih.gov/pub/HomoloGene/", build, "/homologene.data", sep = "") + setwd(dir.save) + fn.save <- paste(dir.save, "/homologene.data", sep = "") + if (file.access(fn.save) == 0) unlink(fn.save) + stopifnot(try(download.file(fn, fn.save, method = "wget")) != "try-error") + fn <- fn.save + + res <- read.table(fn, sep = "\t", header = FALSE, as.is = TRUE, comment.char = "", quote = "") + colnames(res) <- c("cluster_id", "species_id", "GeneID", "Gene.Symbol", "ncbi_prot_ref", "ncbi_seq") + for (i in 1:nrow(CO)) { # i = c(1:nrow(CO))[3] + species_from_id <- species2code[[CO[i, "from_species"]]] + species_to_id <- species2code[[CO[i, "to_species"]]] + tab_from <- res[res$species_id == species_from_id, c("cluster_id", "species_id", "GeneID", "Gene.Symbol")] + tab_to <- res[res$species_id == species_to_id, c("cluster_id", "species_id", "GeneID", "Gene.Symbol")] + + tab_join <- base::merge(tab_from, tab_to, by = "cluster_id", all.x = TRUE) + res.2[[i]] <- tab_join + } + + HomologTable <- res.2 + + ## save GeneIDTable + + save(HomologTable, file = paste(dir.save, "/HomologTable.", + strsplit(as.character(Sys.time()), " ")[[1]][1], ".", build, ".rda", + sep = "" + )) + cat("\nSave HomologTable to file ", paste(dir.save, "/HomologTable.", + strsplit(as.character(Sys.time()), " ")[[1]][1], ".", build, ".rda", + sep = "" + ), "\n") + } else { # useLatest == FALSE + if (source.homolog == "NCBI") { + HomologTable <- load2("../DATA/HomologTable.rda") + return(HomologTable) + } else if (source.homolog == "HCOP") { + HCOP_ORTHOLOGY_TABLE <- load2("../DATA/HCOP_ORTHOLOGY_TABLE.rda") + return(HCOP_ORTHOLOGY_TABLE) + } else { + stop("selected homology table not available") + } + } + + + ## CP: + if ("from Hs to Mm" %in% names(HomologTable)) { + stopifnot(c("C4b", "C4a") %in% as.vector(as.matrix(HomologTable$"from Hs to Mm"[HomologTable$"from Hs to Mm"$cluster_id == 36030 & HomologTable$"from Hs to Mm"$Gene.Symbol.x == "C4B", "Gene.Symbol.y"]))) + } + if ("from Hs to Mm" %in% names(HomologTable)) { + stopifnot(c("LOC100910804", "Olr163", "LOC100910075", "Olr159") %in% HomologTable$"from Hs to Rn"[HomologTable$"from Hs to Rn"$cluster_id == "105161" & HomologTable$"from Hs to Rn"$Gene.Symbol.x == "OR52N4", "Gene.Symbol.y"]) + } + + ## Set back dir. + setwd(dir.fun) + + ## Return + return(HomologTable) +} diff --git a/SCRIPTS/FUNCTIONS/GetOrtholog.R b/SCRIPTS/FUNCTIONS/GetOrtholog.R new file mode 100644 index 0000000..a86ac08 --- /dev/null +++ b/SCRIPTS/FUNCTIONS/GetOrtholog.R @@ -0,0 +1,53 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +GetOrtholog <- +function (Gene.Symbol, species_from = c("Hs", "Mm", "Rn")[1], + species_to = c("Hs", "Mm", "Rn")[2], source.homolog = c("HCOP", + "NCBI")[1], HomologTable = NULL) +{ + if (is.null(HomologTable)) { + HomologTable = GetHomologTable(source.homolog = source.homolog) + } + stopifnot(source.homolog %in% c("Bioconductor", "NCBI", "HCOP")) + if (!paste0("from ", species_from, " to ", species_to) %in% + names(HomologTable)) + stop(species_from, " or ", species_to, " are not in names(HomologTable)") + comment <- attr(HomologTable, "comment") + HomologTable <- HomologTable[[paste0("from ", species_from, + " to ", species_to)]] + res <- sapply(Gene.Symbol, function(x) { + res.tmp = as.character(HomologTable[HomologTable$Gene.Symbol.x == + x, "Gene.Symbol.y"]) + if (length(res.tmp) == 1) { + return(res.tmp) + } + else if (length(res.tmp) == 0) { + return(NA) + } + else { + if (toupper(x) %in% toupper(res.tmp)) { + return(res.tmp[which(toupper(res.tmp) == toupper(x))][1]) + } + else { + return(res.tmp[1]) + } + } + }) + attr(res, "comment") <- comment + return(res) +} diff --git a/SCRIPTS/FUNCTIONS/ImagePlotGG.R b/SCRIPTS/FUNCTIONS/ImagePlotGG.R new file mode 100644 index 0000000..63ae4fa --- /dev/null +++ b/SCRIPTS/FUNCTIONS/ImagePlotGG.R @@ -0,0 +1,406 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +ImagePlotGG <- +function (X, group = factor(rep("", nrow(X))), group.col = factor(rep("", + ncol(X))), show.facet = TRUE, show.facet.x = show.facet, + names.arg = NULL, title = "Heatmap", subtitle = NULL, cex.txt = 1, + col.text = "black", col.facet.text = "white", cex.labx = 1, + cex.laby = cex.labx, col.lab = "grey40", col.group = colorRampPalette(brewer.pal(n = 7, + "Spectral"))(nlevels(group)), col.scale = NULL, cex.facet = 2, + cex.facetx = cex.facet, cex.facety = cex.facet, cex.main = 2, + zlim.max = Inf, zlim.min = -Inf, angle.facet.textx = 0, angle.facet.texty = -90, + BW = FALSE, textmat = matrix("", nrow = nrow(X), ncol = ncol(X)), + shape_key_title = "", cluster = FALSE, cluster.row = cluster, + cluster.col = cluster, symmetric = ifelse(sign(prod(range(X, + na.rm = TRUE))) == 1, FALSE, TRUE), dist.fun = function(x) { + dist(x, method = dist.method) + }, dist.fun.row = dist.fun, dist.fun.col = dist.fun, dist.method = "euclidean", + panel.name = "RdYlBu", key.title = "Value", grid.color = "grey50", + panelborder.color = "grey50", panel.lwd = 0, strip.bg = "grey20", + strip.border = "grey40", object.only = FALSE, newpage = FALSE, + useSymbols = FALSE, symbol_key_title = "", symbol_size = 1, + symbol_labels = NULL, color_na_values = "grey50") +{ + require(stringr) + if (!is.matrix(X)) { + X <- as.matrix(X) + } + if (setequal(as.character(rownames(X)), as.character(1:nrow(X)))) { + rownames(X) <- paste0("Row", rownames(X)) + } + if (setequal(as.character(colnames(X)), as.character(1:ncol(X)))) { + colnames(X) <- paste0("Col", colnames(X)) + } + if (ncol(X) == 1) { + cluster.col <- FALSE + } + if (nrow(X) == 1) { + cluster.row <- FALSE + } + if (max(table(paste(colnames(X), group.col))) > 1) { + t0 <- table(paste(colnames(X), group.col)) + stop(paste0("Some colnames are not unique (within group.col, if any):", + paste(names(t0)[t0 > 1], collapse = ", "))) + } + if (max(table(paste(rownames(X), group))) > 1) { + t0 <- table(paste(rownames(X), group)) + stop(paste0("Some rownames are not unique (within group, if any):", + paste(names(t0)[t0 > 1], collapse = ", "))) + } + if (!is.factor(group)) { + group <- factor(group) + } + if (!is.factor(group.col)) { + group.col <- factor(group.col) + } + txt <- textmat + if (!useSymbols) { + txt[is.na(txt)] <- "" + } + if (is.null(rownames(X))) { + rownames(X) <- paste0("Row", 1:nrow(X)) + } + rownames(X) <- paste0(rownames(X), "") + if (is.null(colnames(X))) { + colnames(X) <- paste0("Col", 1:ncol(X)) + } + colnames(X) <- paste0(colnames(X), "") + if (!all(dim(txt) == dim(X))) { + stop("textmat should have the same size as X") + } + flag.colnull <- 0 + if (is.null(col.scale)) { + flag.colnull <- 1 + if (sign(prod(range(X, na.rm = TRUE))) >= 0 & symmetric == + FALSE) { + col.scale <- c("white", brewer.pal(6, panel.name)[-1]) + } + else { + col.scale <- c(brewer.pal(n = 9, "Blues")[rev(c(2, + 5, 9))], "white", brewer.pal(n = 9, "YlOrRd")[c(2, + 5, 9)]) + } + } + ord1 <- 1:nrow(X) + Xclust <- X + Xclust[is.na(X)] <- 0 + if (cluster.row == TRUE) { + if (nlevels(group) == 1) { + hc0 <- hclust(as.dist(dist.fun(Xclust))) + ord1 <- hc0$order + } + else { + ind.all <<- NULL + tmp2 <- tapply(1:nrow(X), group, function(yy) { + if (length(yy) >= 3) { + tmp <- X[yy, , drop = FALSE] + tmp[is.na(tmp)] <- 0 + ind.1 <- hclust(dist.fun.row(tmp))$order + ind.all <<- c(ind.all, yy[ind.1]) + } + else { + ind.all <<- c(ind.all, yy) + } + }) + ord1 <- ind.all + } + group <- group[ord1] + X <- X[ord1, , drop = FALSE] + txt <- txt[ord1, , drop = FALSE] + } + if (cluster.col == TRUE) { + hc0 <- hclust(as.dist(dist.fun.col(t(Xclust)))) + ord2 <- hc0$order + X <- X[, ord2, drop = FALSE] + txt <- txt[, ord2, drop = FALSE] + group.col <- group.col[ord2] + } + if (zlim.max != Inf) { + X[X > zlim.max] <- zlim.max + } + if (zlim.min != -Inf) { + X[X < zlim.min] <- zlim.min + } + if (zlim.max != Inf | zlim.min != -Inf) { + txtsub <- paste0("(Data range truncated in ]", zlim.min, + ",", zlim.max, "[)") + if (!is.null(subtitle)) { + subtitle <- ifelse(subtitle == "", "", paste(subtitle, + txtsub)) + } + else { + subtitle <- txtsub + } + } + group2 <- apply(X, 2, function(x) as.character(group)) + if (nrow(X) == 1) { + group2 <- matrix(group2, nrow = 1) + } + group2.col <- t(apply(X, 1, function(x) as.character(group.col))) + if (ncol(X) == 1) { + group2.col <- t(group2.col) + } + rownames(txt) <- rownames(group2) <- rownames(group2.col) <- rownames(X) + colnames(txt) <- colnames(group2) <- colnames(group2.col) <- colnames(X) + plotlist <- list(coef = X, text = txt, group = group2, group.col = group2.col) + if (!is.null(names.arg)) { + if (length(names.arg) == ncol(X)) { + colnames(X) <- names.arg + } + else { + stop("names.arg must be of right length (ncol(X))") + } + } + col3 <- col.scale + if (length(col.group) == 1) { + col.group <- rep(col.group, nlevels(group)) + } + if (BW == TRUE) { + col3 <- gray(colSums(col2rgb(col3))/(3 * 255)) + col.group <- gray(colSums(col2rgb(col.group))/(3 * 255)) + if (!col.text %in% c("black", "white")) { + col.text <- "black" + } + } + D <- cbind(melt(plotlist$coef), melt(plotlist$text), melt(plotlist$group), + melt(plotlist$group.col)) + D <- D[, c(2, 1, 3, 6, 9, 12)] + colnames(D) <- c("Variable", "RowName", "Value", "Text", + "Group", "Group2") + D$Group2 <- factor(D$Group2, levels = levels(group.col)) + D$Group <- factor(D$Group, levels = levels(group)) + D$facet_fill_color <- col.group[match(D$Group, levels(group))] + p <- ggplot(D, aes(x = Variable, y = RowName)) + geom_tile(aes(fill = Value), + colour = grid.color) + if (show.facet.x == FALSE) { + p <- p + theme(strip.background = element_blank(), strip.text.x = element_blank()) + } + if (symmetric == TRUE) { + max_val <- 1.1 * max(abs(X), na.rm = TRUE) + values <- seq(-max_val, max_val, length = length(col3) + + 1) + p <- p + scale_fill_gradientn(colours = col3, name = key.title, + limits = c(-max_val, max_val), na.value = color_na_values) + + labs(x = "", y = "") + scale_x_discrete(expand = c(0, + 0)) + scale_y_discrete(expand = c(0, 0)) + } + else { + if (prod(range(X, na.rm = TRUE)) < 0) { + n <- 10 + c0 <- abs(max(X, na.rm = TRUE))/abs(min(X, na.rm = TRUE)) + val <- c(seq(min(X, na.rm = TRUE) * 1.1, -1e-10, + length = 50), 0, seq(1e-10, max(X, na.rm = TRUE) * + 1.1, length = 50)) + p <- p + scale_fill_gradientn(colours = col3, name = key.title, + values = val, limits = range(X, na.rm = TRUE) * + 1.1, breaks = cbreaks(range(X, na.rm = TRUE) * + 1.05, pretty_breaks(5))$breaks, rescaler = function(x, + ...) x, oob = identity, na.value = color_na_values) + + labs(x = "", y = "", title = title) + scale_x_discrete(expand = c(0, + 0)) + scale_y_discrete(expand = c(0, 0)) + } + else { + p <- p + scale_fill_gradientn(colours = col3, name = key.title, + breaks = cbreaks(range(X, na.rm = TRUE) * 1.05, + pretty_breaks(5))$breaks) + labs(x = "", y = "", + title = title) + scale_x_discrete(expand = c(0, + 0)) + scale_y_discrete(expand = c(0, 0)) + } + } + if (is.character(subtitle)) { + p <- p + ggtitle(bquote(atop(.(title), atop(italic(.(subtitle)), + "")))) + } + else { + p <- p + ggtitle(bquote(.(title))) + } + if (nlevels(group) > 1 & nlevels(group.col) == 1 & !is.null(col.group)) { + p <- p + facet_grid(Group ~ ., scales = "free", space = "free") + p <- p + theme(strip.background = element_blank()) + } + if (nlevels(group) > 1 & nlevels(group.col) == 1 & is.null(col.group)) { + p <- p + facet_grid(Group ~ ., scales = "free", space = "free") + p <- p + theme(strip.background = element_rect(colour = strip.border, + fill = strip.bg)) + } + if (nlevels(group) > 1 & nlevels(group.col) > 1) { + p <- p + facet_grid(Group ~ Group2, scales = "free", + space = "free") + p <- p + theme(strip.background = element_rect(colour = strip.border, + fill = strip.bg)) + } + if (nlevels(group) == 1 & nlevels(group.col) > 1) { + p <- p + facet_grid(. ~ Group2, scales = "free", space = "free") + if (show.facet.x == TRUE) { + p <- p + theme(strip.background = element_rect(colour = strip.border, + fill = strip.bg)) + } + } + p <- p + theme(axis.ticks = element_blank(), axis.text.x = element_text(size = 5 * + cex.labx, angle = 90, hjust = 0, colour = col.lab), axis.text.y = element_text(size = 5 * + cex.laby, colour = col.lab), plot.title = element_text(size = 12 * + cex.main), strip.text = element_text(color = col.facet.text), + strip.text.y = element_text(angle = angle.facet.texty, + size = 5 * cex.facety), strip.text.x = element_text(angle = angle.facet.textx, + size = 5 * cex.facetx), panel.border = element_rect(size = panel.lwd, + colour = panelborder.color, fill = NA)) + if (!useSymbols) { + p <- p + geom_text(aes(fill = Value, label = Text), colour = col.text, + size = 5 * cex.txt) + } + else { + D2 = D + D2$Text = as.character(D2$Text) + D2$Text = sapply(D2$Text, function(x) { + if (is.na(x)) { + return("NA") + } + else if (x == "") { + return("NA") + } + else { + x = gsub("-$", "-NA", gsub("^-", "NA-", gsub("--", + "-NA-", x))) + return(x) + } + }) + no_symbols = str_count(as.character(D2$Text)[1], "-") + + 1 + all_symbols = c() + for (i in 1:no_symbols) { + D2[, paste0("Text", i)] = as.character(getsplit(as.character(D2$Text), + "-", i)) + D2[, paste0("Text", i)][D2[, paste0("Text", i)] == + "NA"] = NA + all_symbols = c(all_symbols, unique(as.numeric(D2[, + paste0("Text", i)]))) + } + text_shifts = c() + if (no_symbols == 1) { + D2$Shift1 = 0 + } + else if (no_symbols == 2) { + D2$Shift1 = -0.2 + D2$Shift2 = 0.2 + } + else if (no_symbols == 3) { + D2$Shift1 = -0.3 + D2$Shift2 = 0 + D2$Shift3 = 0.3 + } + else if (no_symbols == 4) { + D2$Shift1 = -0.3 + D2$Shift2 = -0.1 + D2$Shift3 = 0.1 + D2$Shift4 = 0.3 + } + else if (no_symbols == 5) { + D2$Shift1 = -0.4 + D2$Shift2 = -0.2 + D2$Shift3 = 0 + D2$Shift4 = 0.2 + D2$Shift5 = 0.4 + } + else { + stop(paste0(no_symbols), " number of symbols not supported yet") + } + if (no_symbols == 1) { + p2 = p + geom_point(aes(x = Variable, shape = factor(Text1)), + size = symbol_size, colour = col.text, data = D2, + fill = "black") + } + else if (no_symbols > 1) { + p2 = p + geom_point(aes(x = as.numeric(Variable) + + Shift1, shape = factor(Text1)), size = symbol_size, + colour = col.text, data = D2, fill = "black") + p2 = p2 + geom_point(aes(x = as.numeric(Variable) + + Shift2, shape = factor(Text2)), size = symbol_size, + colour = col.text, data = D2, fill = "black") + } + if (no_symbols > 2) { + p2 = p2 + geom_point(aes(x = as.numeric(Variable) + + Shift3, shape = factor(Text3)), size = symbol_size, + colour = col.text, data = D2, fill = "black") + } + if (no_symbols > 3) { + p2 = p2 + geom_point(aes(x = as.numeric(Variable) + + Shift4, shape = factor(Text4)), size = symbol_size, + colour = col.text, data = D2, fill = "black") + } + if (no_symbols > 4) { + p2 = p2 + geom_point(aes(x = as.numeric(Variable) + + Shift5, shape = factor(Text5)), size = symbol_size, + colour = col.text, data = D2, fill = "black") + } + val_list <- all_symbols + names(val_list) <- as.character(all_symbols) + if (is.null(symbol_labels)) { + symbol_labels <- val_list + } + p2 <- p2 + scale_shape_manual(symbol_key_title, values = val_list, + labels = symbol_labels) + p = p2 + } + if (nlevels(group) > 1 & nlevels(group.col) == 1 & !is.null(col.group)) { + dummy <- ggplot(D, aes(x = Variable, y = RowName)) + + facet_grid(Group ~ ., scales = "free", space = "free") + + geom_rect(aes(fill = Group), xmin = -Inf, xmax = Inf, + ymin = -Inf, ymax = Inf, color = "black") + scale_fill_manual("Group", + values = col.group) + theme(strip.text = element_text(color = col.facet.text), + strip.text.y = element_text(angle = angle.facet.texty, + size = 5 * cex.facety), strip.background = element_blank()) + g1 <- ggplotGrob(p) + g2 <- ggplotGrob(dummy) + gtable_select <- function(x, ...) { + matches <- c(...) + x$layout <- x$layout[matches, , drop = FALSE] + x$grobs <- x$grobs[matches] + x + } + panels <- grepl(pattern = "panel", g2$layout$name) + strips <- grepl(pattern = "strip-right", g2$layout$name) + g2$layout$r[panels] <- g2$layout$r[panels] + 1 + g2$layout$l[panels] <- g2$layout$l[panels] + 1 + new_strips <- gtable_select(g2, panels | strips) + gtable_stack <- function(g1, g2) { + g1$grobs <- c(g1$grobs, g2$grobs) + g1$layout <- transform(g1$layout, z = z - max(z), + name = "g2") + g1$layout <- rbind(g1$layout, g2$layout) + g1 + } + new_plot <- gtable_stack(g1, new_strips) + p <- new_plot + if (object.only == FALSE) { + if (newpage == TRUE) { + grid.newpage() + } + p <- grid.draw(new_plot) + print(p) + } + } + else { + if (object.only == FALSE) { + if (newpage == TRUE) { + grid.newpage() + } + print(p) + } + } + return(invisible(p)) +} diff --git a/SCRIPTS/FUNCTIONS/barchartNonOmicsMouse.R b/SCRIPTS/FUNCTIONS/barchartNonOmicsMouse.R new file mode 100644 index 0000000..7842657 --- /dev/null +++ b/SCRIPTS/FUNCTIONS/barchartNonOmicsMouse.R @@ -0,0 +1,42 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +barchartNonOmicsMouse <- function(dat_comb, ep, laby, cols = cols_mouse) { + dat <- dat_comb[dat_comb$EndpointMapped == ep, ] + endpoint_name <- getsplit(ep, "|", 1:3) + + dat$Group <- factor(dat$Group, levels = levels(dat$Group)) + dat$y_range <- max(dat$Mean, na.rm = TRUE) - min(dat$Mean, na.rm = TRUE) + + p <- ggplot(aes(x = Group, y = Mean, fill = Group, label = p.value_label), data = dat) + p <- p + geom_bar(stat = "identity", width = 0.6) + p <- p + scale_fill_manual("", values = cols, guide = FALSE) + p <- p + geom_errorbar(aes(ymin = Mean - StdErr, ymax = Mean + StdErr), width = .2) + p <- p + geom_text(aes(y = Mean + y_range / 20, x = Group), colour = "red", size = 11) + # p <- p + labs(x = "", y = laby, title = endpoint_name) + p <- p + labs(x = "", y = laby, title = "") + p <- p + theme_bw() + p <- p + theme(axis.text.x = element_text(angle = 45, hjust = 1, vjust = 1, colour = "black", size = 12)) + p <- p + theme(axis.text.y = element_text(angle = 0, hjust = 1, vjust = 0.5, colour = "black", size = 12)) + p <- p + theme(plot.title = element_text(size = 12, face = "bold")) + p <- p + theme(axis.title = element_text(size = 12, face = "bold")) + p <- p + theme(strip.background = element_blank()) + p <- p + theme(strip.text = element_text(colour = "black", size = 12, face = "bold")) + p <- p + geom_hline(yintercept = 0, colour = "black") + p <- p + theme(panel.spacing.x = unit(0, "lines"), panel.spacing.y = unit(0, "lines")) + return(p) +} diff --git a/SCRIPTS/FUNCTIONS/cleanGeneName.R b/SCRIPTS/FUNCTIONS/cleanGeneName.R new file mode 100644 index 0000000..6b5a507 --- /dev/null +++ b/SCRIPTS/FUNCTIONS/cleanGeneName.R @@ -0,0 +1,20 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +cleanGeneName <- function(x) { + return(x) +} diff --git a/SCRIPTS/FUNCTIONS/cleanIDMAP.R b/SCRIPTS/FUNCTIONS/cleanIDMAP.R new file mode 100644 index 0000000..fa944ec --- /dev/null +++ b/SCRIPTS/FUNCTIONS/cleanIDMAP.R @@ -0,0 +1,132 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +#' Clean an IDMAPS object +#' +#' Ensure that contrasts are consistent each others in terms +#' of genes symbols, ordering... +#' +#' @export +#' @import BiocGenerics +#' @param dL A \code{list} correponding to an IDMAPS R object. +#' @param upper \code{boolean}. TRUE to convert all 'nodeLabel' to uppercase, FAlSE by default. +#' @param replace.na \code{boolean}. TRUE to replace NAs by a numeric value. +#' @param replacement.value \code{numeric}. The numeric value to replace NAs. +#' @return A \code{list} correponding to an IDMAPS R object cleaned. +#' @author Florian Martin +cleanIDMAP <- function(dL, upper = FALSE, replace.na = TRUE, replacement.value = 0) { + attr0 <- getAttr(dL) + attr0.idmap <- lapply(dL, getAttr) + in.col <- Reduce(intersect, lapply(dL, colnames)) + if (!all(c("foldChange", "t", "p.value", "adj.p.value") %in% in.col)) { + stop("colnames of idmap entries not similar enough!") + } + dL <- lapply(dL, function(X) return(X[, colnames(X) %in% in.col])) + + if (upper == TRUE) { + dL <- lapply(dL, function(x) { + y <- x + y$nodeLabel <- factor(toupper(y$nodeLabel)) + return(y) + }) + } else { + dL <- lapply(dL, function(x) { + y <- x + y$nodeLabel <- factor(y$nodeLabel) + return(y) + }) + } + dL <- lapply(dL, function(x) { + y <- x[!duplicated(as.character(x$nodeLabel)), ] + return(y) + }) + dL <- lapply(dL, function(x) { + y <- x[order(as.character(x$nodeLabel)), ] + return(y) + }) + nm <- lapply(dL, function(G) { + G$nodeLabel + }) + ok <- sapply(nm, function(n) { + ok <- TRUE + if (length(n) != length(nm[[1]])) { + ok <- FALSE + } else { + ok <- all(sort(as.character(n)) == sort(as.character(nm[[1]]))) + } + return(ok) + }) + if (!all(ok == TRUE)) { + warning("Issue with ids in dL. Cleaning process is performed") + allids <- as.character(sort(unique(unlist(lapply(dL, function(x) { + as.character(x$nodeLabel) + }))))) + if (upper) { + allids <- toupper(allids[!duplicated(toupper(allids))]) + } + dL <- lapply(dL, function(x) { + y <- x + if (!"p.value" %in% colnames(y)) { + pv0 <- 0 * y$foldChange + s <- y$foldChange / y$t + s[y$t == 0] <- 0 + y$p.value <- 2 * pt(abs(y$foldChange) / (s + 1e-12), y$df, lower.tail = FALSE) + } + matNA <- matrix(NA, ncol = ncol(y), nrow = length(allids[!allids %in% + x$nodeLabel])) + matNA[, colnames(y) == "nodeLabel"] <- allids[!allids %in% x$nodeLabel] + colnames(matNA) <- colnames(y) + y <- as.data.frame(rbind(y, as.data.frame(matNA))) + y <- y[order(as.character(y$nodeLabel)), ] + if (replace.na == TRUE & is.na(replacement.value)) { + stop("replacement.value is NA and relpace.na is TRUE!") + } + if (!is.na(replacement.value) & replace.na == TRUE) { + y$foldChange[is.na(y$foldChange)] <- replacement.value + y$p.value[is.na(y$p.value)] <- 1 - replacement.value + y$adj.p.value[is.na(y$adj.p.value)] <- 1 - replacement.value + y$t[is.na(y$t)] <- replacement.value + if ("df" %in% colnames(y)) { + y$df[is.na(y$df)] <- replacement.value + } + } + y[, colnames(y) %in% c("foldChange", "t", "df", "p.value", "adj.p.value")] <- apply( + y[ + , + colnames(y) %in% c("foldChange", "t", "df", "p.value", "adj.p.value") + ], + 2, as.numeric + ) + return(y) + }) + + nm <- sapply(dL, function(G) { + G$nodeLabel + }) + if (!all(apply(nm, 1, function(x) all(x == x[1])))) { + stop("Issue with ids in dL") + } + } + for (k in 1:length(dL)) { + rownames(dL[[k]]) <- dL[[k]]$nodeLabel + dL[[k]] <- setAttr(dL[[k]], attr0.idmap[[k]]) + } + if (length(attr0) > 0) { + dL <- setAttr(dL, attr0) + } + return(dL) +} diff --git a/SCRIPTS/FUNCTIONS/cluster_layout.R b/SCRIPTS/FUNCTIONS/cluster_layout.R new file mode 100644 index 0000000..16f0904 --- /dev/null +++ b/SCRIPTS/FUNCTIONS/cluster_layout.R @@ -0,0 +1,40 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +cluster_layout <- function(graph, sel_weights = c(0.2, 1), seed = 98234) { + if (!is.null(seed)) { + set.seed(seed) + } + + g2 <- graph + + cl_member <- V(graph)$group + names(cl_member) <- V(graph)$name + + e_mat <- get.edges(g2, E(g2)) + e_mat[, 1] <- V(g2)$name[as.numeric(e_mat[, 1])] + e_mat[, 2] <- V(g2)$name[as.numeric(e_mat[, 2])] + e_mat <- as.data.frame(e_mat) + e_mat$C1 <- cl_member[e_mat[, 1]] + e_mat$C2 <- cl_member[e_mat[, 2]] + eweights <- ifelse(e_mat$C1 == e_mat$C2, sel_weights[1], sel_weights[2]) + glayout2 <- layout.fruchterman.reingold(g2, weights = eweights) + + glayout <- glayout2[match(V(graph)$name, V(g2)$name), ] + + return(glayout) +} diff --git a/SCRIPTS/FUNCTIONS/getAttr.R b/SCRIPTS/FUNCTIONS/getAttr.R new file mode 100644 index 0000000..0ba3913 --- /dev/null +++ b/SCRIPTS/FUNCTIONS/getAttr.R @@ -0,0 +1,31 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +getAttr <- function(x) { + nm.attr <- names(attributes(x)) + nm.attr <- nm.attr[!nm.attr %in% c("names", "row.names")] + attr0 <- NULL + if (length(nm.attr) > 0) { + attr0 <- vector("list", length(nm.attr)) + names(attr0) <- nm.attr + for (n in 1:length(attr0)) { + attr0[[n]] <- attr(x, nm.attr[n]) + } + names(attr0) <- nm.attr + } + return(attr0) +} diff --git a/SCRIPTS/FUNCTIONS/getDEG.R b/SCRIPTS/FUNCTIONS/getDEG.R new file mode 100644 index 0000000..ae6ae0c --- /dev/null +++ b/SCRIPTS/FUNCTIONS/getDEG.R @@ -0,0 +1,51 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +getDEG <- + function(dL, fdr = 0.05, fcth = 0, full = TRUE, pvtype = c( + "fdr", + "raw" + )[1]) { + if (pvtype == "fdr") { + if (full == FALSE) { + return(lapply(dL, function(x) { + as.character(x$nodeLabel[!is.na(x$adj.p.value) & + x$adj.p.value < fdr & abs(x$foldChange) > fcth]) + })) + } + if (full == TRUE) { + return(lapply(dL, function(x) { + x[!is.na(x$adj.p.value) & x$adj.p.value < fdr & + abs(x$foldChange) > fcth, , ] + })) + } + } + if (pvtype == "raw") { + if (full == FALSE) { + return(lapply(dL, function(x) { + as.character(x$nodeLabel[!is.na(x$adj.p.value) & + x$p.value < fdr & abs(x$foldChange) > fcth]) + })) + } + if (full == TRUE) { + return(lapply(dL, function(x) { + x[!is.na(x$adj.p.value) & x$p.value < fdr & abs(x$foldChange) > + fcth, , ] + })) + } + } + } diff --git a/SCRIPTS/FUNCTIONS/getFromIDMAP.R b/SCRIPTS/FUNCTIONS/getFromIDMAP.R new file mode 100644 index 0000000..1b8341b --- /dev/null +++ b/SCRIPTS/FUNCTIONS/getFromIDMAP.R @@ -0,0 +1,77 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +getFromIDMAP <- + function(idmap, genes, type = c( + "all", "foldChange", "adj.pvalue", + "p.value" + )[1], fixed = TRUE, exact = FALSE, ...) { + genes <- cleanGeneName(genes) + idmap <- lapply(idmap, function(x) { + x$nodeLabel <- cleanGeneName(x$nodeLabel) + return(x) + }) + if (exact == FALSE) { + tmp0 <- lapply(idmap, function(x) { + x[unlist(grep2(toupper(genes), cleanGeneName(toupper(x$nodeLabel)), + fixed = fixed, ... + )), , drop = FALSE] + }) + if (type == "all") { + return(tmp0) + } + if (type != "all") { + tmp <- sapply(idmap, function(x) { + x[unlist(grep2(toupper(genes), cleanGeneName(toupper(x$nodeLabel)), + fixed = fixed + )), colnames(x) == type] + }) + if (class(tmp) != "matrix") { + nm <- names(tmp) + tmp <- matrix(unlist(tmp), nrow = 1) + colnames(tmp) <- nm + } + rownames(tmp) <- tmp0[[1]]$nodeLabel + return(tmp) + } + } + else { + tmp0 <- lapply(idmap, function(x) { + x[toupper(x$nodeLabel) %in% cleanGeneName(toupper(genes)) + , , + drop = FALSE + ] + }) + if (type == "all") { + return(tmp0) + } + if (type != "all") { + tmp <- sapply(idmap, function(x) { + x[ + toupper(x$nodeLabel) %in% cleanGeneName(toupper(genes)), + colnames(x) == type + ] + }) + if (class(tmp) != "matrix") { + nm <- names(tmp) + tmp <- matrix(unlist(tmp), nrow = 1) + colnames(tmp) <- nm + } + rownames(tmp) <- tmp0[[1]]$nodeLabel + return(tmp) + } + } + } diff --git a/SCRIPTS/FUNCTIONS/getGMT_GS.R b/SCRIPTS/FUNCTIONS/getGMT_GS.R new file mode 100644 index 0000000..dfa2c6c --- /dev/null +++ b/SCRIPTS/FUNCTIONS/getGMT_GS.R @@ -0,0 +1,28 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +getGMT_GS <- function(gmt_file_name) { + gmt <- readr::read_delim(gmt_file_name, delim = "\t", col_names = FALSE) %>% + as.data.frame() + gsc <- list() + for (i in seq_len(nrow(gmt))) { + genes <- unlist(gmt[i,3:ncol(gmt), drop = TRUE]) + genes <- genes[!is.na(genes)] + gs_name <- gmt[i,1] + gsc[[gs_name]] <- unname(genes) + } + return(gsc) +} \ No newline at end of file diff --git a/SCRIPTS/FUNCTIONS/getGS.R b/SCRIPTS/FUNCTIONS/getGS.R new file mode 100644 index 0000000..ed5964c --- /dev/null +++ b/SCRIPTS/FUNCTIONS/getGS.R @@ -0,0 +1,38 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +getGS <- + function(name = NULL) { + fp <- "../DATA/" + if (is.null(name)) { + cat("Possible (but not all ) values for name are:", fill = TRUE) + nms <- gsub(".rda", "", dir(fp, pattern = "rda$"), fixed = TRUE) + nms <- nms[!nms %in% c( + "genesets.as.hyps.hs", + "MarkerPanels", "GSAPM.example" + )] + cat(paste(nms, collapse = "\n"), fill = TRUE) + return(nms) + } + else { + GS <- load2(paste0(fp, "/", name, ".rda")) + if (is.data.frame(GS[[1]])) { + GS <- lapply(GS, function(x) unique(as.character(x$nodeLabel))) + } + return(GS) + } + } diff --git a/SCRIPTS/FUNCTIONS/getIDMAPentry.R b/SCRIPTS/FUNCTIONS/getIDMAPentry.R new file mode 100644 index 0000000..50494e9 --- /dev/null +++ b/SCRIPTS/FUNCTIONS/getIDMAPentry.R @@ -0,0 +1,58 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +getIDMAPentry <- + function(idmap, entry = "foldChange", GS = FALSE) { + nr <- sapply(idmap, nrow) + flag <- 0 + if (!all(nr == nr[1])) { + flag <- 1 + } + else { + nm <- sapply(idmap, function(G) { + G$nodeLabel + }) + if (nr == 1) { + nm <- matrix(nm, nrow = 1) + } + if (!all(apply(nm, 1, function(x) { + all(x == x[1]) + }))) { + flag <- 1 + } + } + if (flag == 1) { + message("Re-arranging unequal sized idmap...") + allids <- as.character(sort(unique(unlist(lapply( + idmap, + function(x) { + x$nodeLabel + } + ))))) + idmap <- cleanIDMAP(idmap) + } + out <- sapply(idmap, function(x) x[, colnames(x) == entry]) + if (nrow(idmap[[1]]) == 1) { + out <- matrix(out, nrow = 1) + colnames(out) <- names(idmap) + } + rownames(out) <- idmap[[1]]$nodeLabel + if (GS == TRUE) { + rownames(out) <- cleanGeneName(as.character(idmap[[1]]$nodeLabel)) + } + return(out) + } diff --git a/SCRIPTS/FUNCTIONS/getIDMAPheatmapGG.R b/SCRIPTS/FUNCTIONS/getIDMAPheatmapGG.R new file mode 100644 index 0000000..e49dad2 --- /dev/null +++ b/SCRIPTS/FUNCTIONS/getIDMAPheatmapGG.R @@ -0,0 +1,109 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +getIDMAPheatmapGG <- + function(idmap, genes, gene.categories = NULL, species = NULL, + BW = FALSE, pvthresh = c(0.05, 0.01), pvthresh.symbols = c( + 4, + 8 + ), symbol_size = 2, pvtype = c("p.value", "adj.p.value")[2], + subtitle = NULL, key.title = "log2(FC)", title = "log2(Fold-change) Heatmap", + ...) { + useSymbols <- FALSE + if (is.numeric(pvthresh.symbols)) { + useSymbols <- TRUE + } + if (length(pvthresh) != length(pvthresh.symbols)) { + pvsymb <- sapply(1:length(pvthresh), function(i) { + paste(rep(pvthresh.symbols[1], i), collapse = "") + }) + } + else { + pvsymb <- pvthresh.symbols[order(pvthresh, decreasing = TRUE)] + } + pvtype2 <- c("p-value", "fdr")[match(pvtype, c( + "p.value", + "adj.p.value" + ))] + message(pvthresh[order(pvthresh, decreasing = TRUE)]) + message(pvsymb) + fcs <- getIDMAPentry(idmap) + pvs <- getIDMAPentry(idmap, entry = pvtype) + gin0 <- genes + gin <- gin0[gin0 %in% rownames(fcs)] + if (is.null(gene.categories)) { + gene.categories <- rep("", length(gin)) + } + else { + gene.categories <- factor(gene.categories[gin0 %in% gin]) + } + gr <- factor(gene.categories) + fcs <- fcs[match(gin, rownames(fcs)), , drop = FALSE] + pvs <- pvs[match(gin, rownames(pvs)), , drop = FALSE] + if (max(table(paste(rownames(fcs), gr))) > 1) { + t0 <- table(paste(rownames(fcs), gr)) + gnm <- rownames(fcs) + fcs <- fcs[!duplicated(paste(gnm, gr)), , drop = FALSE] + pvs <- pvs[!duplicated(paste(gnm, gr)), , drop = FALSE] + gr <- gr[!duplicated(paste(gnm, gr))] + warning(paste0( + "Some rownames are not unique (within group, if any):", + paste(names(t0)[t0 > 1], collapse = ", ") + )) + } + if (BW == FALSE) { + txt <- matrix(NA, nrow(pvs), ncol(pvs)) + pvthresh <- pvthresh[order(pvthresh, decreasing = TRUE)] + for (k in 1:length(pvthresh)) { + txt[pvs < pvthresh[k]] <- pvsymb[k] + } + symlab <- paste0("<", pvthresh) + names(symlab) <- pvsymb + ImagePlotGG(fcs, + textmat = txt, useSymbols = useSymbols, + symbol_labels = symlab, symbol_key_title = pvtype2, + group = gr, subtitle = subtitle, symbol_size = symbol_size, + key.title = key.title, title = title, ... + ) + } + else { + if (length(pvthresh) > 1) { + warning("In BW only two thresholds are allowed.") + pvthresh <- pvthresh[1] + } + pvsymb <- c(24, 25) + txt <- matrix(NA, nrow(pvs), ncol(pvs)) + txt[pvs < pvthresh[1] & fcs <= 0] <- pvsymb[2] + txt[pvs < pvthresh[1] & fcs > 0] <- pvsymb[1] + symlab <- c( + paste0("log2(fc)>0 & ", pvtype2, " <", pvthresh), + paste0("log2(fc)<0 & ", pvtype2, " <", pvthresh) + ) + names(symlab) <- pvsymb + sub0 <- subtitle + ImagePlotGG(abs(fcs), + textmat = txt, useSymbols = useSymbols, + symbol_labels = symlab, symbol_key_title = pvtype2, + group = gr, subtitle = subtitle, symbol_size = symbol_size, + key.title = paste0("|", key.title, "|"), title = title, + col.scale = c( + "gray90", "gray70", "gray50", "grey40", + "gray30" + ), ... + ) + } + } diff --git a/SCRIPTS/FUNCTIONS/getLayoutMatrix.R b/SCRIPTS/FUNCTIONS/getLayoutMatrix.R new file mode 100644 index 0000000..33947b2 --- /dev/null +++ b/SCRIPTS/FUNCTIONS/getLayoutMatrix.R @@ -0,0 +1,40 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +getLayoutMatrix <- +function (which_order_volcano, norow, nocol) +{ + layout = matrix(NA, nrow = norow, ncol = nocol) + count = 1 + for (i in 1:norow) { + for (k in 1:nocol) { + if (count > length(which_order_volcano)) { + pos = count + } + else { + pos = which_order_volcano[count] + } + if (pos == -1) { + pos = max(which_order_volcano, layout, na.rm = TRUE) + + 1 + } + layout[i, k] = pos + count = count + 1 + } + } + return(layout) +} diff --git a/SCRIPTS/FUNCTIONS/getLimmaResults.R b/SCRIPTS/FUNCTIONS/getLimmaResults.R new file mode 100644 index 0000000..50672ac --- /dev/null +++ b/SCRIPTS/FUNCTIONS/getLimmaResults.R @@ -0,0 +1,421 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +getLimmaResults <- +function (X, I = NULL, contrast = NULL, covariates = NULL, model.formula = NULL, + model.type = c("multiple", "unique")[1], ps2gs = FALSE, gsmap = c("HG-U133_Plus_2", + "HG-U133A", "HG-U133B", "Rat230_2", "Mouse430_2", "HT_MG-430_PM", + "GPL6883", "GPL2986")[1], padj.method = "fdr", data.type = "affy", + collapsing.method = "contrast_data", verbose = TRUE, fn.pset2gs = c("pset2gs", + "pset2gs_new")[2], include.ordinary.pvalues = FALSE, + fitOnly = FALSE, keepLimmaFit = TRUE, ...) +{ + match.arg(model.type, c("multiple", "unique")) + species <- "Hs" + if (gsmap %in% c("Mouse430_2", "HT_MG-430_PM")) { + species = "Mm" + } + if (gsmap %in% c("Rat230_2")) { + species = "Rn" + } + match.arg(species, c("Hs", "Mm", "Rn")) + if (!is.null(contrast)) { + if (is.data.frame(contrast)) { + contrast = as.matrix(contrast) + } + if (!is.matrix(contrast)) { + stop("contrast is not NULL and is neither a data.frame nor a matrix") + } + } + keepFit = vector("list") + if (!is.null(model.formula)) { + if (data.type == "count") { + if (verbose == TRUE) { + cat("Beware EXPERIMENTAL!", fill = TRUE) + } + nf = calcNormFactors(X) + X = voom(X, mm0, plot = TRUE, lib.size = colSums(X) * + nf) + X$genes = rownames(X) + } + lm.fit1 = limma::lmFit(X, model.matrix(as.formula(model.formula), + data = data.frame(covariates)), ...) + if (!is.null(contrast)) { + if (verbose == TRUE) { + cat("Contrast matrix used in the context of the formula.", + fill = TRUE) + } + if (!all(rownames(contrast) %in% colnames(lm.fit1$coefficients))) { + stop(paste("Rownames of the contrast matrix should be in ", + paste(colnames(lm.fit1$coefficients), collapse = ","))) + } + lm.fit1 <- contrasts.fit(lm.fit1, contrasts = contrast) + } + if (fitOnly == TRUE) { + fit.eb1 = lm.fit1 + nmAdd = c("df.prior", "s2.prior", "var.prior", "proportion", + "s2.post", "t", "df.total", "p.value", "lods", + "F", "F.p.value") + for (nam in nmAdd) { + fit.eb1[[nam]] = matrix(NA, nrow(lmfit$coefficients), + ncol(lmfit$coefficients)) + rownames(fit.eb1[[nam]]) = rownames(lmfit$coefficients) + colnames(fit.eb1[[nam]]) = colnames(lmfit$coefficients) + } + } + else { + fit.eb1 = eBayes(lm.fit1) + } + if (keepLimmaFit == TRUE) { + fit.eb1$data = X + keepFit = fit.eb1 + } + res = vector("list", ncol(fit.eb1$p.value)) + names(res) = colnames(fit.eb1$p.value) + if (verbose == TRUE) { + cat(colnames(fit.eb1$coefficients), fill = TRUE) + } + for (k in 1:length(res)) { + if (!include.ordinary.pvalues) { + res[[k]] = data.frame(nodeLabel = rownames(fit.eb1$coefficients), + foldChange = fit.eb1$coefficients[, k], adj.p.value = p.adjust(fit.eb1$p.value[, + k], method = padj.method), p.value = fit.eb1$p.value[, + k], t = fit.eb1$t[, k], df = fit.eb1$df.prior + + fit.eb1$df.residual, A = rowMeans(X), TTT = rowMeans(X) * + 0 - 1, CTRL = rowMeans(X) * 0 - 1) + } + else { + ord.t = fit.eb1$coef[, k]/fit.eb1$stdev.unscaled[, + k]/fit.eb1$sigma + ord.p = 2 * pt(abs(ord.t), df = fit.eb1$df.residual, + lower.tail = FALSE) + ord.adjp = p.adjust(ord.p, method = padj.method) + res[[k]] = data.frame(nodeLabel = rownames(fit.eb1$coefficients), + foldChange = fit.eb1$coefficients[, k], adj.p.value = p.adjust(fit.eb1$p.value[, + k], method = padj.method), p.value = fit.eb1$p.value[, + k], t = fit.eb1$t[, k], df = fit.eb1$df.prior + + fit.eb1$df.residual, A = rowMeans(X, na.rm = TRUE), + TTT = rowMeans(X, na.rm = TRUE) * 0 - 1, CTRL = rowMeans(X, + na.rm = TRUE) * 0 - 1, ord.t = ord.t, ord.p.value = ord.p, + ord.adj.p.value = ord.adjp) + } + } + } + if (is.null(model.formula)) { + I = factor(as.character(I)) + if (!all(as.vector(as.matrix(contrast)) %in% I)) { + stop("I must contain all the constrasts involved in contrast argument.") + } + if (verbose == TRUE) { + cat("Computing Limma Models...") + } + N = nrow(contrast) + flagN = 0 + res = vector("list", N) + names(res) = contrast[1:N, 1] + if (model.type == "unique") { + mm = mm0 = model.matrix(~I - 1, data.frame(I)) + if (!is.null(covariates)) { + if (!is.data.frame(covariates)) { + stop("covariates must be a dataframe") + } + colnames(covariates) = paste("ZZ_", colnames(covariates), + sep = "") + mm0 = model.matrix(~1 + ., data = data.frame(I, + covariates)) + } + if (data.type == "count") { + nf = calcNormFactors(X) + X = voom(X, mm0, plot = TRUE, lib.size = colSums(X) * + nf) + X$genes = rownames(X) + } + lm.fit1 <- limma::lmFit(X, mm0) + contrast2 = matrix(0, ncol = nrow(contrast), nrow = ncol(mm)) + rownames(contrast2) = colnames(mm) + colnames(contrast2) = paste("CONT", contrast[, 1], + sep = "") + for (k in 1:nrow(contrast)) { + contrast2[rownames(contrast2) == paste("I", contrast[k, + 2], sep = ""), colnames(contrast2) == paste("CONT", + contrast[k, 1], sep = "")] = -1 + contrast2[rownames(contrast2) == paste("I", contrast[k, + 1], sep = ""), colnames(contrast2) == paste("CONT", + contrast[k, 1], sep = "")] = 1 + } + if (!is.null(covariates)) { + tmp = matrix(0, ncol = ncol(contrast2), nrow = length(which(!colnames(lm.fit1$coefficients) %in% + rownames(contrast2)))) + rownames(tmp) = colnames(lm.fit1$coefficients)[!colnames(lm.fit1$coefficients) %in% + rownames(contrast2)] + colnames(tmp) = colnames(contrast2) + contrast2 = rbind(contrast2, tmp) + } + contrast2 = contrast2[match(colnames(lm.fit1$coefficients), + rownames(contrast2)), , drop = FALSE] + lmfit <- contrasts.fit(lm.fit1, contrasts = contrast2) + if (fitOnly == TRUE) { + fit.eb1 = lmfit + nmAdd = c("df.prior", "s2.prior", "var.prior", + "proportion", "s2.post", "t", "df.total", "p.value", + "lods", "F", "F.p.value") + tmpAdd = matrix(NA, nrow(lmfit$coefficients), + ncol(lmfit$coefficients)) + rownames(tmpAdd) = rownames(lmfit$coefficients) + colnames(tmpAdd) = colnames(lmfit$coefficients) + for (nam in nmAdd) { + fit.eb1[[nam]] = tmpAdd + } + } + else { + fit.eb1 <- eBayes(lmfit) + } + if (keepLimmaFit == TRUE) { + fit.eb1$data = X + keepFit = fit.eb1 + } + if (verbose == TRUE) { + cat(colnames(fit.eb1$p.value), fill = TRUE) + } + for (k in 1:N) { + ttt = c(1:length(I))[I == contrast[k, 1]] + ctrl = c(1:length(I))[I == contrast[k, 2]] + if (length(ttt) == 1) { + Xttt = matrix(X[, ttt], ncol = 1) + } + else { + Xttt = X[, ttt] + } + if (length(ctrl) == 1) { + Xctrl = matrix(X[, ctrl], ncol = 1) + } + else { + Xctrl = X[, ctrl] + } + if (!include.ordinary.pvalues) { + res[[k]] = data.frame(nodeLabel = rownames(fit.eb1$coefficients), + foldChange = fit.eb1$coefficients[, k], adj.p.value = p.adjust(fit.eb1$p.value[, + k], method = padj.method), p.value = fit.eb1$p.value[, + k], t = fit.eb1$t[, k], df = fit.eb1$df.prior + + fit.eb1$df.residual, A = rowMeans(X, na.rm = TRUE), + TTT = rowMeans(Xttt, na.rm = TRUE), CTRL = rowMeans(Xctrl, + na.rm = TRUE)) + } + else { + ord.t = fit.eb1$coef[, k]/fit.eb1$stdev.unscaled[, + k]/fit.eb1$sigma + ord.p = 2 * pt(abs(ord.t), df = fit.eb1$df.residual, + lower.tail = FALSE) + ord.adjp = p.adjust(ord.p, method = padj.method) + res[[k]] = data.frame(nodeLabel = rownames(fit.eb1$coefficients), + foldChange = fit.eb1$coefficients[, k], adj.p.value = p.adjust(fit.eb1$p.value[, + k], method = padj.method), p.value = fit.eb1$p.value[, + k], t = fit.eb1$t[, k], df = fit.eb1$df.prior + + fit.eb1$df.residual, A = rowMeans(X, na.rm = TRUE), + TTT = rowMeans(Xttt, na.rm = TRUE), CTRL = rowMeans(Xctrl, + na.rm = TRUE), ord.t = ord.t, ord.p.value = ord.p, + ord.adj.p.value = ord.adjp) + } + } + } + else { + for (k in 1:N) { + if (verbose == TRUE) { + cat(paste("\n###### Estimating", contrast[k, + 1], "vs", contrast[k, 2], "...\n")) + } + ttt = c(1:length(I))[I == contrast[k, 1]] + ctrl = c(1:length(I))[I == contrast[k, 2]] + fact = c(paste("B__", I[ttt], sep = ""), paste("A__", + I[ctrl], sep = "")) + Xtmp = X[, c(ttt, ctrl)] + if (is.null(covariates)) { + design.mat1 <- model.matrix(~1 + TTT, data = data.frame(TTT = fact)) + } + if (!is.null(covariates)) { + if (!is.data.frame(covariates)) { + stop("covariates must be a dataframe") + } + if (k == 1) { + colnames(covariates) = paste("ZZ_", colnames(covariates), + sep = "") + } + cov = covariates[c(ttt, ctrl), , drop = FALSE] + for (h in 1:ncol(cov)) { + if (class(cov[, h]) == "factor") { + cov[, h] = factor(cov[, h]) + } + } + colnames(cov) = colnames(covariates) + design.mat1 = model.matrix(as.formula(paste("~1", + paste(colnames(cov), collapse = "+"), "ATTT", + sep = "+")), data = data.frame(ATTT = fact, + cov)) + if (verbose == TRUE) { + cat(paste("~1", paste(colnames(cov), collapse = "+"), + "ATTT", sep = "+"), fill = TRUE) + } + } + if (data.type == "count") { + nf = calcNormFactors(Xtmp) + Xtmp = voom(Xtmp, design.mat1, plot = TRUE) + Xtmp$genes = rownames(X) + } + lm.fit1 <- try(limma::lmFit(Xtmp, design.mat1), + silent = TRUE) + if (fitOnly == TRUE) { + fit.eb1 = lm.fit1 + nmAdd = c("df.prior", "s2.prior", "var.prior", + "proportion", "s2.post", "t", "df.total", + "p.value", "lods", "F", "F.p.value") + tmpAdd = matrix(NA, nrow(lm.fit1$coefficients), + ncol(lm.fit1$coefficients)) + rownames(tmpAdd) = rownames(lm.fit1$coefficients) + colnames(tmpAdd) = colnames(lm.fit1$coefficients) + for (nam in nmAdd) { + fit.eb1[[nam]] = tmpAdd + } + } + else { + fit.eb1 <- try(eBayes(lm.fit1), silent = TRUE) + } + if (keepLimmaFit == TRUE) { + fit.eb1$data = Xtmp + keepFit[[length(keepFit) + 1]] = fit.eb1 + names(keepFit)[length(keepFit)] = paste(contrast[k, + ], collapse = " vs ") + } + if (class(lm.fit1) == "try-error" || class(fit.eb1) == + "try-error") { + warning("lmFit and/or eBayes fitting fail for ", + contrast[k, 1]) + next + } + if (verbose == TRUE) { + cat(colnames(fit.eb1$coefficients), fill = TRUE) + } + if (data.type == "count") { + Xtmp = Xtmp$E + } + if (length(ttt) == 1) { + Xttt = matrix(X[, ttt], ncol = 1) + } + else { + Xttt = X[, ttt] + } + if (length(ctrl) == 1) { + Xctrl = matrix(X[, ctrl], ncol = 1) + } + else { + Xctrl = X[, ctrl] + } + nc = grep("TTTB__", colnames(fit.eb1$coefficients)) + if (verbose == TRUE) { + cat(colnames(fit.eb1$coefficients)[nc], fill = TRUE) + } + if (!include.ordinary.pvalues) { + res[[k]] = data.frame(nodeLabel = rownames(fit.eb1$coefficients), + foldChange = fit.eb1$coefficients[, nc], + adj.p.value = p.adjust(fit.eb1$p.value[, + nc], method = padj.method), p.value = fit.eb1$p.value[, + nc], t = fit.eb1$t[, nc], df = fit.eb1$df.prior + + fit.eb1$df.residual, A = rowMeans(Xtmp, + na.rm = TRUE), TTT = rowMeans(Xttt, na.rm = TRUE), + CTRL = rowMeans(Xctrl, na.rm = TRUE)) + } + else { + ord.t = fit.eb1$coef[, nc]/fit.eb1$stdev.unscaled[, + nc]/fit.eb1$sigma + ord.p = 2 * pt(abs(ord.t), df = fit.eb1$df.residual, + lower.tail = FALSE) + ord.adjp = p.adjust(ord.p, method = padj.method) + res[[k]] = data.frame(nodeLabel = rownames(fit.eb1$coefficients), + foldChange = fit.eb1$coefficients[, nc], + adj.p.value = p.adjust(fit.eb1$p.value[, + nc], method = padj.method), p.value = fit.eb1$p.value[, + nc], t = fit.eb1$t[, nc], df = fit.eb1$df.prior + + fit.eb1$df.residual, A = rowMeans(Xtmp), + TTT = rowMeans(Xttt, na.rm = TRUE), CTRL = rowMeans(Xctrl, + na.rm = TRUE), ord.t = ord.t, ord.p.value = ord.p, + ord.adj.p.value = ord.adjp) + } + } + } + } + if (verbose == TRUE) { + cat("\n") + } + ind <- which(!sapply(res, is.null)) + if (!all(c(1:length(res)) %in% ind)) { + warning("\ncontrasts are removed: ", paste(names(res)[!c(1:length(res)) %in% + ind], sep = " ", collapse = ", "), "\n") + res <- res[ind] + } + res0 = res + if (ps2gs == TRUE) { + if (verbose == TRUE) { + cat("Converting results to Gene Symbol...") + cat(paste("map:", gsmap, "\n")) + } + nmres = names(res) + nmcolres = names(res[[1]]) + adjust.p.values = FALSE + statistics.type = "other" + if ("t" %in% nmcolres) { + adjust.p.values = TRUE + statistics.type = "t" + } + res.load <- do.call("library", list("RConferoMapping")) + if (fn.pset2gs == "pset2gs") { + res = pset2gs(res, map = gsmap, species = species, + collapsing.method = collapsing.method, adjust.p.values = adjust.p.values, + statistics.type = statistics.type) + } + else { + res = pset2gs_new(res, map = gsmap, species = species, + collapsing.method = collapsing.method, adjust.p.values = adjust.p.values, + statistics.type = statistics.type) + } + names(res) = nmres + if (verbose == TRUE) { + cat("\n") + } + } + if (is.null(model.formula)) { + names(res) = apply(contrast[ind, , drop = FALSE], 1, + function(x) paste(x, collapse = " vs ")) + } + if (is.null(gsmap)) { + gsmap = "NULL" + } + attr(res, "map") = gsmap + attr(res, "cov") = covariates + attr(res, "data") = X + attr(res, "parameters") = list(X = X, I = I, contrast = contrast, + covariates = covariates, model.formula = model.formula, + model.type = model.type, ps2gs = ps2gs, gsmap = gsmap, + padj.method = padj.method, data.type = data.type, collapsing.method = collapsing.method, + include.ordinary.pvalues = include.ordinary.pvalues) + attr(res, "SessionInfo") = sessionInfo() + attr(res, "lmfit") = keepFit + tm = paste0(format(Sys.time(), "%a_%b_%d_%Y_%Hh%Mm%Ss"), + "-", paste(sample(c(letters[1:16], LETTERS[1:26]), 25, + replace = TRUE), collapse = "")) + attr(res, "original.names") = paste0(names(res), " (", tm, + ")") + attr(res, "subset") = 1:length(res) + return(res) +} diff --git a/SCRIPTS/FUNCTIONS/getsplit.R b/SCRIPTS/FUNCTIONS/getsplit.R new file mode 100644 index 0000000..584fef8 --- /dev/null +++ b/SCRIPTS/FUNCTIONS/getsplit.R @@ -0,0 +1,55 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +getsplit <- +function (nm0, splitarg, k = 1, remove = FALSE, fixed = TRUE, + last = FALSE, last.n = 1) +{ + nm0 <- as.character(nm0) + if (last == FALSE) { + if (remove == FALSE) { + y <- sapply(strsplit(nm0, splitarg, fixed = fixed), + function(x) { + paste(x[k], collapse = splitarg, sep = "") + }) + } + if (remove == TRUE) { + y <- sapply(strsplit(nm0, splitarg, fixed = fixed), + function(x) { + paste(x[-k], collapse = splitarg, sep = "") + }) + } + } + else { + if (remove == FALSE) { + y <- sapply(strsplit(nm0, splitarg, fixed = fixed), + function(x) { + paste(x[(length(x) - last.n + 1):length(x)], + collapse = splitarg, sep = "") + }) + } + if (remove == TRUE) { + y <- sapply(strsplit(nm0, splitarg, fixed = fixed), + function(x) { + paste(x[-c((length(x) - last.n + 1):length(x))], + collapse = splitarg, sep = "") + }) + } + } + names(y) <- names(nm0) + return(y) +} diff --git a/SCRIPTS/FUNCTIONS/grep2.R b/SCRIPTS/FUNCTIONS/grep2.R new file mode 100644 index 0000000..9e677ad --- /dev/null +++ b/SCRIPTS/FUNCTIONS/grep2.R @@ -0,0 +1,26 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +grep2 <- +function (nm, x, ...) +{ + out <- sapply(nm, function(n) { + grep(n, as.character(x), ...) + }) + names(out) <- nm + return(out) +} diff --git a/SCRIPTS/FUNCTIONS/load2.R b/SCRIPTS/FUNCTIONS/load2.R new file mode 100644 index 0000000..0570c75 --- /dev/null +++ b/SCRIPTS/FUNCTIONS/load2.R @@ -0,0 +1,52 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +load2 <- +function (f, obj = NULL, verbose = TRUE) +{ + env <- new.env() + if (verbose == TRUE) { + message("From File, ") + } + nm <- load(f, envir = env, verbose = verbose) + if (verbose == TRUE) { + message("\n") + } + res <- lapply(as.list(nm), function(n) { + get(n, envir = env) + }) + names(res) <- nm + if (length(nm) == 1) { + res <- res[[1]] + } + else { + if (!is.null(obj)) { + if (length(obj) == 1) { + if (!obj %in% nm) { + stop("obj does not belong to loaded objects") + } + else { + res <- res[[which(names(res) == obj)]] + } + } + else { + stop("obj should be of length 1") + } + } + } + return(res) +} diff --git a/SCRIPTS/FUNCTIONS/pcaGG.R b/SCRIPTS/FUNCTIONS/pcaGG.R new file mode 100644 index 0000000..65a86bf --- /dev/null +++ b/SCRIPTS/FUNCTIONS/pcaGG.R @@ -0,0 +1,99 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +pcaGG <- +function (X, group = NULL, cols = NULL, show = 1:2, main = "PCA Scores", + size = 1, size.text = 3, print = TRUE, ncol = NULL, panel = "Spectral", + annotate = FALSE) +{ + if (is.null(group)) { + group = factor(rep("", nrow(X))) + cols = "navy" + } + if (is.null(cols)) { + cols = colorRampPalette(brewer.pal(n = 7, panel))(nlevels(group)) + } + X = as.matrix(X) + if (is.null(rownames(X))) { + rownames(X) = 1:nrow(X) + } + X = X[, complete.cases(t(X))] + sv = svd(scale(X), nu = max(show), nv = max(show)) + scores = sv$u + inertia = sv$d^2/sum(sv$d^2) + colnames(scores) = paste0("PC", 1:ncol(scores), " (", round(100 * + inertia[1:ncol(scores)], 1), ")") + varnm = paste0("PC", 1:ncol(scores), " (", round(100 * inertia[1:ncol(scores)], + 1), "%)") + D0 = data.frame(Id = rownames(X), Group = group, scores[, + show]) + colnames(D0)[-c(1:2)] = varnm[show] + D0 = reshape2::melt(D0) + D = NULL + find_hull <- function(X) { + ind = chull(X$x, X$y) + return(data.frame(Id = rownames(X)[ind], X[ind, ])) + } + hulls = NULL + for (i in 1:ncol(scores)) { + for (j in 1:ncol(scores)) { + if (i < j & all(c(i, j) %in% show)) { + D2 = cbind(D0[D0$variable == varnm[i], ], D0[D0$variable == + varnm[j], -c(1:2)]) + colnames(D2)[-c(1:2)] = c("Var1", "x", "Var2", + "y") + D = rbind(D, D2) + tmp = cbind(D0[D0$variable == varnm[i], c("Group", + "value")], D0[D0$variable == varnm[j], "value"]) + colnames(tmp) = c("Group", "x", "y") + tmp = ddply(tmp, "Group", find_hull) + tmp = data.frame(tmp[, c(1:2)], rep(varnm[i], + nrow(tmp)), tmp[, "x"], rep(varnm[j], nrow(tmp)), + tmp[, "y"]) + colnames(tmp) = colnames(D) + hulls = rbind(hulls, tmp) + } + } + } + D$Vars = paste0(D$Var1, " vs. ", D$Var2) + hulls$Vars = paste0(hulls$Var1, " vs. ", hulls$Var2) + if (annotate == TRUE) { + size = 0.001 * size + } + p = ggplot(data = D, aes(x = x, y = y, label = Id, fill = Group)) + + geom_point(size = size, shape = 21) + geom_hline(yintercept = 0, + colour = "darkgrey") + geom_vline(xintercept = 0, colour = "darkgrey") + + scale_colour_manual("", values = cols) + scale_fill_manual("", + values = cols) + labs(x = "", y = "") + ggtitle(main) + if (annotate == TRUE) { + p = p + geom_text(aes(colour = Group), size = size.text) + } + if (is.null(ncol)) { + p = p + facet_wrap(~Vars) + } + else { + p = p + facet_wrap(~Vars, ncol = ncol) + } + if (nlevels(group) == 1) { + p = p + theme(legend.position = "none") + } + p = p + geom_polygon(data = hulls, aes(fill = Group), alpha = 0.2) + if (print == TRUE) { + print(p) + } + return(invisible(p)) +} diff --git a/SCRIPTS/FUNCTIONS/plotFactorScatters2.R b/SCRIPTS/FUNCTIONS/plotFactorScatters2.R new file mode 100644 index 0000000..20b9021 --- /dev/null +++ b/SCRIPTS/FUNCTIONS/plotFactorScatters2.R @@ -0,0 +1,207 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +#' plotFactorScatters2 +#' +#' adapted from MOFA package: https://github.com/bioFAM/MOFA +#' +#' @param object MOFA object +#' @param factors +#' @param showMissing +#' @param color_by +#' @param name_color +#' @param shape_by +#' @param name_shape +#' +#' @return ggplot object +#' @export +#' +plotFactorScatters2 <- function(object, factors = "all", showMissing = TRUE, color_by = NULL, + name_color = "", shape_by = NULL, name_shape = "", col_values = NULL) { + if (!is(object, "MOFAmodel")) { + stop("'object' has to be an instance of MOFAmodel") + } + N <- object@Dimensions[["N"]] + Z <- getFactors(object, factors = factors) + factors <- colnames(Z) + if (is.numeric(factors)) { + factors <- factorNames(object)[factors] + } + else { + if (paste0(factors, collapse = "") == "all") { + factors <- factorNames(object) + } + else { + stopifnot(all(factors %in% factorNames(object))) + } + } + Z <- getFactors(object, factors = factors) + tmp <- apply(Z, 2, var, na.rm = TRUE) + if (any(tmp == 0)) { + Z <- Z[, !tmp == 0] + factors <- factors[!tmp == 0] + } + colorLegend <- TRUE + if (!is.null(color_by)) { + if (length(color_by) == 1 & is.character(color_by)) { + if (name_color == "") { + name_color <- color_by + } + TrainData <- getTrainData(object) + featureNames <- lapply(TrainData, rownames) + if (color_by %in% Reduce(union, featureNames)) { + viewidx <- which(vapply(featureNames, function(vnm) color_by %in% + vnm, logical(1))) + color_by <- TrainData[[viewidx]][color_by, ] + } + else if (is(object@InputData, "MultiAssayExperiment")) { + color_by <- getCovariates(object, color_by) + } + else { + stop("'color_by' was specified but it was not recognised, please read the documentation") + } + } + else if (length(color_by) > 1) { + stopifnot(length(color_by) == N) + } + else { + stop("'color_by' was specified but it was not recognised, please read the documentation") + } + } + else { + color_by <- rep(TRUE, N) + colorLegend <- FALSE + } + shapeLegend <- TRUE + if (!is.null(shape_by)) { + if (length(shape_by) == 1 & is.character(shape_by)) { + if (name_shape == "") { + name_shape <- shape_by + } + TrainData <- getTrainData(object) + featureNames <- lapply(TrainData, rownames) + if (shape_by %in% Reduce(union, featureNames)) { + viewidx <- which(vapply(featureNames, function(vnm) shape_by %in% + vnm, logical(1))) + shape_by <- TrainData[[viewidx]][shape_by, ] + } + else if (is(object@InputData, "MultiAssayExperiment")) { + shape_by <- getCovariates(object, shape_by) + } + else { + stop("'shape_by' was specified but it was not recognised, please read the documentation") + } + } + else if (length(shape_by) > 1) { + stopifnot(length(shape_by) == N) + } + else { + stop("'shape_by' was specified but it was not recognised, please read the documentation") + } + } + else { + shape_by <- rep(TRUE, N) + shapeLegend <- FALSE + } + if (!showMissing) { + Z <- Z[!(is.na(color_by) | is.nan(color_by)), ] + color_by <- color_by[!is.na(color_by)] + shape_by <- shape_by[!is.na(shape_by)] + } + df <- as.data.frame(Z) + colnames(df) <- paste0("LF", colnames(df)) + df <- cbind(df, color_by = color_by, shape_by = shape_by) + df$shape_by[is.na(df$shape_by)] <- "NA" + df$shape_by <- as.factor(df$shape_by) + if (length(unique(df$color_by)) < 5) { + df$color_by <- as.factor(df$color_by) + } + main <- "" + p <- ggplot(df, aes_string( + x = colnames(df)[1], y = colnames(df)[2], + color = "color_by", shape = "shape_by" + )) + geom_point() + + p <- ggplot(df, aes_string( + x = colnames(df)[1], y = colnames(df)[2], + color = "color_by", shape = "shape_by" + )) + geom_point() + + if (!is.null(col_values)) { + p <- p + scale_color_manual("", values = col_values) + } + + if (colorLegend | shapeLegend) { + p <- p + theme( + legend.title = element_text( + size = 15, + hjust = 0.5, color = "black" + ), legend.position = "right", + legend.direction = "vertical", legend.key = element_blank() + ) + if (is.numeric(df$color_by)) { + p <- p + scale_color_gradientn(colors = terrain.colors(10)) + } + if (colorLegend) { + p <- p + labs(color = name_color) + } + else { + p <- p + guides(color = FALSE) + } + if (shapeLegend) { + p <- p + labs(shape = name_shape) + } + else { + p <- p + guides(shape = FALSE) + } + legend <- GGally::grab_legend(p) + } + else { + legend <- NULL + } + p <- GGally::ggpairs(df, + columns = colnames(df[, !colnames(df) %in% c("color_by", "shape_by")]), + lower = list(continuous = "points"), + diag = list(continuous = "barDiag"), + upper = list(continuous = "points"), + mapping = aes(color = color_by, shape = shape_by), + title = main, + legend = legend + ) + + theme_bw() + + theme( + plot.title = element_text(size = 16, hjust = 0.5, color = "black"), + axis.title = element_text(size = 10, color = "black"), + axis.text = element_text(size = 9, color = "black"), + legend.position = "right", + legend.direction = "vertical" + ) + + + for (i in seq_len(p$nrow)) { + for (j in seq_len(p$ncol)) { + if (is.numeric(df$color_by)) { + p[i, j] <- p[i, j] + scale_color_gradientn(colors = terrain.colors(10)) + } else if (!is.null(col_values)) { + p[i, j] <- p[i, j] + scale_color_manual("", values = col_values) + p[i, j] <- p[i, j] + scale_fill_manual("", values = col_values) + } + } + } + + return(p) +} diff --git a/SCRIPTS/FUNCTIONS/setAttr.R b/SCRIPTS/FUNCTIONS/setAttr.R new file mode 100644 index 0000000..faf4c0f --- /dev/null +++ b/SCRIPTS/FUNCTIONS/setAttr.R @@ -0,0 +1,25 @@ +# Copyright 2019 Philip Morris Products SA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +setAttr <- function (x, attr0) +{ + if (!is.null(attr0)) { + for (n in 1:length(attr0)) { + attr(x, names(attr0)[n]) = attr0[[n]] + } + } + return(x) +} \ No newline at end of file diff --git a/SCRIPTS/P15038_APOE_P2_MultiOmicsManuscript.Rmd b/SCRIPTS/P15038_APOE_P2_MultiOmicsManuscript.Rmd new file mode 100644 index 0000000..f958e87 --- /dev/null +++ b/SCRIPTS/P15038_APOE_P2_MultiOmicsManuscript.Rmd @@ -0,0 +1,2724 @@ +--- +title: "Multi-omics systems toxicology of lung tissue reveals reduced biological effects of two heat-not-burn tobacco products compared with cigarette smoke" +author: +- name: Bjoern Titz + affilnum: '1' +- name: Justyna Szostak + affilnum: '1' +- name: Alain Sewer + affilnum: '1' +- name: Blaine Phillips + affilnum: '2' +- name: Catherine Nury + affilnum: '1' +- name: Thomas Schneider + affilnum: '1' +- name: Sophie Dijon + affilnum: '1' +- name: Oksana Lavrynenko + affilnum: '1' +- name: Ashraf Elamin + affilnum: '1' +- name: Emmanuel Guedj + affilnum: '1' +- name: Ee Tsin Wong + affilnum: '2' +- name: Stefan Lebrun + affilnum: '1' +- name: Grégory Vuillaume + affilnum: '1' +- name: Athanasios Kondylis + affilnum: '1' +- name: Sylvain Gubian + affilnum: '1' +- name: Stephane Cano + affilnum: '1' +- name: Patrice Leroy + affilnum: '1' +- name: Brian Keppler + affilnum: '3' +- name: Nikolai V. Ivanov + affilnum: '1' +- name: Patrick Vanscheeuwijck + affilnum: '1' +- name: Florian Martin + affilnum: '1' +- name: Manuel C. Peitsch + affilnum: '1' +- name: Julia Hoeng + affilnum: '1' +affiliation: +- affil: PMI R&D, Philip Morris Products S.A., Quai Jeanrenaud 5, CH-2000 Neuchâtel, Switzerland + affilnum: 1 +- affil: Philip Morris International Research Laboratories Pte. Ltd., Science Park II, Singapore + affilnum: 2 +- affil: Metabolon Inc., Research Triangle Park, NC, USA + affilnum: 3 +abstract: + Cigarette smoke (CS) causes adverse health effects. To reduce the risk of smokers developing smoking-related diseases, Philip Morris International is developing candidate modified risk tobacco products (cMRTPs). In a six-month systems toxicology study with ApoE-/- mice, we conducted an integrative multi-omics analysis to assess the effects of aerosols from two cMRTPs, the Carbon Heated Tobacco Product (CHTP) 1.2 and the Tobacco Heating System (THS) 2.2, compared with CS at matched nicotine concentrations. Molecular exposure effects in the lung were measured by mRNA/microRNA transcriptomics, proteomics, metabolomics, and lipidomics. Across all five data modalities, exposure to CS caused substantial effects, including inflammation, an oxidative stress response, and lipid/surfactant alterations. In contrast, effects observed for cMRTP aerosols were much more limited or absent, with reversal of CS-induced effects upon cessation and switching to CHTP 1.2 (after three months of CS exposure). Functional network analysis revealed complex immuno-regulatory interactions induced by CS across the investigated molecular layers (e.g., involving itaconate, quinolinate, and miR-146) and highlighted engagement of the heme–Hmox–bilirubin oxidative stress axis by CS. Overall, this work exemplifies how multi-omics approaches can be leveraged within systems toxicology studies and further supports potentially reduced respiratory health risks of CHTP 1.2 and THS 2.2. +date: "`r format(Sys.time(), '%d %B, %Y')`" +output: + pdf_document: + toc: true + fig_caption: yes + keep_tex: yes + number_sections: yes + template: ../INFO/report.latex + html_notebook: + toc: true +editor_options: + chunk_output_type: console +--- + +# License + +> Copyright 2019 Philip Morris Products SA +> +> This program is free software; you can redistribute it and/or +> modify it under the terms of the GNU General Public License +> as published by the Free Software Foundation; either version 2 +> of the License, or (at your option) any later version. +> +> This program is distributed in the hope that it will be useful, +> but WITHOUT ANY WARRANTY; without even the implied warranty of +> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +> GNU General Public License for more details. +> +> You should have received a copy of the GNU General Public License +> along with this program; if not, write to the Free Software +> Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +> +> Also, see Licenses.txt + + +For the shared data: + +> This work is licensed under the Creative Commons Attribution 4.0 International License. +> To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ +> or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. + +# Background information +This Rmd file performs the analyses and creates the figures presented in the manuscript *Multi-omics systems toxicology of lung tissue reveals reduced biological effects of two heat-not-burn tobacco products compared with cigarette smoke*. +In a six-month systems toxicology study with ApoE-/- mice, we assessed the effects of aerosols from two candidate modified-risk tobacco products, the Carbon Heated Tobacco Product (CHTP) 1.2 and the Tobacco Heating System (THS) 2.2, compared with cigarette smoke (CS) at matched nicotine concentrations. Molecular exposure effects in the lung were measured across five data modalities: mRNA/microRNA transcriptomics, proteomics, metabolomics, and lipidomics. + +Analyses include: + +* Single-omics analyses, e.g. differential expression analysis, principle component analysis, and causal network enrichment +* Multi-omics analysis by Multi-Omics Factor Analysis (Argelaguet et al., 2018, 10.15252/msb.20178124) and network-based interpretation + +# Setup +This section defines the basic processing parameters and loads the required R packages. + +```{r DefParamsPackages, message=FALSE, warning=FALSE, results='hide', size="scriptsize"} +# general options +X11.options(type = "Xlib", bg = "white") +options(stringsAsFactors = FALSE) +Sys.setenv(R_MAX_NUM_DLLS = 500) + +# load R packages +library(knitr) +library(gridExtra) +library(RColorBrewer) +library(ggplot2) +library(egg) +library(ggpubr) +library(reshape2) +library(xlsx) +library(readxl) +library(openxlsx) +library(tools) +library(plotrix) +library(gdata) +library(plyr) +library(dplyr) +library(limma) +library(NPA) +library(MOFA) +library(mixOmics) +library(ggbeeswarm) +library(stringi) +library(visNetwork) +library(PCSF) + +#source all functions +for (fn in list.files("../SCRIPTS/FUNCTIONS", "*.R",full.names = TRUE)) { + source(fn) +} + +# study definitions +script.name <- "P15038_APOE_P2_MultiOmicsManuscript.Rmd" +study_short_name <- "APOE_P2" +tissue <- "Lung" +subset <- "Tissue" +studynumber <- "P15038" +species <- "mouse" +species0 <- as.character(c(rat = "Rn", mouse = "Ms", human = "Hs")[species]) +studyName <- studyname <- paste(studynumber, study_short_name, tissue, subset, sep = "_") + +# layout parameters +volcano_nrow <- 5 +volcano_ncol <- 2 +which_order_volcano <- c(1:6, -1, 7, -1, 8) +layout_mat_volcano <- getLayoutMatrix(which_order_volcano, norow = volcano_nrow, nocol = volcano_ncol) + +colgrps <- matrix(c( + "Sham", "Sham", "#0000FF", + "3R4F", "3R4F", "#FF0000", + "CHTP", "CHTP1.2", "#542788", + "THS", "THS2.2", "#998EC3", + "Cess", "CESS", "#00B050", + "Switch_CHTP", "SWITCH", "#FF9900" +), byrow = TRUE, ncol = 3, dimnames = list(NULL, c("Group_Name", "Label", "Color"))) + +# folders & files +projectBaseDir <- "../" +RobjectsDir <- file.path(projectBaseDir, "DATA") +reportDir <- file.path(projectBaseDir, "REPORT") +#dir.create(reportDir) +#setwd(projectBaseDir) + +debug <- FALSE + +# Rerun the analyses or load from file (if available)? +force_rerun_mofa <- TRUE +force_rerun_pcsf <- TRUE # requires integrative network & KEGG license +force_recreate_network <- FALSE # KEGG license required + +# rendering options +opts_chunk$set(dev = 'pdf', + fig.width=6, + fig.height=5, + message=FALSE, + warning=FALSE) + +#https://github.com/jhollist/manuscriptPackage +# Table Captions from @DeanK on http://stackoverflow.com/questions/15258233/ +# using-table-caption-on-r-markdown-file-using-knitr-to-use-in-pandoc-to-convert-t +#Figure captions are handled by LaTeX +knit_hooks$set(tab.cap = function(before, options, envir) { + if(!before) { + paste('\n\n:', options$tab.cap, sep='') + } + }) +default_output_hook = knit_hooks$get("output") +knit_hooks$set(output = function(x, options) { + if (!is.null(options$tab.cap)) { + x + } else + default_output_hook(x,options) +}) +#https://stackoverflow.com/questions/25646333/code-chunk-font-size-in-rmarkdown-with-knitr-and-latex +def.chunk.hook <- knitr::knit_hooks$get("chunk") +knitr::knit_hooks$set(chunk = function(x, options) { + x <- def.chunk.hook(x, options) + ifelse(options$size != "normalsize", paste0("\\", options$size,"\n\n", x, "\n\n \\normalsize"), x) +}) + +set.seed(456463) + +``` + +# Import the data +This section imports the data objects for the five data modalities. The R data objects are located in the +`r RobjectsDir` folder: + +* DATA objects: Quantification results for each omics data modality. List with the following slots: + + data: the data matrix (analytes x samples) + + I: metadata (sample x covariate) + + L: Group annotation + + CO: contrast matrix +* IDMAP object: Differential expression results. Lists with one named element per contrast. Each element is a + data.frame, which includes the following columns: + + nodeLabel: Name of the analyte (e.g., gene symbol) + + foldChange: log2 fold-change + + p.value: p-value + + adj.p.value: BH-adjusted p-value + + + +```{r ImportData, message=FALSE, warning=FALSE, results='hide', size="scriptsize"} +# load idmaps +idmaps <- list() +idmaps[["MRNA"]] <- load2(file.path(RobjectsDir, "IDMAP_P15038-S185500_APOE_P2_Lung_Mm_MRNA.rda")) +idmaps[["METABOLITE"]] <- load2(file.path(RobjectsDir, "IDMAP-Tissue_APOE_P2_Lung_Ms_METABOLOMICS.rda")) +idmaps[["PROTEIN"]] <- load2(file.path(RobjectsDir, "IDMAP-_APOE_P2_Lung_Mm_PEX.rda")) +idmaps[["MIRNA"]] <- load2(file.path(RobjectsDir, "IDMAP_P15038-S185500_APOE_P2_Lung_Mm_MIRNA.rda")) +idmaps[["LIPID"]] <- load2(file.path(RobjectsDir, "IDMAP-P15038-S186400_APOE_P2_Lung_Mm_LIPSG.rda")) + +# contrast names (shorten, as all are vs sham) +idmaps <- lapply(idmaps, function(idmap) { + names(idmap) <- gsub(" vs.+", "", gsub("_", " ", names(idmap)), perl = TRUE) + return(idmap) +}) + +# load dat objects +dats <- list() +dats[["MRNA"]] <- load2(file.path(RobjectsDir, "DATA_P15038-S185500_APOE_P2_Lung_Mm_MRNA.rda")) +dats[["METABOLITE"]] <- load2(file.path(RobjectsDir, "DATA-Tissue_APOE_P2_Lung_Ms_METABOLOMICS.rda")) +dats[["PROTEIN"]] <- load2(file.path(RobjectsDir, "DATA-_APOE_P2_Lung_Mm_PEX.rda")) +dats[["LIPID"]] <- load2(file.path(RobjectsDir, "DATA-P15038-S186400_APOE_P2_Lung_Mm_LIPSG.rda")) + +dats[["MIRNA"]] <- load2(file.path(RobjectsDir, "DATA_P15038-S185500_APOE_P2_Lung_Mm_MIRNA.rda")) +rownames(dats[["MIRNA"]]$data) <- as.character(dats[["MIRNA"]]$R[match(rownames(dats[["MIRNA"]]$data), + as.character(dats[["MIRNA"]]$R$Probe.Set.Name)), "Transcript.ID.Array.Design."]) +``` + +# Overview of individual omes + +```{r OverviewIndividualOmes, message=FALSE, warning=FALSE, size="scriptsize"} +# number of 'captured' molecules +res <- lapply(dats, function(x) { + X <- x$data + X <- X[!apply(X, 1, function(y) all(is.na(y))), ] + nrow(X) +}) +tab_captured_molecules <- as.data.frame(unlist(res)) +colnames(tab_captured_molecules) <- c("Number of molecules") + +# Number of DEGs plot +dat <- do.call(rbind, lapply(names(idmaps), function(x) { + no_degs <- sapply(getDEG(idmaps[[x]]), nrow) + data.frame(type = x, contrast = names(no_degs), no_degs = as.numeric(no_degs)) +})) +dat$contrast <- factor(dat$contrast, levels = names(idmaps[["MRNA"]])) +dat$treatment <- getsplit(dat$contrast, " ", 1) +dat$type <- factor(paste0(dat$type, "s"), levels = c("MRNAs", "PROTEINs", "METABOLITEs", "MIRNAs", "LIPIDs")) +tab_de <- dat + +cols <- attr(idmaps[["MRNA"]], "colors") +names(cols) <- names(idmaps[["MRNA"]]) + +p <- ggplot(aes(x = contrast, y = no_degs), data = dat) +p <- p + geom_bar(aes(fill = contrast), stat = "identity") +p <- p + scale_fill_manual("", values = cols, guide = FALSE) +p <- p + facet_wrap(~type, ncol = 2, scales = "free_y") +p <- p + theme_bw() +p <- p + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust = 1)) +p <- p + labs(x = "", y = "# differentially abundant/expressed") +p <- p + theme(strip.background = element_blank()) +p <- p + theme(strip.text.x = element_text(size = 12, face = "bold")) + +P_nodegs <- p + +pdf(file = file.path(reportDir, "P15038_LungManuscript_NoDEGs_w_lipids.pdf"), width = 7, height = 10) +print(p) +dev.off() + +# Exports DEGs for Supplement +degs_list <- lapply(idmaps, function(idmap) { + degs <- getDEG(idmap) + do.call(rbind,lapply(names(degs), function(nm) { + x <- as.data.frame(degs[[nm]]) + x <- x[,c("nodeLabel", "foldChange", "t", "df", "p.value", "adj.p.value"), drop = FALSE] + if (nrow(x) > 0) { + x$contrast <- nm + } + return(x) + })) +}) +file <- file.path(reportDir, "P15038_LungManuscript_DiffExpression.xlsx") +openxlsx::write.xlsx(degs_list, file = file) + +``` + +```{r TableCapturedMolecules, results='asis', echo=FALSE, tab.cap="\\label{tab:TableCapturedMolecules} Total number of captured molecules. ",cache=FALSE} +kable(tab_captured_molecules) +``` + +```{r TableDE, results='asis', echo=FALSE, tab.cap="\\label{tab:TableDE} Total number of captured molecules. ",cache=FALSE} +kable(tab_de) +``` + +```{r FigNumberDEGs, echo=FALSE, fig.cap="\\label{fig:FigNumberDEGs} Number of differentially expressed molecules across omics data modalities.", cache=FALSE} +plot(P_nodegs) +``` + +Table \ref{tab:TableCapturedMolecules} lists the total number of captured molecules across the five data modalities. +Figure \ref{fig:FigNumberDEGs} shows the number of differentially expressed molecules for each omics data modality. +Table \ref{tab:TableDE} lists the number of differentially expressed molecules for each omics data modality. + +# Prepare multi-omics data +In this section, we prepare the multi-omics data set for further analysis. This includes: + +* Aligning the five data matrices by unique animal number (CAN) across columns +* Summarizing available data types per animal +* Allowing for two missing data modalities for each animal +* Proteomics data has missing values: filter for proteins with missing values for less than 10% of samples +* Create multi-omics data list with associated meta data + + +```{r PrepareMultiOmicsData, message=FALSE, warning=FALSE, size="scriptsize"} +# mRNA data +Xmrna <- dats[["MRNA"]]$data +colnames(Xmrna) <- as.character(dats[["MRNA"]]$I$CAN.PatientID) + +# miRNA data +Xmirna <- dats[["MIRNA"]]$data +colnames(Xmirna) <- as.character(dats[["MIRNA"]]$I$CAN.PatientID) + +# iTRAQ/proteomics data +Xprot <- dats[["PROTEIN"]]$data +colnames(Xprot) <- as.character(dats[["PROTEIN"]]$I$Subject.number) + +# get CAN +# original SDMS link not used here to facilitate external reproducibility +filename <- file.path("../", "INFO", "S186500_NA_LUNG-L_ITRAQ_NA_15038ProteomicsSliceTissue-SampleMetaData.xlsx") +metadat <- readxl::read_xlsx(filename, sheet = 4) %>% as.data.frame() +colnames(Xprot) <- metadat[match(colnames(Xprot), metadat$`Child Sample ID`), "CAN/PatientID"] +# filter for proteins with less than 10% missing values +perc_not_na <- apply(Xprot, 1, function(x) sum(!is.na(x)) / length(x)) +Xprot <- Xprot[perc_not_na > 0.90, ] + +# metabolomics data +Xmet <- dats[["METABOLITE"]]$data +colnames(Xmet) <- gsub("S", "", as.character(dats[["METABOLITE"]]$I$ANIMAL_ID)) + +# lipidomics data +Xlip <- dats[["LIPID"]]$data +I <- dats[["LIPID"]]$I + +# get CAN +# original SDMS link not used here to facilitate external reproducibility +filename <- file.path("../","INFO", "S186400_NA_LUNG-L_NA_NA_15038LipidomicsSliceTissue-SampleMetaData.xlsx") +metadat <- readxl::read_xlsx(filename, sheet = 4) %>% as.data.frame() +colnames(Xlip) <- metadat[match(I[, "SAMPLE_ID_1"], metadat$`Child Sample ID`), "CAN/PatientID"] + +# get meta data for all samples +# original SDMS link not used here to facilitate external reproducibility +filename <- file.path("../","INFO", "15038_NA_NA_NA_NA_SelectedSampleListSysTox.xlsx") +metadat_all <- readxl::read_xlsx(filename, sheet = 1) %>% as.data.frame() +metadat_all$TreatmentGroupName <- gsub("THS", "THS2.2", + gsub("Switch_CHTP", "SWITCH", + gsub("Cess", "CESS", + gsub("^CHTP", "CHTP1.2", metadat_all$TreatmentGroupName)))) +metadat_all$TreatmentGroupName <- factor(metadat_all$TreatmentGroupName, + levels = unique(metadat_all$TreatmentGroupName)) + +# summary matrix of available samples +dat <- rbind( + data.frame(type = "MRNA", CAN = colnames(Xmrna), value = TRUE), + data.frame(type = "MIRNA", CAN = colnames(Xmirna), value = TRUE), + data.frame(type = "PROTEIN", CAN = colnames(Xprot), value = TRUE), + data.frame(type = "METABOLITE", CAN = colnames(Xmet), value = TRUE), + data.frame(type = "LIPID", CAN = colnames(Xlip), value = TRUE) +) +mat <- reshape2::dcast(dat, type ~ CAN, value.var = "value") +rownames(mat) <- mat$type +mat <- mat[, -1] +mat[is.na(mat)] <- 0 +mat[mat == TRUE] <- 1 + +#Updated to improve readability of sample plot +#hc <- hclust(dist(t(mat), method = "manhattan"), method = "average") +#dat$CAN <- factor(dat$CAN, levels = hc$labels[hc$order]) +dat$Group <- metadat_all[match(dat$CAN, metadat_all$`CAN/PatientID`), "TreatmentGroupName"] +dat$CAN <- with(dat,factor(CAN, levels = unique(CAN[order(Group, CAN)]))) + +dat$TTT <- getsplit(dat$Group, "_", 1) +dat$Time <- getsplit(dat$Group, "_", 2) + +cols <- colgrps[,"Color"] +names(cols) <- colgrps[,"Label"] + +p <- ggplot(aes(x = CAN, y = type, fill = TTT), data = dat) +p <- p + geom_tile(na.rm = TRUE) +p <- p + scale_fill_manual("", values = cols,guide = FALSE, na.value = "grey20") +p <- p + facet_grid(~Time, scales = "free_x", space = "free_x") +p <- p + labs(x = "Lung samples", y = "") +p <- p + theme_bw() +p <- p + theme(axis.text.x = element_blank()) +p <- p + theme(axis.text.y = element_text(color = "black")) +p <- p + theme(axis.ticks = element_blank()) +p <- p + theme(plot.background = element_blank()) +p_shared_samples_hm <- p + +pdf(file = file.path(reportDir, "P15038_LungManuscript_SharedSamples.pdf"), width = 7, height = 2.5) + plot(p_shared_samples_hm) +dev.off() + + +tmp <- as.matrix(table(apply(mat, 2, sum, na.rm = TRUE))) +tmp2 <- as.numeric(tmp) +names(tmp2) <- rownames(tmp) +tmp <- cumsum(rev(tmp2)) +tmp +dat2 <- data.frame(datasets = names(tmp), samples = tmp) +p <- ggplot(aes(x = datasets, y = samples), data = dat2) +p <- p + geom_bar(stat = "identity", colour = "black", fill = "grey30", width = 0.6) +p <- p + theme_bw() +p <- p + labs(x = "# data sets", y = "# samples") +p_shared_samples_cumsum <- p + +pdf(file = file.path(reportDir, "P15038_LungManuscript_SharedSamplesCumSum.pdf"), width = 3, height = 3) +plot(p_shared_samples_cumsum) +dev.off() + +# Number of data types per animal +tab <- table(c(colnames(Xmrna), colnames(Xmirna), colnames(Xprot), colnames(Xmet), colnames(Xlip))) + +# allow for two missing data types +common_samples <- names(tab)[tab >= 3] + +data_list <- list( + MRNA = Xmrna[, match(common_samples, colnames(Xmrna))], + MIRNA = Xmirna[, match(common_samples, colnames(Xmirna))], + PROTEIN = Xprot[, match(common_samples, colnames(Xprot))], + MET = Xmet[, match(common_samples, colnames(Xmet))], + LIPID = Xlip[, match(common_samples, colnames(Xlip))] +) +data_list <- lapply(data_list, function(x) { + colnames(x) <- common_samples + return(x) +}) + +tab_data_dimensions <- as.data.frame(vapply(data_list, nrow, numeric(1))) +colnames(tab_data_dimensions) <- c("Number of molecules") + +# get meta data for all samples +# original SDMS link not used here to facilitate external reproducibility +filename <- file.path("../","INFO", "15038_NA_NA_NA_NA_SelectedSampleListSysTox.xlsx") +metadat <- readxl::read_xlsx(filename, sheet = 1) %>% as.data.frame() + +dat_meta <- data.frame(common_samples, metadat_all[match(common_samples, metadat_all$`CAN/PatientID`), "TreatmentGroupName"]) +colnames(dat_meta) <- c("CAN", "Group") + +save(data_list, dat_meta, file = file.path(reportDir, "P15038_LungManuscript_data_list.rda")) +# load(file.path(reportDir, "P15038_LungManuscript_data_list.rda")) +``` + +```{r TableDataDimensions, results='asis', echo=FALSE, tab.cap="\\label{tab:TableDataDimensions} Data dimensions. Number of molecules considered for multi-omics analysis. ",cache=FALSE} +kable(tab_data_dimensions) +``` + +```{r FigSharedSamplesHM, echo=FALSE, fig.cap="\\label{fig:FigSharedSamplesHM} Lung samples obtained and analyzed from the same animals across the five omics analyses. A colored cell in the matrix indicates that a lung sample from an animal was analyzed successfully for the given omics data set. Note that only samples from the 3- and 6-month time point were submitted for metabolomics analysis.", cache=FALSE} +plot(p_shared_samples_hm) +``` + +```{r p_shared_samples_cumsum, echo=FALSE, fig.cap="\\label{fig:p_shared_samples_cumsum} Distribution plot showing the number of shared samples across a given number of omics data sets.", cache=FALSE} +plot(p_shared_samples_cumsum) +``` + +Figure \ref{fig:FigSharedSamplesHM} shows the data modalities available for animal, with the number of animals with >= 3, 4, or 5 available data modalities summarized in Figure \ref{fig:p_shared_samples_cumsum}. Table \ref{tab:TableDataDimensions} lists the number of considered molecules across the five data modalities. + +# Exposure markers + +```{r ExposureMarkerPlots, message=FALSE, warning=FALSE, size="scriptsize"} +# get current non-omics data compilation +file <- file.path("../","DATA", "P15038_APOE_P2_Exposure.rda") +dat_comb <- load2(file) +dat_comb$Group <- as.character(dat_comb$Group) +dat_comb <- dat_comb[grep("[56]m", dat_comb$Group), ] + +# setup visualization parameters +grp <- unique(dat_comb$Group) +grp <- grp[order( + getsplit(grp, "-", 3), + -as.numeric(factor(getsplit(grp, "-", 4))), + c("Sham" = 1, "3R4F" = 2, "CHTP1.2" = 3, "THS2.2" = 4, "CESS" = 5, "SWITCH" = 6, "NA" = 7)[getsplit(grp, " ", 1)], + getsplit(grp, " ", 2) +)] +grp +dat_comb$Group <- factor(dat_comb$Group, levels = grp) + +cols <- attr(idmaps[["MRNA"]], "colors") +names(cols) <- names(idmaps[["MRNA"]]) +cols2 <- cols[grep("6m", names(cols))] +names(cols2) <- gsub("6m", "5m", names(cols2)) +cols <- c(cols, cols2) +cols3 <- c("blue", "blue") +names(cols3) <- c("Sham 5m", "Sham 6m") +cols <- c(cols, cols3) + +ep_sel <- c( + "Aerosol uptake and exposure|Nicotine metabolites in urine (absolute)|Total metabolites|nmol", + "Aerosol uptake and exposure|Marker of exposure in urine (concentration)|3-HPMA|ng/mL", + "Aerosol uptake and exposure|Marker of exposure in urine (concentration)|Total NNAL|pg/mL", + "Aerosol uptake and exposure|Marker of exposure in urine (concentration)|SPMA|ng/mL", + "Aerosol uptake and exposure|Marker of exposure in urine (concentration)|CEMA|ng/mL" +) + +dat_comb <- dat_comb[dat_comb$EndpointMapped %in% ep_sel,] +range(dat_comb$N) + +p_exposure <- list() +for (ep in ep_sel) { + label <- getsplit(ep, "|", 3) + unit <- getsplit(ep, "|", 4) + + p <- barchartNonOmicsMouse(dat_comb, + ep = ep, + laby = paste0(label, " ", unit), + cols = cols + ) + + p_exposure[[label]] <- p + + filename <- file.path(reportDir, paste0("P15038_Urine_EXPOSURE-", label, ".pdf")) + pdf(file = filename, width = 6, height = 6, useDingbats = FALSE) + print(p) + dev.off() +} + +``` + +```{r p_exposure, echo=FALSE, fig.cap="\\label{fig:p_exposure} Exposure markers measured in urine.", fig.height=8, cache=FALSE} +egg::ggarrange(plots = p_exposure, ncol = 3) +``` + +Figure \ref{fig:p_exposure} shows exposure markers measured in urine. + +# mRNA-protein correlations + +```{r mRNAProteinCorrelations, message=FALSE, warning=FALSE, size="scriptsize"} +# mRNA vs protein correlation (group level) +idmapM <- lapply(idmaps[["MRNA"]], function(x) { + x$nodeLabel <- as.character(x$nodeLabel) + x[, c("nodeLabel", "foldChange", "adj.p.value", "p.value", "t", "df", "A", "TTT", "CTRL")] +}) +idmapP <- lapply(idmaps[["PROTEIN"]], function(x) { + x$nodeLabel <- as.character(x$nodeLabel) + x[, c("nodeLabel", "foldChange", "adj.p.value", "p.value", "t", "df", "A", "TTT", "CTRL")] +}) +stopifnot(all(names(idmapM) == names(idmapP))) + +molM <- unique(unlist(lapply(idmapM, function(x) as.character(x$nodeLabel)))) +molP <- unique(unlist(lapply(idmapP, function(x) as.character(x$nodeLabel)))) +shared_mols <- intersect(molM, molP) + +idmapM <- lapply(idmapM, function(x) { + x[match(shared_mols, x$nodeLabel), ] +}) +idmapP <- lapply(idmapP, function(x) { + x[match(shared_mols, x$nodeLabel), ] +}) + +dat_list <- lapply(names(idmapM), function(x) { + iM <- idmapM[[x]] + iP <- idmapP[[x]] + stopifnot(all(iM$nodeLabel == iP$nodeLabel)) + return(data.frame(Symbol = iM$nodeLabel, + fc_M = iM$foldChange, + sig_M = iM$adj.p.value < 0.05, + fc_P = iP$foldChange, + sig_P = iP$adj.p.value < 0.05, + Contrast = x)) +}) +dat <- do.call(rbind, dat_list) +dat$sig_summary <- "None" +dat$sig_summary[dat$sig_M == TRUE] <- "MRNA" +dat$sig_summary[dat$sig_P == TRUE] <- "PROTEIN" +dat$sig_summary[dat$sig_P == TRUE & dat$sig_M == TRUE] <- "BOTH" + +dat$Treatment <- getsplit(dat$Contrast, " ", 1) +dat$Treatment <- factor(dat$Treatment, levels = c("3R4F", "CHTP1.2", "THS2.2", "CESS", "SWITCH")) +dat$Time <- getsplit(dat$Contrast, " ", 2) +dat$Time <- factor(dat$Time, levels = c("3m", "4m", "6m")) + + +res <- tapply(1:nrow(dat), dat$Contrast, function(i) { + dat_sel <- dat[i, ] + dat_sel <- dat_sel[dat_sel$sig_summary != "None", , drop = FALSE] + if (nrow(dat_sel) > 10) { + res.sum <- summary(lm(fc_P ~ fc_M, data = dat_sel)) + return(list(r.squared = res.sum$r.squared, intercept = res.sum$coefficients[1, 1], slope = res.sum$coefficients[2, 1])) + } else { + return(list(r.squared = NA, slope = NA, intercept = NA)) + } +}) +stat_sum <- do.call(rbind, lapply(names(res), function(x) { + data.frame( + Contrast = x, + Treatment = factor(getsplit(x, " ", 1), levels = c("3R4F", "CHTP1.2", "THS2.2", "CESS", "SWITCH")), + Time = factor(getsplit(x, " ", 2), levels = c("3m", "4m", "6m")), + R2 = res[[x]]$r.squared, + intercept = res[[x]]$intercept, + slope = res[[x]]$slope + ) +})) +stat_sum <- as.data.frame(stat_sum) +stat_sum$R2_txt <- paste0("R2 = ", sprintf("%2.2f", stat_sum$R2)) +stat_sum$R2_txt[is.na(stat_sum$R2)] <- "" + +p <- ggplot(aes(x = fc_M, y = fc_P, colour = sig_summary, size = sig_summary), data = dat) +p <- p + geom_point() +p <- p + scale_size_manual("", values = c("BOTH" = 2, "MRNA" = 2, "PROTEIN" = 2, "None" = 1), guide = FALSE) +p <- p + scale_colour_manual("", values = c("BOTH" = "firebrick2", "MRNA" = "slateblue1", "PROTEIN" = "palegreen4", + "None" = "grey30"), guide = FALSE) +p <- p + geom_vline(xintercept = 0, size = 0.5, colour = "grey50") +p <- p + geom_hline(yintercept = 0, size = 0.5, colour = "grey50") +p <- p + geom_abline(aes(slope = slope, intercept = intercept), + colour = "steelblue", + size = 0.5, + data = stat_sum) +p <- p + geom_text(aes(label = R2_txt), + colour = "black", + x = 2, + y = 1.3, + hjust = 0, + size = 4, data = + stat_sum) +p <- p + facet_grid(Treatment ~ Time, drop = TRUE) +p <- p + theme_bw() +p <- p + labs(x = "log2 fold-change [MRNA]", y = "log2 fold-change [PROTEIN]") + +p_scatter_mRNA_Prot <- p +png(file = file.path(reportDir, "P15038_LungManuscript_Scatter_mRNA_Prot.png"), width = 7, height = 9, units = "in", res = 200) +print(p) +dev.off() + +p <- ggplot(aes(x = fc_M, y = fc_P, colour = sig_summary, size = sig_summary), + data = droplevels(dplyr::filter(dat, Treatment == "3R4F"))) +p <- p + geom_point() +p <- p + scale_size_manual("", values = c("BOTH" = 2, "MRNA" = 2, "PROTEIN" = 2, "None" = 1), guide = FALSE) +p <- p + scale_colour_manual("", values = c("BOTH" = "firebrick2", "MRNA" = "slateblue1", "PROTEIN" = "palegreen4", + "None" = "grey30"), guide = FALSE) +p <- p + geom_vline(xintercept = 0, size = 0.5, colour = "grey50") +p <- p + geom_hline(yintercept = 0, size = 0.5, colour = "grey50") +p <- p + geom_abline(aes(slope = slope, intercept = intercept), + colour = "steelblue", + size = 0.5, + data = droplevels(dplyr::filter(stat_sum, Treatment == "3R4F"))) +p <- p + geom_text(aes(label = R2_txt), + colour = "black", + x = 2, + y = 1.3, + hjust = 0, + size = 4, + data = droplevels(dplyr::filter(stat_sum, Treatment == "3R4F"))) +p <- p + facet_grid(Time ~ Treatment, drop = TRUE) +p <- p + theme_bw() +p <- p + labs(x = "log2 fold-change [MRNA]", y = "log2 fold-change [PROTEIN]") + +p_scatter_mRNA_Prot_3R4Fonly <- p + +png(file = file.path(reportDir, "P15038_LungManuscript_Scatter_mRNA_Prot_3R4Fonly.png"), + width = 3.5, height = 7, units = "in", res = 200) +print(p) +dev.off() +``` + +```{r FigCorrMRNAProt, echo=FALSE, fig.cap="\\label{fig:FigCorrMRNAProt} Correlation between mRNA and protein log2 fold-changes.", cache=FALSE, message=FALSE, warning=FALSE} +plot(p_scatter_mRNA_Prot) +``` + +```{r FigCorrMRNAProt3R4F, echo=FALSE, fig.cap="\\label{fig:FigCorrMRNAProt3R4F} Correlation between mRNA and protein log2 fold-changes.", cache=FALSE, message=FALSE, warning=FALSE} +plot(p_scatter_mRNA_Prot_3R4Fonly) +``` + +Figure \ref{fig:FigCorrMRNAProt} shows the fold-change correlation between mRNA and protein expression, with Figure \ref{fig:FigCorrMRNAProt3R4F} focused on the 3R4F groups. + +# Biological impact factor (BIF) for lung +```{r BIFPlotLung, message=FALSE, warning=FALSE, size="scriptsize"} +npa_list = load2(file.path(RobjectsDir, "NPALIST_P15038-S185500_APOE_P2_Lung_Mm_MRNA.rda")) +bif <- get_bif(npa_list) + +cols = attr(idmaps[["MRNA"]], "colors") +names(cols) = names(idmaps[["MRNA"]]) + + +filename = file.path(reportDir, "P15038_LungManuscript_BIF.pdf") +pdf(file = filename, width = 8,height=7) + res <- barplot(bif,col = cols, mar = 8, pie = FALSE) +dev.off() + +filename = file.path(reportDir, "P15038_LungManuscript_NPA_HEATMAP.pdf") +pdf(file = filename, width = 13,height=13) + plot(npa_list) +dev.off() + +``` + +```{r FigLungBIF, echo=FALSE, fig.cap="\\label{fig:FigLungBIF} Evaluation of biological impact on lung tissue using causal network enrichment approach based on transcriptomics data. RBIFs are represented for each group versus Sham comparisons.", cache=FALSE, fig.height=8} +res <- barplot(bif,col = cols, mar = 8, pie = FALSE) +``` + +```{r FigLungNPAHeatmap, echo=FALSE, fig.cap="\\label{fig:FigLungNPAHeatmap} NPA heatmap. NPA heatmap for the lung. The heatmap shows NPAs for each network in the collection, across all conditions.", cache=FALSE, fig.height=10} +plot(npa_list) +``` + +Figure \ref{fig:FigLungBIF} shows the biological impact on lung tissue using causal network enrichment approach and Figure \ref{fig:FigLungNPAHeatmap} the corresponding NPA heatmap. + +# Principal component analysis (individual omes) +```{r PCAs, message=FALSE, warning=FALSE, size="scriptsize"} +cols <- colgrps[,3] +names(cols) <- colgrps[,2] +pca_plots <- lapply(names(data_list), function(x) { + view_dat <- t(data_list[[x]]) + sel <- apply(view_dat, 1, function(y) !all(is.na(y))) + view_dat <- view_dat[sel, ] + group <- dat_meta[match(rownames(view_dat), dat_meta$CAN), "Group"] + cols2 <- cols[getsplit(group,"_",1)] + names(cols2) <- group + return(pcaGG(view_dat, group = factor(group), cols = cols2, main = x, print = FALSE, annotate = FALSE)) +}) +png(file = file.path(reportDir, "P15038_LungManuscript_PCA_ScorePlots2.png"), width = 11, height = 13, units = "in", res = 200) +do.call(gridExtra::grid.arrange, c(pca_plots, list(ncol = 2))) +dev.off() +``` + + +```{r FigPCAs, echo=FALSE, fig.cap="\\label{fig:FigPCAs} PCA score plots.", cache=FALSE, fig.height=8} +do.call(gridExtra::grid.arrange, c(pca_plots, list(ncol = 2))) +``` + +Figure \ref{fig:FigPCAs} shows PCA score plots for the five omics data modalities. + +# Multi-omics factor analysis +## Generate model +Perform multi-omics factor analysis for the five omice data modalities. Limit number of reported factors to reasonable +number using a 2% DropFactorThreshold, otherwise go with default parameters. + +```{r MOFARun, message=FALSE, warning=FALSE, size="scriptsize"} +MOFAobject <- createMOFAobject(data_list) + +ModelOptions <- getDefaultModelOptions(MOFAobject) +ModelOptions +TrainOptions <- getDefaultTrainOptions() +TrainOptions$seed <- 814279 +TrainOptions$DropFactorThreshold <- 0.02 +TrainOptions +DataOptions <- getDefaultDataOptions() +DataOptions + +mofa_file <- file.path(reportDir, "P15038_LungManuscript_MOFA2.rda") +if (!force_rerun_mofa && file.exists(mofa_file)) { + load(mofa_file) +} else { + MOFAobject <- prepareMOFA(MOFAobject, + DataOptions = DataOptions, + ModelOptions = ModelOptions, + TrainOptions = TrainOptions + ) + MOFAobject <- runMOFA(MOFAobject) + save(MOFAobject, file = mofa_file) +} + +``` + + +## Explained variance, score, and loading plots +```{r MOFAPlots1, message=FALSE, warning=FALSE, size="scriptsize"} +p_var_explained <- plotVarianceExplained(MOFAobject) +pdf(file = file.path(reportDir, "P15038_LungManuscript_MOFA_VarianceExplained.pdf"), width = 7, height = 7) + print(p_var_explained) +dev.off() + +# alternative stacked barplot for explained variance +R2_list <- calculateVarianceExplained(MOFAobject) +fvar_m <- R2_list$R2Total +fvar_mk <- R2_list$R2PerFactor +plotdat <- reshape2::melt(fvar_mk) +colnames(plotdat) <- c("LF", "View", "ExpVar") +p <- ggplot(aes(x = factor(View, levels = c("MRNA", "PROTEIN", "MET", "MIRNA", "LIPID")), y = ExpVar, fill = LF), data = plotdat) +p <- p + geom_bar(stat = "identity", width = 0.5) +p <- p + scale_fill_brewer("LF", palette = "Spectral") +p <- p + theme_bw() +p <- p + theme(axis.text.x = element_text(angle = 45, hjust = 1, vjust = 1)) +p <- p + theme(plot.title = element_text(hjust = 0.5)) +p <- p + labs(x = "", y = "explained variance", title = "MOFA") +p_var_explained_bars <- p + +pdf(file = file.path(reportDir, "P15038_LungManuscript_MOFA_VarianceExplainedBars.pdf"), width = 5, height = 5) + plot(p_var_explained_bars) +dev.off() + +# export weights +res <- MOFA::getWeights(MOFAobject) +fn <- file.path(reportDir, "P15038_LungManuscript_MOFA_AllWeights.rda") +save(res, file = fn) + +# Top weights +pdf(file = file.path(reportDir, "P15038_LungManuscript_MOFA_TopWeights.pdf"), width = 9, height = 8) +for (data_type in c("PROTEIN", "MRNA", "MIRNA", "LIPID", "MET")) { + for (LF in 1:3) { + plot(plotTopWeights(MOFAobject, data_type, LF, nfeatures = 30) + labs(title = data_type)) + } +} +dev.off() + +# Scatter Pairs +grp <- sapply(strsplit(as.character(dat_meta$Group), "_"), function(x) x[[1]]) +tp <- sapply(strsplit(as.character(dat_meta$Group), "_"), function(x) x[[2]]) + +cols <- colgrps[match(unique(grp), colgrps[, 2]), "Color"] +names(cols) <- unique(grp) + +p <- plotFactorScatters2(MOFAobject, factors = 1:10, color_by = grp, shape_by = factor(tp), col_values = cols) +p_scatter_pairs <- p + +pdf(file = file.path(reportDir, "P15038_LungManuscript_MOFA_FactorsScatterPairs.pdf"), width = 15, height = 15) +print(p_scatter_pairs) +dev.off() + +# LF1 score beeswarm +Z <- getFactors(MOFAobject, + factors = 1, + as.data.frame = TRUE +) +Z$Group <- dat_meta[match(Z$sample, dat_meta$CAN), "Group"] +Z$Treatment <- getsplit(Z$Group, "_", 1) +Z$Time <- getsplit(Z$Group, "_", 2) + +p <- ggplot(aes(x = 0, y = value, colour = Treatment, shape = Time), data = Z) +p <- p + ggbeeswarm::geom_quasirandom() + +cols <- colgrps[match(unique(Z$Treatment), colgrps[, 2]), "Color"] +names(cols) <- unique(Z$Treatment) + +p <- p + scale_colour_manual("Treatment", values = cols) +p <- p + theme_bw() +p <- p + theme( + axis.text.x = element_blank(), + axis.ticks.x = element_blank(), + plot.title = element_text(hjust = 0.5) +) +p <- p + labs(title = "MOFA", x = "", y = "score LF1") +p_LF1_score_beeswarm <- p + +pdf(file = file.path(reportDir, "P15038_LungManuscript_MOFA_LF1_ScoresByGroup.pdf"), width = 3.5, height = 3.5, useDingbats = FALSE) +plot(p_LF1_score_beeswarm) +dev.off() +``` + +```{r FigMOFAVarExpl, echo=FALSE, fig.cap="\\label{fig:FigMOFAVarExpl} Explained variance across omics data modalities and latent factors.", cache=FALSE} +plot(p_var_explained) +``` + + +```{r FigMOFAVarExplBar, echo=FALSE, fig.cap="\\label{fig:FigMOFAVarExplBar} Explained variance across omics data modalities and latent factors.", cache=FALSE} +plot(p_var_explained_bars) +``` + + +```{r FigMOFAScatterPairs, echo=FALSE, fig.cap="\\label{fig:FigMOFAScatterPairs} LF score pairs.", cache=FALSE} +print(p_scatter_pairs) +``` + + +```{r FigMOFALF1Beeswarm, echo=FALSE, fig.cap="\\label{fig:FigMOFALF1Beeswarm} LF1 scores.", cache=FALSE} +plot(p_LF1_score_beeswarm) +``` + +Figure \ref{fig:FigMOFAVarExpl} and Figure \ref{fig:FigMOFAVarExplBar} show variance explained by the MOFA model +across the data modalities and discovered latent factors (LFs). Figure \ref{fig:FigMOFAScatterPairs} shows the pair-wise +LF score plots, highlighting LF1 as the LF that separates the exposure groups. Figure \ref{fig:FigMOFALF1Beeswarm} shows +the scores for LF1. + +## GSEA for biological interpretation of LF1 +```{r MOFAGSEA, message=FALSE, warning=FALSE, size="scriptsize"} +# functional annotation --> GSEA +gsc_file <- readLines(file.path("..","DATA", "EXTERNAL", "ReactomePathways_23Apr2018.gmt")) +gsc <- do.call(rbind, lapply(gsc_file, function(x) { + ss <- strsplit(x, "\t", fixed = TRUE)[[1]] + genes <- ss[seq(3, length(ss))] + gs <- ss[1] + data.frame(Gene = genes, GS = gs) +})) +gsc <- piano::loadGSC(gsc) + +weight_list <- MOFA::getWeights(MOFAobject) +fgsea.res <- lapply(c("MRNA", "PROTEIN"), function(view) { + geneLevelStats <- weight_list[[view]][, "LF1"] + names(geneLevelStats) <- getsplit(names(geneLevelStats), "_", 1) + names(geneLevelStats) <- GetOrtholog(names(geneLevelStats), species_from = "Mm", species_to = "Hs") + geneLevelStats <- geneLevelStats[!is.na(names(geneLevelStats))] + geneLevelStats <- tapply(geneLevelStats, names(geneLevelStats), function(x) x[which.max(abs(x))]) + + set.seed(23489) + piano.res <- piano::runGSA( + geneLevelStats = geneLevelStats, + geneSetStat = "fgsea", + signifMethod = "geneSampling", + adjMethod = "fdr", + ncpus = 1, + gsc = gsc, + gsSizeLim = c(5, Inf) + ) + piano::GSAsummaryTable(piano.res) +}) +names(fgsea.res) <- c("MRNA", "PROTEIN") +filename <- file.path(reportDir, "P15038_LungManuscript_MOFA_LF1_FGSEA.rda") +save(fgsea.res, file = filename) + +# tables +for (view in c("MRNA", "PROTEIN")) { + filename <- file.path(reportDir, paste0("P15038_LungManuscript_MOFA_FGSEA_LF1_", view, ".csv")) + write.csv(fgsea.res[[view]], file = filename) +} + +# figures +p_MOFA_GSEA_figures <- list() +for (view in c("MRNA", "PROTEIN")) { + tab <- fgsea.res[[view]] + tab <- tab[tab$"p adj (dist.dir.up)" < 0.05 | tab$"p adj (dist.dir.dn)" < 0.05, ] + tab$pval <- ifelse(!is.na(tab$"p (dist.dir.up)"), tab$"p (dist.dir.up)", tab$"p (dist.dir.dn)") + sort_order <- order(tab$pval, decreasing = FALSE) + tab <- tab[sort_order, ] + tab <- tab[1:20, ] + colnames(tab)[3] <- "Stat" + tab$Name <- factor(tab$Name, levels = rev(tab$Name)) + + p <- ggplot(aes_string(x = "Name", y = "Stat", fill = "pval"), data = tab) + p <- p + geom_bar(stat = "identity") + # p = p + scale_y_log10() + p <- p + ggplot2::coord_flip() + p <- p + theme_bw() + p <- p + labs(y = "Stat", x = "", title = view) + p <- p + theme(axis.text = element_text(size = 8, colour = "black")) + p <- p + theme(axis.title = element_text(size = 8, colour = "black", face = "bold")) + p_MOFA_GSEA_figures[[view]] <- p + + filename <- file.path(reportDir, paste0("P15038_LungManuscript_MOFA_FGSEA_LF1_", view, ".pdf")) + pdf(file = filename, width = 7, height = 5) + print(p) + dev.off() +} +``` + +```{r FigMOFAGSEA, echo=FALSE, fig.cap="\\label{fig:FigMOFAGSEA} LF1 scores.", cache=FALSE, fig.height=8} +egg::ggarrange(plots = p_MOFA_GSEA_figures, ncol = 1) +``` + +Figure \ref{fig:FigMOFAGSEA} shows the TOP 20 GSEA-enriched gene sets by p-value for the Reactome collection. + +## LF1 vs inflammatory cells in BALF +```{r MOFABALFCorrelation, message=FALSE, warning=FALSE, size="scriptsize"} +## correlate / compare scores with total cells in BALF (group averages) +stat_dat <- load2(file.path("../","DATA", "P15038_APOE_P2_BALF_cells.rda")) +# head(stat_dat) +stat_dat <- stat_dat[stat_dat$Endpoint_Sub_Cat == "FLC differentiation (count)" & + stat_dat$Endpoint_Name == "Total cells", ] +stat_dat$Group <- paste0(gsub("Switch CHTP", "SWITCH", + gsub("Cessation", "CESS", stat_dat$Treatment_Order)), "_", + gsub("M", "m", stat_dat$Dissection_Order)) +unique(stat_dat$Group) + +Z <- getFactors(MOFAobject, + factors = 1, + as.data.frame = TRUE +) +Z$Group <- dat_meta[match(Z$sample, dat_meta$CAN), "Group"] +Z$Treatment <- getsplit(Z$Group, "_", 1) +Z$Time <- getsplit(Z$Group, "_", 2) + +stopifnot(all(Z$Group %in% stat_dat$Group)) + +Z_avg <- Z %>% dplyr::group_by(Group, Treatment, Time) %>% dplyr::summarise(mean_score = mean(value, na.rm = TRUE)) +Z_avg <- as.data.frame(Z_avg) +Z_avg$TotalCells <- stat_dat[match(Z_avg$Group, stat_dat$Group), "Endpoint_Value_Mean"] + +p <- ggplot(aes(x = mean_score, y = TotalCells), data = Z_avg) +p <- p + geom_point(aes(colour = Treatment, shape = Time), size = 2) +p <- p + geom_smooth(method = "lm", data = Z_avg, formula = y ~ x) +p <- p + theme_bw() +p <- p + labs(x = "mean MOFA score [comp. 1]", y = "mean Total cells in BALF [10E5]") + +cols <- colgrps[, "Color"] +names(cols) <- colgrps[, "Label"] +p <- p + scale_colour_manual("Treatment", values = cols) + +p_MOFA_BALF_correlation <- p + +filename <- file.path(reportDir, "P15038_LungManuscript_MOFA_TotalCells_Scatter.pdf") +pdf(file = filename, width = 4.4, height = 3.5, useDingbats = FALSE) +print(p_MOFA_BALF_correlation) +dev.off() +``` + +```{r FigMOFABALFCorr, echo=FALSE, fig.cap="\\label{fig:FigMOFABALFCorr} LF1 vs BALF cells.", cache=FALSE} +plot(p_MOFA_BALF_correlation) +``` + +Figure \ref{fig:FigMOFABALFCorr} compares average LF1 and BALF cell counts across the exposure groups. + +# sGCCA: complement MOFA approach +```{r sGCCA, message=FALSE, warning=FALSE, size="scriptsize"} + +# for definition of data_list, see above +data_list2 <- lapply(data_list, function(x) t(x)) +lapply(data_list2, dim) + +# design matrix for sGCCA +design <- matrix(1, + ncol = length(data_list), nrow = length(data_list), + dimnames = list(names(data_list), names(data_list)) +) +diag(design) <- 0 +design + +ncomp <- 8 +# set number of variables to select, per component and per data set (fixed to 30) +list.keepX <- list(MRNA = rep(30, ncomp), + MIRNA = rep(30, ncomp), + PROTEIN = rep(30, ncomp), + MET = rep(30, ncomp), + LIPID = rep(30, ncomp)) + +set.seed(342897) +res.block.spls <- block.spls( + X = data_list2, indY = 4, + ncomp = ncomp, keepX = list.keepX, design = design, mode = "canonical", + max.iter = 1000 +) +# res.block.spls + +res <- selectVar(res.block.spls, comp = 1) + +# stacked barplot for explained variance +fvar_mk <- do.call(cbind, res.block.spls$explained_variance) +rownames(fvar_mk) <- gsub("comp ", "", rownames(fvar_mk)) +plotdat <- reshape2::melt(fvar_mk) +colnames(plotdat) <- c("LF", "View", "ExpVar") +p <- ggplot(aes(x = factor(View, levels = c("MRNA", "PROTEIN", "MET", "MIRNA", "LIPID")), + y = ExpVar, fill = factor(LF, levels = 1:8)), data = plotdat) +p <- p + geom_bar(stat = "identity", width = 0.5) +p <- p + scale_fill_brewer("LF", palette = "Spectral") +p <- p + theme_bw() +p <- p + theme(axis.text.x = element_text(angle = 45, hjust = 1, vjust = 1)) +p <- p + theme(plot.title = element_text(hjust = 0.5)) +p <- p + labs(x = "", y = "explained variance", title = "sGCCA") +p_sGCCA_expl_var <- p + +pdf(file = file.path(reportDir, "P15038_LungManuscript_sGCCA_VarianceExplainedBars.pdf"), width = 3, height = 3.2) +plot(p_sGCCA_expl_var) +dev.off() + +#score plots +groups <- dat_meta[match(rownames(data_list2[[1]]), dat_meta$"CAN"), "Group"] +TTT <- factor(getsplit(groups, "_", 1), levels = colgrps[, 2]) +TIME <- factor(getsplit(groups, "_", 2)) + +fn <- file.path(reportDir, "P15038_LungManuscript_sGCCA_SCORE-PLOT.pdf") +pdf(file = fn, width = 12, height = 9, useDingbats = FALSE) +plotIndiv(res.block.spls, + group = TTT, + col.per.group = colgrps[match(levels(TTT), colgrps[, 2]), "Color"], + pch = TIME, + ind.names = FALSE, + legend = TRUE, + ellipse = FALSE + ) +dev.off() + +# LF score beeswarm for each block +Z <- do.call(rbind, lapply(names(res.block.spls$variates), function(x) { + vars <- res.block.spls$variates[[x]] + data.frame(block = x, sample = rownames(vars), value = as.numeric(vars[, "comp 1"])) +})) +Z$Group <- dat_meta[match(Z$sample, dat_meta$CAN), "Group"] +Z$Treatment <- getsplit(Z$Group, "_", 1) +Z$Time <- getsplit(Z$Group, "_", 2) +Z$block <- factor(Z$block, levels = c("MRNA", "PROTEIN", "MET", "MIRNA", "LIPID")) + +p <- ggplot(aes(x = 0, y = value, colour = Treatment, shape = Time), data = Z) +p <- p + ggbeeswarm::geom_quasirandom() + +cols <- colgrps[match(unique(Z$Treatment), colgrps[, 2]), "Color"] +names(cols) <- unique(Z$Treatment) +p <- p + scale_colour_manual("Treatment", values = cols) + +p <- p + facet_wrap(~block, ncol = 2) + +p <- p + theme_bw() +p <- p + theme( + axis.text.x = element_blank(), + axis.ticks.x = element_blank(), + plot.title = element_text(hjust = 0.5) +) +p <- p + labs(title = "sGCCA", x = "", y = "score LF1") +p_sGCCA_LF1_beeswarm <- p + +pdf(file = file.path(reportDir, "P15038_LungManuscript_sGCCA_LF1_ScoresByGroup.pdf"), + width = 7, height = 7, useDingbats = FALSE) +plot(p_sGCCA_LF1_beeswarm) +dev.off() + +# illustrates coefficient weights in each block +fn <- file.path(reportDir, "P15038_LungManuscript_sGCCA_LOADINGS-PLOT.pdf") +pdf(file = fn, width = 12, height = 12) +plotLoadings(res.block.spls, ncomp = 1) +dev.off() +``` + +```{r FigSGCCAScores, echo=FALSE, fig.cap="\\label{fig:FigSGCCAScores} sGCCA score plots.", cache=FALSE} +plotIndiv(res.block.spls, + group = TTT, + col.per.group = colgrps[match(levels(TTT), colgrps[, 2]), "Color"], + pch = TIME, + ind.names = FALSE, + legend = TRUE, + ellipse = FALSE + ) +``` + + +```{r FigSGCCAScoreLF1, echo=FALSE, fig.cap="\\label{fig:FigSGCCAScoreLF1} sGCCA score plot for LF1.", cache=FALSE} +plot(p_sGCCA_LF1_beeswarm) +``` + +Figure \ref{fig:FigSGCCAScores} shows the score plots for the sGCCA appraoch, with Figure \ref{fig:FigSGCCAScoreLF1} +focussing on the LF1 scores. + + +# MOFA vs sGCCA +```{r MOFAsGCCAComparison, message=FALSE, warning=FALSE, size="scriptsize"} +## compare loadings / weights between SGCCA and MOFA +weights_sgcca <- selectVar(res.block.spls, comp = 1) +fn <- file.path(reportDir, "P15038_LungManuscript_MOFA_AllWeights.rda") +weights_mofa <- load2(fn) + +# compare score rankings +plots <- list() +res_list <- list() +for (view in names(weights_mofa)) { + dat <- weights_sgcca[[view]]$value + dat$rank_sgcca <- sign(dat$value.var) * order(abs(dat$value.var), decreasing = TRUE) + + tmp <- weights_mofa[[view]][order(abs(weights_mofa[[view]][, "LF1"]), decreasing = TRUE), , drop = FALSE] + tmp <- data.frame(tmp) + tmp$rank <- sign(tmp[, "LF1"]) * seq_len(nrow(tmp)) + + dat$rank_mofa <- tmp$rank[match(rownames(dat), rownames(tmp))] + + dat$x <- abs(dat$rank_sgcca) + dat$y <- abs(dat$rank_mofa) + dat$x_sign <- sign(dat$rank_sgcca) + dat$y_sign <- sign(dat$rank_mofa) + dat$xy_sign <- ifelse(dat$x_sign * dat$y_sign == 1, "same", "opposite") + + p <- ggplot(aes(x = x, y = y, colour = xy_sign), data = dat) + p <- p + geom_point(size = 2) + p <- p + scale_colour_manual("Sign", values = c("same" = "red", "opposite" = "blue")) + p <- p + theme_bw() + p <- p + labs(x = "rank sGCCA [LF1]", y = "rank MOFA [LF1]", title = view) + + plots[[view]] <- p + + tmp <- dat[, c("rank_sgcca", "rank_mofa")] + tmp$analyte <- rownames(tmp) + tmp$view <- view + res_list[[view]] <- tmp +} + +filename <- file.path(reportDir, "P15038_LungManuscript_MOFA_sGCCA_Comparison.pdf") +pdf(file = filename, width = 8, height = 10, useDingbats = FALSE) +gridExtra::grid.arrange(grobs = plots, cols = 2) +dev.off() + +res_dat <- do.call(rbind, res_list) +filename <- file.path(reportDir, "P15038_LungManuscript_MOFA_sGCCA_Comparison.csv") +write.csv(res_dat, file = filename, row.names = FALSE) +``` + +```{r FigMOFASGCCAComp, echo=FALSE, fig.cap="\\label{fig:FigMOFASGCCAComp} Comparison of loadings between MOFA and sGCCA approach.", fig.height = 8, cache=FALSE} +gridExtra::grid.arrange(grobs = plots, cols = 2) +``` + +Figure \ref{fig:FigMOFASGCCAComp} compares the loadings between the MOFA and sGCCA approach. + +# Network-assisted interpretation of LF1 +## Create network +```{r NetworkInterpretationCreate, message=FALSE, warning=FALSE, size="scriptsize"} +if (force_recreate_network) { + # * Sub-Section * Create metabolite network + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + # Prepare KEGG + reaction_dat <- readr::read_delim("../DATA/EXTERNAL/reaction_mapformula.lst", " ", col_names = FALSE) %>% as.data.frame() + reaction_dat[reaction_dat$X1 == "R00005:", ] + colnames(reaction_dat) <- c("rxn_ID", "pwy", "cpn_ID1", "dir", "cpn_ID2") + reaction_dat$rxn_ID <- gsub(":", "", reaction_dat$rxn_ID) + reaction_dat$pwy <- gsub(":", "", reaction_dat$pwy) + reaction_dat <- reaction_dat[, -2] + reaction_dat <- unique(reaction_dat) + head(reaction_dat) + dim(reaction_dat) + + reaction_ko <- readr::read_delim("DATA/EXTERNAL/reaction_ko.list", "\t", col_names = FALSE) %>% as.data.frame() + colnames(reaction_ko) <- c("rxn_ID", "ko_ID") + reaction_ko[] <- lapply(reaction_ko, function(x) gsub(".+:", "", x)) + head(reaction_ko) + reaction_dat <- dplyr::left_join(reaction_dat, reaction_ko, by = c("rxn_ID" = "rxn_ID")) + head(reaction_dat) + + # read mouse gene mapping + gene_dat <- readr::read_delim("../DATA/EXTERNAL/T01002.kff", "\t", col_names = FALSE) %>% as.data.frame() + head(gene_dat) + reaction_dat$gene_Mm <- gene_dat[match(reaction_dat$ko_ID, gene_dat$X10), "X8"] + reaction_dat <- reaction_dat[!is.na(reaction_dat$gene_Mm), ] + dim(reaction_dat) + + # read compound data mapping + compound_dat <- readr::read_delim("../DATA/EXTERNAL/cmp_extracted.table.txt", "\t", col_names = FALSE) %>% + as.data.frame() + colnames(compound_dat) <- c("cpn_ID", "names") + compound_dat$label <- getsplit(compound_dat$names, ";", 1) + reaction_dat$cpn_lab1 <- compound_dat[match(reaction_dat$cpn_ID1, compound_dat$cpn_ID), "label"] + reaction_dat$cpn_lab2 <- compound_dat[match(reaction_dat$cpn_ID2, compound_dat$cpn_ID), "label"] + head(reaction_dat) + + # graph with gene and metabolite nodes + g1_tab <- reaction_dat[, c("cpn_ID1", "gene_Mm")] + g2_tab <- reaction_dat[, c("cpn_ID2", "gene_Mm")] + colnames(g1_tab) <- colnames(g2_tab) <- c("cpn_ID", "gene_Mm") + g_tab <- rbind(g1_tab, g2_tab) + g_tab <- unique(g_tab) + g_met <- igraph::graph.data.frame(g_tab, directed = FALSE, vertices = NULL) + + # * Sub-Section * Create StringDB network + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + string_mapping <- readr::read_tsv(file.path("../","DATA", "EXTERNAL", "10090.protein.aliases.v10.5.txt"), + col_types = "ccc", col_names = c("STRINGID", "ID", "SOURCE"), + skip = 1 + ) %>% as.data.frame() + dim(string_mapping) + head(string_mapping) + + sel <- grep("Ensembl_EntrezGene", string_mapping$SOURCE, fixed = TRUE) + notsel <- grep("Ensembl_EntrezGene_synonym", string_mapping$SOURCE, fixed = TRUE) + sel <- setdiff(sel, notsel) + string_mapping <- string_mapping[sel, ] + + string_net <- readr::read_delim(file.path("../","DATA", "EXTERNAL", "10090.protein.links.detailed.v10.5.txt"), " ", + col_types = "cciiiiiiii", + col_names = c("protein1", "protein2", "neighborhood", + "fusion", "cooccurence", "coexpression", + "experimental", "database", "textmining", "combined_score"), + skip = 1 + ) %>% as.data.frame() + dim(string_net) + head(string_net) + string_net <- string_net[string_net$combined_score > 700, ] # high confidence defined by StringDB + dim(string_net) + string_net$Symbol1 <- string_mapping[match(string_net$protein1, string_mapping$STRINGID), "ID"] + string_net$Symbol2 <- string_mapping[match(string_net$protein2, string_mapping$STRINGID), "ID"] + string_net <- string_net[!is.na(string_net$Symbol1) & !is.na(string_net$Symbol2), ] + string_net <- string_net[, c(11, 12, 10, 1:9)] + dim(string_net) + head(string_net) + # make unique + KEY <- apply(string_net, 1, function(x) { + ifelse(x["Symbol1"] < x["Symbol2"], + paste0(x["Symbol1"], "-", x["Symbol2"]), + paste0(x["Symbol2"], "-", x["Symbol1"]) + ) + }) + string_net <- string_net[!duplicated(KEY), ] + dim(string_net) + + g_string <- igraph::graph.data.frame(string_net, directed = FALSE, vertices = NULL) + g_string + + # * Sub-Section * Prepare miRNA network + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # miRTarBase + # http://mirtarbase.mbc.nctu.edu.tw/php/download.php + dat <- read.xlsx2(file.path("../","DATA", "EXTERNAL", "mirTarBase_Mm_10July2018.xls"), sheetIndex = 1) + + dat <- dat %>% + group_by(miRTarBase.ID, miRNA, Target.Gene) %>% + summarize( + Experiments = paste0(Experiments, collapse = "//"), + no_refs = length(unique(References..PMID.)) + ) + dat <- as.data.frame(dat) + toMatch <- toupper(c("Western blot", "Reporter assay", "qRT-PCR")) + dat$no_hc <- stri_count_regex(toupper(dat$Experiments), paste(toMatch, collapse = "|")) + head(dat) + dat <- dat %>% dplyr::filter(no_refs > 1, no_hc > 1) %>% as.data.frame() + dat <- dat[, c(2, 3, 1, 4:6)] + + g_mirna <- igraph::graph.data.frame(dat, directed = FALSE, vertices = NULL) + g_mirna + + # * Sub-Section * Define weights and combine + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # check naming alignment + V(g_met)$name[V(g_met)$name == "Acod1"] <- "Irg1" + + # define weights + E(g_met)$weight <- 0.1 + E(g_string)$weight <- 1 - (E(g_string)$combined_score / 1000) + 0.1 + E(g_mirna)$weight <- 0.1 + + g_comb <- igraph::union(g_met, g_string, g_mirna, byname = TRUE) + class(g_comb) + g_comb + + E(g_comb)$weight <- ifelse(is.na(E(g_comb)$weight_1), E(g_comb)$weight_2, E(g_comb)$weight_1) + E(g_comb)$weight <- ifelse(is.na(E(g_comb)$weight_3), E(g_comb)$weight, E(g_comb)$weight_3) + + summary(E(g_comb)$weight) + + file <- file.path(reportDir, "P15038_LungManuscript_IntegrNetwork.rda") + save(g_comb, file = file) +} else { + if (force_rerun_pcsf) { + file <- file.path(reportDir, "P15038_LungManuscript_IntegrNetwork.rda") + if (!file.exists(file)) { + stop("Need integrated network to rerun PCSF (required KEGG license to create/share)") + } + g_comb <- load2(file) + } else { + cat("Integrated network not needed (PCSF not rerun)\n") + } + compound_dat <- readr::read_delim("../DATA/EXTERNAL/cmp_extracted.table.txt", "\t", col_names = FALSE) %>% + as.data.frame() + colnames(compound_dat) <- c("cpn_ID", "names") + compound_dat$label <- getsplit(compound_dat$names, ";", 1) +} +``` + +## PCSF-derived network +```{r NetworkInterpretationPCSF, message=FALSE, warning=FALSE, size="scriptsize"} +max_terminal_view <- 200 +res <- lapply(names(weights_mofa), function(view) { + lval <- abs(weights_mofa[[view]][, "LF1"]) + lval <- lval / sum(lval) + sel <- which(lval > 2 * 1 / length(lval)) + if (length(sel) > max_terminal_view) { + return(lval[sel][order(lval[sel], decreasing = TRUE)[seq_len(max_terminal_view)]]) + } else { + return(lval[sel]) + } +}) +names(res) <- names(weights_mofa) +lapply(res, length) + +# fix names +Imet <- dats[["METABOLITE"]]$I_metabolite +names(res[["MET"]]) <- Imet[match(names(res[["MET"]]), Imet$BIOCHEMICAL), "KEGG"] +nm <- names(res[["MET"]]) +res[["MET"]] <- res[["MET"]][nm != "" & !is.na(nm)] + +names(res[["PROTEIN"]]) <- getsplit(names(res[["PROTEIN"]]), "_", 1) +nm <- names(res[["PROTEIN"]]) +res[["PROTEIN"]] <- res[["PROTEIN"]][nm != "" & !is.na(nm)] + +lipid2kegg <- read.csv("../DATA/P15038_LungManuscript_LipidMappingTable3_bt.csv") +names(res[["LIPID"]]) <- gsub(" ", "", gsub("\xa0", "", lipid2kegg[match(names(res[["LIPID"]]), + lipid2kegg$Name_PMI), "KEGG"])) +nm <- names(res[["LIPID"]]) +res[["LIPID"]] <- res[["LIPID"]][nm != "" & !is.na(nm)] +res[["LIPID"]] <- tapply(res[["LIPID"]], names(res[["LIPID"]]), mean, na.rm = TRUE) + +terminals <- c(res[["PROTEIN"]], res[["MRNA"]], res[["MET"]], res[["MIRNA"]], res[["LIPID"]]) +terminals <- tapply(unname(terminals), names(terminals), function(x) max(x)) + +set.seed(4823972) +test_grid <- expand.grid(omega = seq(0.20, 1, by = 0.2), beta = c(100, 200, 400, 1000, 2000), + stringsAsFactors = FALSE) +test_grid$label <- paste0(sprintf("%02d", 1:nrow(test_grid)), ":w=", + test_grid[, "omega"], ",b=", test_grid[, "beta"]) + +file <- file.path(reportDir, "P15038_LungManuscript_Network_PCSF.rda") +if (!force_rerun_pcsf && file.exists(file)) { + pcsf.res <- load2(file) +} else { + pcsf.res <- lapply(1:nrow(test_grid), function(i) { + cat(i, "\n") + subnet <- PCSF(g_comb, + terminals, + w = test_grid[i, "omega"], + b = test_grid[i, "beta"], + mu = 0.0005 + ) + return(subnet) + }) + save(pcsf.res, file = file) +} + +stat <- unlist(lapply(pcsf.res, function(g) { + comps <- components(g) + comps$no +})) +dat <- data.frame(no_trees = stat) +dat <- cbind(test_grid, dat) +p <- ggplot(aes(x = label, y = no_trees, fill = beta, colour = omega), data = dat) +p <- p + geom_bar(stat = "identity") +p <- p + scale_fill_distiller(type = "seq", palette = "Purples", direction = 1) +p <- p + scale_colour_distiller(type = "seq", palette = "Greens", direction = 1) +p <- p + theme_bw() +p <- p + labs(x = "", y = "#trees") +p <- p + theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5)) +p1 <- p + +stat <- unlist(lapply(pcsf.res, function(g) { + sum(names(terminals) %in% V(g)$name) / length(terminals) * 100 +})) +dat <- data.frame(terminals_percent = stat) +dat <- cbind(test_grid, dat) +p <- ggplot(aes(x = label, y = terminals_percent, fill = beta, colour = omega), data = dat) +p <- p + geom_bar(stat = "identity") +p <- p + scale_fill_distiller(type = "seq", palette = "Purples", direction = 1) +p <- p + scale_colour_distiller(type = "seq", palette = "Greens", direction = 1) +p <- p + theme_bw() +p <- p + labs(x = "", y = "terminals %") +p <- p + theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5)) +p2 <- p + +stat_dat <- do.call(rbind, lapply(1:length(pcsf.res), function(i) { + g <- pcsf.res[[i]] + comps <- components(g) + data.frame(testrun = as.character(i), comp = as.character(1:length(comps$csize)), no_elements = comps$csize) +})) +test_grid2 <- test_grid +test_grid2$testrun <- as.character(rownames(test_grid2)) +stat_dat <- left_join(stat_dat, test_grid2, by = "testrun") + +p <- ggplot(aes(x = label, y = no_elements, fill = comp), data = stat_dat) +p <- p + geom_bar(stat = "identity", colour = "black") +# p = p + scale_fill_distiller(type = "seq", palette = "Purples", direction = 1) +# p = p + scale_colour_distiller(type = "seq", palette = "Greens", direction = 1) +p <- p + theme_bw() +p <- p + labs(x = "", y = "nodes per component") +p <- p + theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5)) +p3 <- p + +file <- file.path(reportDir, "P15038_LungManuscript_Network_PCSF_stats.png") +png(file = file, units = "in", res = 200, width = 7, height = 14) +gridExtra::grid.arrange(p1, p2, p3, ncol = 1) +dev.off() + +# SELECT PARAMS +# 18: w = 0.6; b = 1000 +# rational: +# - low number but not only single tree +# - good coverage of terminals (close to saturation) + +# run randomized version +seltest <- 18 +set.seed(423987823) + +file <- file.path(reportDir, "P15038_LungManuscript_Network_PCSF_final.rda") +if (!force_rerun_pcsf && file.exists(file)) { + subnet_final <- load2(file) +} else { + subnet_final <- PCSF_rand(g_comb, terminals, n = 10, r = 0.1, w = test_grid[seltest, "omega"], + b = test_grid[seltest, "beta"], mu = 0.0005) + save(subnet_final, file = file) +} + +subnet_final2 <- subnet_final +sel <- grepl("^C\\d{5}", V(subnet_final2)$name) +V(subnet_final2)[sel]$name <- compound_dat[match(V(subnet_final2)[sel]$name, compound_dat$cpn_ID), "label"] + +res_network_enrich <- enrichment_analysis(subnet_final2) +file <- file.path(reportDir, "P15038_LungManuscript_PCSF_network_final_enrich.rda") +save(res_network_enrich, file = file) +``` + +```{r FigPCSFParamSel, echo=FALSE, fig.cap="\\label{fig:FigPCSFParamSel} Grid-search results for PCSF-based network identification.", fig.height = 8, cache=FALSE} +gridExtra::grid.arrange(p1, p2, p3, ncol = 1) +``` + +Figure \ref{fig:FigPCSFParamSel} shows the grid-search results for PCSF-based network identification. Based on these results, +we selected condition #18 (w = 0.6; b = 1000) for functional interpretation of the multi-omics links. The rational for +the selection was to end up with a low number of trees (but not only a single tree) and a good coverage of terminals (close to saturation). + +```{r NetworkInterpretationVisualize, message=FALSE, warning=FALSE, size="scriptsize"} +# alternative visualization +subnet <- res_network_enrich$subnet +edge_width <- 8 +node_size <- 30 +node_label_cex <- 1 +Terminal_node_legend <- "Terminal" +Steiner_node_legend <- "Steiner" + +V(subnet)$label.cex <- node_label_cex + +# prize = abs(V(subnet)$prize) +# min1 = 10 +# max1 = node_size +# r1 = max1 - min1 +# min2 = min(prize) +# max2 = max(prize) +# r2 = max2 - min2 +# adjusted_prize = r1 * (prize - min2)/r2 + min1 +# V(subnet)$size = adjusted_prize +V(subnet)$size <- node_size + +weight <- E(subnet)$weight +min1 <- 2 +max1 <- edge_width +r1 <- max1 - min1 +min2 <- min(weight) +max2 <- max(weight) +r2 <- max2 - min2 +adjusted_weight <- r1 * (weight - min2) / r2 + min1 +E(subnet)$width <- adjusted_weight + +V(subnet)$borderWidth <- 1 +V(subnet)$borderWidth <- ifelse(V(subnet)$type == "Steiner", 1, 3) + +V(subnet)$mol_type <- "gene/protein" +V(subnet)$mol_type[grepl("-miR-", V(subnet)$name)] <- "miRNA" +V(subnet)$mol_type[V(subnet)$name %in% compound_dat$label] <- "compound" + +# shape = V(subnet)$type +# shape[which(shape == "Steiner")] = "triangle" +# shape[which(shape == "Terminal")] = "square" +V(subnet)$shape <- c( + "gene/protein" = "square", + "miRNA" = "triangle", + "compound" = "dot" +)[V(subnet)$mol_type] + +# create graph plot +gvp <- visIgraph(subnet) %>% + visIgraphLayout( + layout = "cluster_layout", # "cluster_layout", #layout_with_fr + randomSeed = 47839, + sel_weights = c(0.5, 0.05) + ) %>% + visOptions(highlightNearest = list(enabled = TRUE), selectedBy = "group") %>% + visLegend( + addNodes = list( + list( + label = "gene/protein", + shape = "square", + size = 10, + label.cex = 0.3 + ), + list( + label = "miRNA", + shape = "triangle", + size = 10, + label.cex = 0.3 + ), + list( + label = "compound", + shape = "dot", + size = 10, + label.cex = 0.3 + ), + list( + label = "terminal", + shape = "square", + size = 10, + borderWidth = 3, + label.cex = 0.3 + ) + ), + width = 0.2, useGroups = FALSE + ) %>% + visNodes(scaling = list(label = list(enabled = FALSE))) + +# save graph plot +file <- file.path(getwd(),"../","REPORT", "P15038_LungManuscript_PCSF_network.html") +gvp %>% visSave(file = file) + +file2 <- file.path(reportDir, "P15038_LungManuscript_PCSF_network.rda") +save(gvp, file = file2) + +# load(file2) +# file3 = file.path(reportDir, "P15038_LungManuscript_PCSF_network.pdf") +# gvp %>% visExport(type = "png", name = "export-network", +# float = "left", label = "Save network", background = "white", style= "") +# poor resolution + +# plot directly with igraph +subnet2 <- subnet +V(subnet2)$shape <- c( + "square" = "square", + "triangle" = "csquare", + "dot" = "circle" +)[V(subnet2)$shape] +V(subnet2)$size <- 5 +V(subnet2)$label.font <- 1 +V(subnet2)$label.font[V(subnet)$type == "Terminal"] <- 2 + +V(subnet2)$edge.curved <- TRUE + +set.seed(34234) +layout <- cluster_layout(subnet2, sel_weights = c(0.5, 0.05)) +layout[, 2] <- -layout[, 2] + +grp_cols <- colorRampPalette(brewer.pal(9, "Set2"))(length(unique(V(subnet2)$group))) +names(grp_cols) <- unique(V(subnet2)$group) +V(subnet2)$color <- grp_cols[V(subnet2)$group] + +file <- file.path(reportDir, "P15038_LungManuscript_PCSF_network.pdf") +pdf(file = file, width = 17, height = 15) +plot.igraph(subnet2, layout = layout) +legend("right", legend = names(grp_cols), fill = grp_cols, title = "Groups", horiz = FALSE) +dev.off() + +# Only show labels for examples in main figure +subnet3 <- subnet2 +sel_molecules_0 <- c("Irg1", + "Blvrb", + "mmu-miR-34a-5p", + "Pla2g2d", + "Sat1") +sel_molecules <- names(unlist(ego(subnet3, nodes = sel_molecules_0))) + +sel <- which(V(subnet3)$name %in% sel_molecules) +V(subnet3)$name[-sel] <- "" + +file <- file.path(reportDir, "P15038_LungManuscript_PCSF_network_example_sel_labels.pdf") +pdf(file = file, width = 17, height = 15) +plot.igraph(subnet3, layout = layout, vertex.label.cex= 2) +legend("right", legend = names(grp_cols), fill = grp_cols, title = "Groups", horiz = FALSE) +dev.off() + +# plot select neighborhoods +for (sel_mol in sel_molecules_0) { + sel <- unlist(ego(subnet2, nodes = sel_mol, order = 2)) + sg <- induced_subgraph(subnet2, sel) + + set.seed(34234) + layout2 <- cluster_layout(sg, sel_weights = c(0.5, 0.05)) + layout2[, 2] <- -layout2[, 2] + + file <- file.path(reportDir, paste0("P15038_LungManuscript_PCSF_network_mol_", sel_mol, ".pdf")) + pdf(file = file, width = 5, height = 5) + plot.igraph(induced_subgraph(subnet2, sel) , layout = layout2) + # legend("right",legend=names(grp_cols),fill=grp_cols, title = "Groups", horiz = FALSE) + dev.off() +} + +# also plot full clusters +for (gr in unique(V(subnet2)$group)) { + sel <- which(V(subnet2)$group == gr) + file <- file.path(reportDir, paste0("P15038_LungManuscript_PCSF_network_cl", gr, ".pdf")) + pdf(file = file, width = 17, height = 15) + plot.igraph(induced_subgraph(subnet2, sel) , layout = layout[sel,]) + # legend("right",legend=names(grp_cols),fill=grp_cols, title = "Groups", horiz = FALSE) + dev.off() +} +``` + + +```{r FigPCSFNetwork, echo=FALSE, fig.cap="\\label{fig:FigPCSFNetwork} Aggregated gene–protein–metabolite–miRNA network for LF 1 constructed using the PCSF algorithm.", cache=FALSE} +plot.igraph(subnet3, layout = layout) +legend("right", legend = names(grp_cols), fill = grp_cols, title = "Groups", horiz = FALSE) +``` + +Figure \ref{fig:FigPCSFNetwork} shows the derived multi-omics response network. + +## GSEA for functional interpretation of clusters +```{r NetworkInterpretationClusters, message=FALSE, warning=FALSE, size="scriptsize"} +# cluster annotation using reactome db +gsc_file <- readLines("../DATA/EXTERNAL/ReactomePathways_23Apr2018.gmt") +gsc <- do.call(rbind, lapply(gsc_file, function(x) { + ss <- strsplit(x, "\t", fixed = TRUE)[[1]] + genes <- ss[seq(3, length(ss))] + gs <- ss[1] + data.frame(Gene = genes, GS = gs) +})) +gsc <- piano::loadGSC(gsc) + +global_universe <- unique(unlist(lapply(gsc$gsc, function(x) x))) +subnet <- res_network_enrich$subnet +grp <- V(subnet)$group +enrich_res <- lapply(unique(grp), function(gr) { + genes <- GetOrtholog(V(subnet)[V(subnet)$group == gr]$name, species_from = "Mm", species_to = "Hs") + genes <- unique(genes[!is.na(genes)]) + if (length(genes) > 5) { + set.seed(209438) + res_tab <- piano::runGSAhyper(genes, universe = global_universe, gsc = gsc, gsSizeLim = c(5, Inf))$resTab + } else { + res_tab <- NULL + } + return(res_tab) +}) +names(enrich_res) <- unique(grp) +file <- file.path(reportDir, "P15038_LungManuscript_PCSF_network_final_ORA_clusters.rda") +save(enrich_res, file = file) + +enrich_res <- lapply(enrich_res, function(er) er[er[, "Adjusted p-value"] < 0.05, , drop = FALSE]) +# enrich_res <- enrich_res[!sapply(enrich_res, is.null)] + +enrich_res_sum <- do.call(rbind, lapply(unique(V(subnet)$group), function(gr) { + nodes <- paste0(V(subnet)[V(subnet)$group == gr]$name, collapse = ";") + er <- enrich_res[[gr]] + if (!is.null(er) && nrow(er) > 0) { + er <- er[order(er[, "Adjusted p-value"], decreasing = FALSE), , drop = FALSE] + } + er <- paste0(rownames(er), " (", + sprintf("%.2E", er[, "Adjusted p-value"]), + ")", + collapse = "|" + ) + er <- gsub("()", "", er, fixed = TRUE) + data.frame(Cluster = gr, Nodes = nodes, GeneSets = er) +})) +file <- file.path(reportDir, "P15038_LungManuscript_PCSF_network_final_CLUSTER_TABLE.csv") +write.csv(enrich_res_sum, file = file) + +# Cluster annotation based on enrichment results: +cluster_annotation_table <- matrix(c("Cl01", "Lipid metabolism", + "Cl02", "", + "Cl03", "", + "Cl04", "Xenobiotic metabolism", + "Cl05", "Xenobiotic metabolism", + "Cl06", "", + "Cl07", "Immune-related", + "Cl08", "Immune-related", + "Cl09", "Nucleotide metabolism", + "Cl10", "Immune-related", + "Cl11", "Carbohydrate metabolism", + "Cl12", "Immune-related", + "Cl13", "Polyamine metabolism", + "Cl14", "Immune-related", + "Cl15", "Oxidative-stress response", + "Cl16", "", + "Cl17", "Lipid metabolism", + "Cl18", "Lipid metabolism", + "Cl19", "Immune-related", + "Cl20", "Extracellular matrix", + "Cl21", ""), + ncol = 2, byrow = TRUE) +cluster_annotation_table <- as.data.frame(cluster_annotation_table) +colnames(cluster_annotation_table) <- c("Cluster", "General category") + +file <- file.path(reportDir, "P15038_LungManuscript_PCSF_network_final_CLUSTER_ANNOT_TABLE.csv") +write.csv(cluster_annotation_table, file = file) + +``` + + +```{r TableClusterAnnotations, results='asis', echo=FALSE, tab.cap="\\label{tab:TableClusterAnnotations} General functional annotations for clusters (based on ORA results). ",cache=FALSE} +kable(cluster_annotation_table) +``` +Table \ref{fig:TableClusterAnnotations} lists the proposed cluster annotations based on the ORA results. + +## Response profiles +```{r NetworkInterpretationResponseProfiles, message=FALSE, warning=FALSE, size="scriptsize"} +# * Sub-Section * Response profiles for clusters +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +subnet <- res_network_enrich$subnet +subnet_final2 <- subnet_final +V(subnet_final2)$group <- V(subnet)$group + +Imet <- dats[["METABOLITE"]]$I_metabolite + +grps <- V(subnet_final2)$group +names(grps) <- V(subnet_final2)$name +grps <- sort(grps) + +# align + +# start with combined heatmaps +# lapply(idmaps, function(x) names(x)) +all_contrasts <- names(idmaps[["MRNA"]]) +X_list <- lapply(names(idmaps), function(x) { + apm <- getIDMAPentry(idmaps[[x]], entry = "adj.p.value") + fcm <- getIDMAPentry(idmaps[[x]], entry = "foldChange") + + rn <- rownames(apm) + if (x == "PROTEIN") { + rn <- getsplit(rn, "_", 1) + } else if (x == "METABOLITE") { + rn <- Imet[match(rn, Imet$BIOCHEMICAL), "KEGG"] + } + sel <- which(!is.na(rn) & rn != "") + + # go by sum effect for collapsing + sum_fc <- apply(fcm, 1, sum, na.rm = TRUE) + sel <- unlist(tapply(sel, rn[sel], function(y) { + if (length(y) == 1) { + return(y) + } else { + return(sel[which.max(sum_fc[sel])]) + } + })) + apm <- apm[sel, match(all_contrasts, colnames(apm))] + fcm <- fcm[sel, match(all_contrasts, colnames(fcm))] + rownames(apm) <- rownames(fcm) <- rn[sel] + colnames(apm) <- colnames(fcm) <- all_contrasts + + return(list(apm = apm, fcm = fcm)) +}) +names(X_list) <- names(idmaps) + +res_list <- list() +for (gr in unique(grps)) { + sel_mol <- names(grps)[grps == gr] + label_lookup <- c( + "MRNA" = "mRNA", + "METABOLITE" = "met", + "PROTEIN" = "prot", + "MIRNA" = "miR", + "LIPID" = "lip" + ) + X_list_sel <- lapply(names(X_list), function(x) { + rn <- rownames(X_list[[x]]$apm) + apm <- X_list[[x]]$apm[rn %in% sel_mol, , drop = FALSE] + fcm <- X_list[[x]]$fcm[rn %in% sel_mol, , drop = FALSE] + if (nrow(apm) > 0) { + rn <- rownames(fcm) + if (x == "METABOLITE") { + rn <- Imet[match(rn, Imet$KEGG), "BIOCHEMICAL"] + } + rownames(apm) <- rownames(fcm) <- paste0(label_lookup[x], "|", rn) + } + return(list(fcm = fcm, apm = apm)) + }) + apm <- do.call(rbind, lapply(X_list_sel, function(x) x$apm)) + sigm <- apm + sigm[] <- NA + sigm[apm < 0.05] <- 8 + fcm <- do.call(rbind, lapply(X_list_sel, function(x) x$fcm)) + + file <- file.path(reportDir, paste0("P15038_LungManuscript_PCSF_Cluster_HM_", gr, ".pdf")) + pdf(file = file, width = 6, height = 2 + 3 * (nrow(fcm) / 40)) + ImagePlotGG(fcm, + textmat = sigm, + title = paste0("Cluster ", gr), + useSymbols = TRUE, + symbol_labels = c("fdr < 0.05", "NS") + ) + dev.off() + + # create summary stats for cluster + dat <- reshape2::melt(apm) + colnames(dat) <- c("Analyte", "Contrast", "fdr") + dat$ome <- getsplit(dat$Analyte, "|", 1) + dat2 <- reshape2::melt(fcm) + stopifnot(all((dat$Analyte == dat2$Var1)) && all(dat$Contrast == dat2$Var2)) + dat$fc <- dat2$value + res <- dat %>% + group_by(Contrast) %>% + summarise( + perc_signif = sum(fdr < 0.05, na.rm = TRUE) / n(), + mean_effect = mean(fc, na.rm = TRUE) + ) %>% + as.data.frame() + res$grp <- gr + res_list[[gr]] <- res +} +res <- do.call(rbind, res_list) +res$Contrast <- factor(res$Contrast, levels = all_contrasts) +res$Cluster <- paste0("Cl", sprintf("%02d", res$grp)) +res$Cluster <- factor(res$Cluster, levels = rev(unique(res$Cluster))) + +p <- ggplot(aes(x = Contrast, y = Cluster), data = res) +p <- p + geom_tile(aes(fill = mean_effect)) +col3 <- c(brewer.pal(n = 9, "Blues")[rev(c(2, 5, 9))], "white", brewer.pal(n = 9, "YlOrRd")[c(2, 5, 9)]) + +max_val <- 1.1 * max(abs(res$mean_effect), na.rm = TRUE) +values <- seq(-max_val, max_val, length = length(col3) + 1) +p <- p + scale_fill_gradientn( + colours = col3, name = "", + limits = c(-max_val, max_val), na.value = "grey60" +) + + scale_x_discrete(expand = c(0, 0)) + scale_y_discrete(expand = c(0, 0)) + +p <- p + geom_point(aes(colour = perc_signif), size = 6) +p <- p + scale_colour_distiller(palette = "Greys", direction = 1) + +p <- p + labs(x = "", y = "") +p <- p + theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5)) +p <- p + theme(panel.border = element_rect(colour = "black", fill = NA, size = 1)) +p <- p + geom_vline(xintercept = c(3, 6, 9, 11) + 0.5, colour = "black", size = 1) +p_PCSF_cluster_summary <- p + +file <- file.path(reportDir, "P15038_LungManuscript_PCSF_Cluster_Summary.pdf") +pdf(file = file, width = 6, height = 8, useDingbats = FALSE) +print(p_PCSF_cluster_summary) +dev.off() + +# also indicate functional categories +colnames(cluster_annotation_table) <- gsub(" ", "_", colnames(cluster_annotation_table)) +cluster_annotation_table$Cluster <- factor(cluster_annotation_table$Cluster, levels = rev(cluster_annotation_table$Cluster)) +cluster_annotation_table[cluster_annotation_table == ""] <- NA +p2 <- ggplot(aes(x = 1, y = Cluster, fill = General_category), data = cluster_annotation_table) +p2 <- p2 + geom_tile() +p2 <- p2 + scale_fill_brewer(type = "q", palette = "Set3") +p2 <- p2 + labs(x = "", y = "") +p2 <- p2 + theme_minimal() +p2 <- p2 + theme(panel.background = element_blank(), + panel.grid = element_blank(), + axis.text = element_blank()) + +file <- file.path(reportDir, "P15038_LungManuscript_PCSF_Cluster_Summary_Annot.pdf") +pdf(file = file, width = 10, height = 8, useDingbats = FALSE) +print(ggpubr::ggarrange(plotlist = list(p_PCSF_cluster_summary, p2), + ncol = 2, widths = c(8,4), align = "h", + common.legend = FALSE, + legend = "right")) +dev.off() + +# also export data table +file <- file.path(reportDir, "P15038_LungManuscript_PCSF_Cluster_Summary.csv") +write.csv(res, file = file) + +``` + +```{r FigPCSFNetworkClusterSum, echo=FALSE, fig.cap="\\label{fig:FigPCSFNetworkClusterSum} Expression profiles for identified clusters.", cache=FALSE} +print(p_PCSF_cluster_summary) +``` + +Figure \ref{fig:FigPCSFNetworkClusterSum} shows the response profiles of the identified clusters. + +# Metabolite and miRNA changes associated with 3R4F CS-induced immune response +## Network enrichment analysis for the Macrophage Signaling network +```{r MacrophageNPA, message=FALSE, warning=FALSE, size="scriptsize"} +nw_name <- "IPN / Macrophage Signaling" +sel_nw <- which(npa_list$networks() == nw_name) +npa <- subset(npa_list, sel_nw, NULL) + +file <- file.path(reportDir, "P15038_LungManuscript_Macrophage_NPA.pdf") +pdf(file = file, width = 5, height = 6, useDingbats = FALSE) +barplot(npa, + legend.text = FALSE, + col = attr(idmaps[["MRNA"]], "colors"), + bg = "white", + main = nw_name) +dev.off() + +``` + +```{r FigNPAMPSignaling, echo=FALSE, fig.cap="\\label{fig:FigNPAMPSignaling} Network enrichment analysis for the Macrophage Signaling network.", cache=FALSE} +barplot(npa, + legend.text = FALSE, + col = attr(idmaps[["MRNA"]], "colors"), + bg = "white", + main = nw_name) +``` + +Figure \ref{fig:FigNPAMPSignaling} shows the network enrichment analysis for the Macrophage Signaling network. + +## Itaconate metabolic pathway & correlations +```{r ItaconateFigures, message=FALSE, warning=FALSE, size="scriptsize"} + +# * Sub-Section * Itaconate metabolic network +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +col <- attr(idmaps[["MRNA"]], "colors") +names(col) <- names(idmaps[["MRNA"]]) + +sel_matrix <- matrix(c( + "MRNA", "Irg1", + "MRNA", "Aco1", + "MRNA", "Aco2", + "MRNA", "Idh1", + "MRNA", "Idh2", + "METABOLITE", "itaconate", + "METABOLITE", "citrate", + "METABOLITE", "alpha-ketoglutarate" +), +byrow = TRUE, ncol = 2 +) + +p_itaconate_pathway <- list() +for (i in 1:nrow(sel_matrix)) { + idmap_sel <- idmaps[[sel_matrix[i, 1]]] + gene_sel <- sel_matrix[i, 2] + + dat <- data.frame( + fc = as.numeric(getFromIDMAP(idmap_sel, gene_sel, type = "foldChange", exact = TRUE)), + apv = as.numeric(getFromIDMAP(idmap_sel, gene_sel, type = "adj.p.value", exact = TRUE)), + contrasts = names(idmap_sel) + ) + dat$sig <- ifelse(dat$apv < 0.05, "*", "") + dat$contrasts <- factor(dat$contrasts, levels = dat$contrasts) + + p <- ggplot(aes(x = contrasts, y = fc, fill = contrasts), data = dat) + + geom_bar(stat = "identity", width = 0.7) + + scale_fill_manual("", values = col, guide = FALSE) + + geom_text(aes(x = contrasts, y = fc + (max(abs(fc)) / 30 * sign(fc)), label = sig), data = dat, colour = "black") + + labs(x = "", y = "log2 fold-change", title = gene_sel) + + theme_bw() + + theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5)) + p1 <- p + + theme( + axis.text = element_blank(), + axis.title = element_blank(), + axis.ticks = element_blank(), + panel.grid = element_blank() + ) + p_itaconate_pathway[[gene_sel]] <- p1 + + file <- file.path(reportDir, paste0("P15038_LungManuscript_ItaconatePathwayExpression_", gene_sel, ".png")) + png(file = file, width = 2, height = 2, res = 200, units = "in") + print(p1) + dev.off() +} + +# * Sub-Section * Itaconate / Irg1 correlation +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +dat <- data.frame( + x = data_list[["MRNA"]]["Irg1", ], + y = data_list[["MET"]]["itaconate", ], + CAN = colnames(data_list[["MRNA"]]) +) +dat$Group <- dat_meta[match(dat$CAN, dat_meta$CAN), "Group"] +dat$Treatment <- getsplit(dat$Group, "_", 1) +dat$Time <- getsplit(dat$Group, "_", 2) + +corr_txt <- paste0("Corr = ", sprintf("%2.2f", cor(dat$x, dat$y, use = "pairwise.complete", method = "pearson"))) + +p <- ggplot(aes(x = x, y = y), data = dat) + + geom_point() + + geom_smooth(method = "lm") + + # scale_colour_manual("Treatment", values = cols) + + theme_bw() + + labs(x = "Irg1 [mRNA]", y = "itaconate") + + xlim(4, 7) + + ylim(-3, 4) + + ggplot2::annotate("text", 4, 3.5, label = corr_txt, hjust = 0) + +p_itaconate_mRNAvsMET <- p + +file <- file.path(reportDir, "P15038_LungManuscript_Itaconate_mRNAvsMET.pdf") +pdf(file = file, width = 4, height = 4, useDingbats = FALSE) +print(p_itaconate_mRNAvsMET) +dev.off() + +# * Sub-Section * global itaconate correlations +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +res.cor <- WGCNA::cor(t(data_list[["MRNA"]]), t(data_list[["MET"]]), use = "pairwise.complete.obs") +filename <- file.path(reportDir, "P15038_LungManuscript_ResCor_MRNA_MET.rda") +save(res.cor, file = filename) + +res_melt <- reshape2::melt(res.cor) +res_melt <- res_melt[abs(res_melt$value) > 0.8, ] +dim(res_melt) +res_melt <- res_melt[order(abs(res_melt$value), decreasing = TRUE), ] + +tmp <- res.cor[, "itaconate"] +tmp <- tmp[order(abs(tmp), decreasing = TRUE)][1:10] +tmp <- data.frame(Name = names(tmp), Cor = tmp) +tmp$Name <- factor(tmp$Name, levels = rev(tmp$Name)) + +p1 <- ggplot(aes(x = Name, y = Cor), data = tmp) + + geom_bar(stat = "identity", width = 0.6, fill = "#54b75c") + + theme_bw() + + labs(x = "", y = "correlation", title = "itaconate vs. mRNA") + + theme(axis.text = element_text(size = 10)) + + coord_flip() + +tmp <- res.cor["Irg1", ] +tmp <- tmp[order(abs(tmp), decreasing = TRUE)][1:10] +tmp <- data.frame(Name = names(tmp), Cor = tmp) +tmp$Name <- factor(tmp$Name, levels = rev(tmp$Name)) + +p2 <- ggplot(aes(x = Name, y = Cor), data = tmp) + + geom_bar(stat = "identity", width = 0.6, fill = "steelblue") + + theme_bw() + + labs(x = "", y = "correlation", title = "Irg1 vs. metabolites") + + theme(axis.text = element_text(size = 10)) + + coord_flip() + +file <- file.path(reportDir, "P15038_LungManuscript_Itaconate_cor.pdf") +pdf(file = file, width = 9, height = 5, useDingbats = FALSE) +gridExtra::grid.arrange(p1, p2, layout_matrix = matrix(c(1, 2, 2), ncol = 3)) +dev.off() +``` + +```{r FigItaconatePathway, echo=FALSE, fig.cap="\\label{fig:FigItaconatePathway} Itaconate metabolic pathway.", fig.height = 8, cache=FALSE} +egg::ggarrange(plots = p_itaconate_pathway, ncol = 3) +``` + + + +```{r FigItaconateCorrelation, echo=FALSE, fig.cap="\\label{fig:FigItaconateCorrelation} Correlation between Irg1 mRNA expression and itaconate abundance", cache=FALSE} +plot(p_itaconate_mRNAvsMET) +``` + + + +```{r FigItaconateCorrelationTop10, echo=FALSE, fig.cap="\\label{fig:FigItaconateCorrelationTop10} (left) Top 10 correlations of Irg1 mRNA expression against all metabolites. (right) Top 10 correlations of itaconate abundance against all mRNAs", cache=FALSE} +gridExtra::grid.arrange(p1, p2, layout_matrix = matrix(c(1, 2, 2), ncol = 3)) +``` + + + +Figure \ref{fig:FigItaconatePathway} shows the itaconate pathway response profiles, Figure \ref{fig:FigItaconateCorrelation} shows the +Irg1 mRNA vs Itaconate metabolite correlation, and Figure \ref{fig:FigItaconateCorrelation} shows the top 10 correlations for Irg1 mRNA and +Itaconate. + +## Polyamine pathway +```{r PolyamineFigures, message=FALSE, warning=FALSE, size="scriptsize"} +# * Sub-Section * Polyamine metabolic network +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +col <- attr(idmaps[["MRNA"]], "colors") +names(col) <- names(idmaps[["MRNA"]]) + +sel_matrix <- matrix(c( + "MRNA", "Nos2", + "MRNA", "Arg1", + "MRNA", "Arg2", + "MRNA", "Gatm", + "MRNA", "Oat", + "MRNA", "Odc1", + "MRNA", "Otc", + "MRNA", "Ass1", + "MRNA", "Sat1", + "MRNA", "Sat2", + "MRNA", "Srm", + "MRNA", "Sms", + "METABOLITE", "(N(1) + N(8))-acetylspermidine", + "METABOLITE", "spermine", + "METABOLITE", "spermidine", + "METABOLITE", "putrescine", + "METABOLITE", "N-acetylputrescine", + "METABOLITE", "arginine", + "METABOLITE", "creatine", + "METABOLITE", "creatinine", + "METABOLITE", "creatine phosphate", + "METABOLITE", "guanidinoacetate", + "METABOLITE", "4-guanidinobutanoate", + "METABOLITE", "guanidinosuccinate", + "METABOLITE", "beta-guanidinopropanoate", + "METABOLITE", "N-acetylarginine", + "METABOLITE", "ornithine", + "METABOLITE", "urea", + "METABOLITE", "citrulline", + "METABOLITE", "argininosuccinate", + "METABOLITE", "proline" +), +byrow = TRUE, ncol = 2 +) + +p_polyamine_pathway <- list() +for (i in 1:nrow(sel_matrix)) { + idmap_sel <- idmaps[[sel_matrix[i, 1]]] + gene_sel <- sel_matrix[i, 2] + + if (gene_sel %in% idmap_sel[[1]]$nodeLabel) { + dat <- data.frame( + fc = as.numeric(getFromIDMAP(idmap_sel, gene_sel, type = "foldChange", exact = TRUE)), + apv = as.numeric(getFromIDMAP(idmap_sel, gene_sel, type = "adj.p.value", exact = TRUE)), + contrasts = names(idmap_sel) + ) + dat$sig <- ifelse(dat$apv < 0.05, "*", "") + dat$contrasts <- factor(dat$contrasts, levels = dat$contrasts) + + p <- ggplot(aes(x = contrasts, y = fc, fill = contrasts), data = dat) + + geom_bar(stat = "identity", width = 0.7) + + scale_fill_manual("", values = col, guide = FALSE) + + geom_text(aes(x = contrasts, y = fc + (max(abs(fc)) / 30 * sign(fc)), label = sig), data = dat, colour = "black") + + labs(x = "", y = "log2 fold-change", title = gene_sel) + + theme_bw() + + theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5)) + p1 <- p + + theme( + axis.text = element_blank(), + axis.title = element_blank(), + axis.ticks = element_blank(), + panel.grid = element_blank() + ) + p_polyamine_pathway[[gene_sel]] <- p1 + + file <- file.path(reportDir, paste0("P15038_LungManuscript_PolyaminePathwayExpression_", gene_sel, ".png")) + png(file = file, width = 2, height = 2, res = 200, units = "in") + print(p1) + dev.off() + } else { + cat("Did not find ", gene_sel, "\n") + } +} +``` + +```{r FigPolyaminePathway, echo=FALSE, fig.cap="\\label{fig:FigPolyaminePathway} Polyamine metabolic pathway.", fig.height = 8, cache=FALSE} +egg::ggarrange(plots = p_polyamine_pathway, ncol = 3) +``` + +Figure \ref{fig:FigPolyaminePathway} shows the polyamine pathway response profiles. + +## Expression profiles for selected immune-related miRNAs +```{r miRFigure, message=FALSE, warning=FALSE, size="scriptsize"} +sel_genes <- rev(c("mmu-miR-146a-5p", "mmu-miR-21a-5p", "mmu-miR-2137")) + +idmap <- idmaps[["MIRNA"]] +sig_mir <- unique(unlist(lapply(getDEG(idmap), function(x) as.character(x$nodeLabel)))) +sig_mir <- sig_mir[!is.na(sig_mir)] + +p <- getIDMAPheatmapGG(idmap, sel_genes, cluster.row = FALSE, cex.labx = 2, cex.laby = 1.5, title = NULL, + col.lab = "black", object.only = TRUE) + +pdf(file = file.path(reportDir, "P15038_LungManuscript_microRNA_HM.pdf"), width = 5, height = 2) +print(p) +dev.off() +``` + +```{r FigMIRNA, echo=FALSE, fig.cap="\\label{fig:FigMIRNA} Expression profiles for selected immune-related miRNAs.", fig.height = 3, cache=FALSE} +print(p) +``` + +Figure \ref{fig:FigPolyaminePathway} shows the polyamine pathway response profiles. + +# Oxidative stress-related effects +## Activation of hemoglobin–biliverdin–bilirubin pathway + +```{r HmoxBilirubinFigures, message=FALSE, warning=FALSE, size="scriptsize"} +# * Sub-Section * Bilirubin metabolic network +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +col <- attr(idmaps[["MRNA"]], "colors") +names(col) <- names(idmaps[["MRNA"]]) + +sel_matrix <- matrix(c( + "MRNA", "Hmox1", + "MRNA", "Hmox2", + "PROTEIN", "Hmox1", + "PROTEIN", "Hmox2", + "PROTEIN", "Blvrb", + "MRNA", "Blvrb", + "MRNA", "Fth1", + "MRNA", "Ftl1", + "PROTEIN", "Fth1", + "PROTEIN", "Ftl1", + "METABOLITE", "bilirubin", + "METABOLITE", "biliverdin" +), +byrow = TRUE, ncol = 2 +) + +p_hmox_pathway <- list() +for (i in 1:nrow(sel_matrix)) { + idmap_sel <- idmaps[[sel_matrix[i, 1]]] + gene_sel <- sel_matrix[i, 2] + + if (gene_sel %in% idmap_sel[[1]]$nodeLabel) { + dat <- data.frame( + fc = as.numeric(getFromIDMAP(idmap_sel, gene_sel, type = "foldChange", exact = TRUE)), + apv = as.numeric(getFromIDMAP(idmap_sel, gene_sel, type = "adj.p.value", exact = TRUE)), + contrasts = names(idmap_sel) + ) + dat$sig <- ifelse(dat$apv < 0.05, "*", "") + dat$contrasts <- factor(dat$contrasts, levels = dat$contrasts) + + p <- ggplot(aes(x = contrasts, y = fc, fill = contrasts), data = dat) + + geom_bar(stat = "identity", width = 0.7) + + scale_fill_manual("", values = col, guide = FALSE) + + geom_text(aes(x = contrasts, y = fc + (max(abs(fc)) / 30 * sign(fc)), label = sig), data = dat, colour = "black") + + labs(x = "", y = "log2 fold-change", title = paste0(gene_sel, " ", sel_matrix[i, 1])) + + theme_bw() + + theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5)) + p1 <- p + + theme( + axis.text = element_blank(), + axis.title = element_blank(), + axis.ticks = element_blank(), + panel.grid = element_blank(), + title = element_text(size = 8) + ) + p_hmox_pathway[[gene_sel]] <- p1 + + file <- file.path(reportDir, paste0("P15038_LungManuscript_BilirubinPathwayExpression_", sel_matrix[i, 1], "_", gene_sel, ".png")) + png(file = file, width = 2, height = 2, res = 200, units = "in") + print(p1) + dev.off() + } else { + cat("Did not find ", gene_sel, "\n") + } +} +``` + +```{r HmoxBilirubinFigure, echo=FALSE, fig.cap="\\label{fig:HmoxBilirubinFigure} Hemoglobin–biliverdin–bilirubin pathway.", fig.height = 8, cache=FALSE} +egg::ggarrange(plots = p_hmox_pathway, ncol = 3) +``` + +Figure \ref{fig:HmoxBilirubinFigure} shows the hemoglobin–biliverdin–bilirubin pathway response profiles. + +## Oxidative stress-related metabolites, proteins, and network +```{r OxStressFigures, message=FALSE, warning=FALSE, size="scriptsize"} +# * Sub-Section * Ox Stress metabolites +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# metabolites +dat <- dats[["METABOLITE"]] +idmap <- idmaps[["METABOLITE"]] + +# metabolite selection, based on Metabolon report +met_sel <- c( + "glutathione, reduced (GSH)", + "glutathione, oxidized (GSSG)", + "cysteine-glutathione disulfide", + "cystathionine", + "N-acetylmethionine sulfoxide", + "methionine sulfoxide", + "alpha-tocopherol" +) + +p <- getIDMAPheatmapGG(idmap, met_sel, + title = "", cluster.row = FALSE, col.group = NULL, + cex.labx = 1.7, cex.laby = 1.4, col.lab = "black", cex.facet = 1.2, + object.only = TRUE +) + + theme( + axis.text.x = element_text(angle = 90, vjust = 0.5, hjust = 1, size = 10), + axis.text.y = element_text(angle = 0, vjust = 0.5, hjust = 1, size = 10) + ) +p_oxstress_met <- p + +pdf(file = file.path(reportDir, "P15038_LungManuscript_OxStress_Metabolites_HM.pdf"), width = 5.3, height = 3) +print(p_oxstress_met) +dev.off() + +# * Sub-Section * Ox stress gene / protein sets +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# proteins +idmap <- idmaps[["PROTEIN"]] + +sig_genes <- unique(unlist(lapply(getDEG(idmap), function(x) as.character(x$nodeLabel)))) +sig_genes <- sig_genes[!is.na(sig_genes)] + +gsc_h <- getGMT_GS("../DATA/EXTERNAL/h.all.v6.2.symbols.gmt") +gsc_c2 <- getGMT_GS("../DATA/EXTERNAL/c2.all.v6.2.symbols.gmt") + +sel_genes <- gsc_h[["HALLMARK_REACTIVE_OXIGEN_SPECIES_PATHWAY"]] +sel_genes <- c(sel_genes, gsc_c2[["KEGG_METABOLISM_OF_XENOBIOTICS_BY_CYTOCHROME_P450"]]) +sel_genes <- GetOrtholog(sel_genes, species_from = "Hs", species_to = "Mm") +sel_genes <- unique(sel_genes) +sel_genes <- sel_genes[!is.na(sel_genes)] + +p <- getIDMAPheatmapGG(idmap, intersect(sel_genes, sig_genes), cluster.row = TRUE, cex.labx = 2, cex.laby = 1.5, + title = NULL, col.lab = "black", object.only = TRUE) +p_oxstress_prot <- p + +pdf(file = file.path(reportDir, "P15038_LungManuscript_OxStressXeno_Proteins_HM.pdf"), width = 5, height = 5) +print(p_oxstress_prot) +dev.off() + +# mRNAs +idmap <- idmaps[["MRNA"]] +sig_genes <- unique(unlist(lapply(getDEG(idmap), function(x) as.character(x$nodeLabel)))) +sig_genes <- sig_genes[!is.na(sig_genes)] + +gsc_h <- getGMT_GS("../DATA/EXTERNAL/h.all.v6.2.symbols.gmt") +gsc_c2 <- getGMT_GS("../DATA/EXTERNAL/c2.all.v6.2.symbols.gmt") + +sel_genes <- gsc_h[["HALLMARK_REACTIVE_OXIGEN_SPECIES_PATHWAY"]] +sel_genes <- c(sel_genes, gsc_c2[["KEGG_METABOLISM_OF_XENOBIOTICS_BY_CYTOCHROME_P450"]]) +sel_genes <- GetOrtholog(sel_genes, species_from = "Hs", species_to = "Mm") +sel_genes <- unique(sel_genes) +sel_genes <- sel_genes[!is.na(sel_genes)] + +p <- getIDMAPheatmapGG(idmap, intersect(sel_genes, sig_genes), cluster.row = TRUE, cex.labx = 2, + cex.laby = 1.5, title = NULL, col.lab = "black", object.only = TRUE) +p_oxstress_mRNA <- p + +pdf(file = file.path(reportDir, "P15038_LungManuscript_OxStressXeno_mRNAs_HM.pdf"), width = 5, height = 8) +print(p_oxstress_mRNA) +dev.off() + +nw_name <- "CST / Oxidative Stress" +sel_nw <- which(npa_list$networks() == nw_name) +npa <- subset(npa_list, sel_nw, NULL) + +file <- file.path(reportDir, "P15038_LungManuscriptOxStress_NPA.pdf") +pdf(file = file, width = 5, height = 6, useDingbats = FALSE) +barplot(npa, + legend.text = FALSE, + col = attr(idmaps[["MRNA"]], "colors"), + bg = "white", + main = nw_name) +dev.off() + +``` + + +```{r FigureOxStressMet, echo=FALSE, fig.cap="\\label{fig:FigureOxStressMet} Oxidative stress-related metabolites. ", cache=FALSE} +print(p_oxstress_met) +``` + +```{r FigureOxStressProt, echo=FALSE, fig.cap="\\label{fig:FigureOxStressProt} Oxidative stress-related proteins.", cache=FALSE} +print(p_oxstress_prot) +``` + +```{r FigureOxStressMRNA, echo=FALSE, fig.cap="\\label{fig:FigureOxStressMRNA} Oxidative stress-related mRNA transcripts.", cache=FALSE} +print(p_oxstress_mRNA) +``` + +```{r FigNPAOxStress, echo=FALSE, fig.cap="\\label{fig:FigNPAOxStress} Perturbation of the oxidative stress network.", cache=FALSE} +barplot(npa, + legend.text = FALSE, + col = attr(idmaps[["MRNA"]], "colors"), + bg = "white", + main = nw_name) +``` + + +Figure \ref{fig:FigureOxStressMet} shows the response profiles of oxidative-stress related metabolites, +Figure \ref{fig:FigureOxStressProt} shows the response profiles of oxidative-stress related proteins, and +Figure \ref{fig:FigureOxStressMRNA} shows the response profiles of oxidative-stress related mRNA transcripts. +Figure \ref{fig:FigNPAOxStress} shows the perturbation of the oxidative stress network (based on transcriptomics data). + +# Effects on lipid metabolism +## Lipid abundance for PEs and LPEs, glycerophospholipid metabolism, and surfactant +```{r LipidMetabolism, message=FALSE, warning=FALSE, size="scriptsize"} + +# * Sub-Section * FA metabolism +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# KEGG fatty acid biosynthesis pathway +# KEGG fatty acid degradation +idmap <- idmaps[["PROTEIN"]] + +sig_genes <- unique(unlist(lapply(getDEG(idmap), function(x) as.character(x$nodeLabel)))) +sig_genes <- sig_genes[!is.na(sig_genes)] + +gsc_c2 <- getGMT_GS("../DATA/EXTERNAL/c2.all.v6.2.symbols.gmt") + +sel_genes <- gsc_c2[["KEGG_FATTY_ACID_METABOLISM"]] +sel_genes <- GetOrtholog(sel_genes, species_from = "Hs", species_to = "Mm") +sel_genes <- unique(sel_genes) +sel_genes <- sel_genes[!is.na(sel_genes)] + +p <- getIDMAPheatmapGG(idmap, intersect(sel_genes, sig_genes), cluster.row = TRUE, cex.labx = 2, + cex.laby = 1.5, title = NULL, col.lab = "black", object.only = TRUE) +p_FAMet_proteins <- p + +pdf(file = file.path(reportDir, "P15038_LungManuscript_FA-METABOLISM_Proteins_HM.pdf"), width = 5, height = 5) +print(p_FAMet_proteins) +dev.off() + +# * Sub-Section * surfactant +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +idmap <- idmaps[["PROTEIN"]] +sel_surfactant_proteins <- c( + "Sftpd", "Sftpa1", "Lpcat1", "Slc34a2", "Abca3", "Sftpc", + "Sftpb", "Prdx6" +) + +sig_genes <- unique(unlist(lapply(getDEG(idmap), function(x) as.character(x$nodeLabel)))) +sig_genes <- sig_genes[!is.na(sig_genes)] + +sel_genes <- sel_surfactant_proteins +sel_genes <- unique(sel_genes) +sel_genes <- sel_genes[!is.na(sel_genes)] + +p <- getIDMAPheatmapGG(idmap, intersect(sel_genes, sig_genes), cluster.row = TRUE, + cex.labx = 2, cex.laby = 1.5, title = NULL, col.lab = "black", + object.only = TRUE) +p_surfactant_proteins <- p + +pdf(file = file.path(reportDir, "P15038_LungManuscript_Surfactant_Proteins_HM.pdf"), width = 5, height = 3.7) +print(p_surfactant_proteins) +dev.off() + +idmap <- idmaps[["MRNA"]] +sig_genes <- unique(unlist(lapply(getDEG(idmap), function(x) as.character(x$nodeLabel)))) +sig_genes <- sig_genes[!is.na(sig_genes)] + +sel_genes <- sel_surfactant_proteins +sel_genes <- unique(sel_genes) +sel_genes <- sel_genes[!is.na(sel_genes)] + +p <- getIDMAPheatmapGG(idmap, intersect(sel_genes, sig_genes), cluster.row = TRUE, cex.labx = 2, + cex.laby = 1.5, title = NULL, col.lab = "black", object.only = TRUE) +p_surfactant_MRNAs <- p + +pdf(file = file.path(reportDir, "P15038_LungManuscript_Surfactant_mRNAs_HM.pdf"), width = 5, height = 4.7) +print(p_surfactant_MRNAs) +dev.off() + +# surfactant lipids +# PC 16:0/16:0 +# PC 16:0/16:1 +# PC 14:0/16:0 + +# PG 16:0/16:0 +# PG 16:0/18:1 +# PG 16:0/16:2 + +idmap <- idmaps[["LIPID"]] +sig_mets <- unique(unlist(lapply(getDEG(idmap), function(x) as.character(x$nodeLabel)))) +sig_mets <- sig_mets[!is.na(sig_mets)] +sel_mets <- c("PC 32:0", "PC 32:1", "PC 30:0", "PG 32:0", "PG 34:1", "PG 34:2") + +p <- getIDMAPheatmapGG(idmap, intersect(sel_mets, sig_mets), cluster.row = FALSE, cex.labx = 2, + cex.laby = 1.5, title = NULL, col.lab = "black", object.only = TRUE) +p_surfactant_lipids <- p + +pdf(file = file.path(reportDir, "P15038_LungManuscript_Surfactant_Lipids_HM.pdf"), width = 5, height = 3) +print(p_surfactant_lipids) +dev.off() + +# * Sub-Section * Lipid metabolism imbalance +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0092498 +# http://erj.ersjournals.com/content/46/5/1451 + +# Lipids +compound_dat <- readr::read_delim("../DATA/EXTERNAL/cmp_extracted.table.txt", "\t", col_names = FALSE) %>% + as.data.frame() +colnames(compound_dat) <- c("cpn_ID", "names") +compound_dat$label <- getsplit(compound_dat$names, ";", 1) +lipid2kegg <- read.csv("../DATA/P15038_LungManuscript_LipidMappingTable3_bt.csv") + +idmap <- idmaps[["LIPID"]] +sig_mets <- unique(unlist(lapply(getDEG(idmap), function(x) as.character(x$nodeLabel)))) +sig_mets <- sig_mets[!is.na(sig_mets)] + +sel_mets_LPE <- grep("^LPE ", idmap[[1]]$nodeLabel, value = TRUE) +sel_mets_PE <- grep("^PE ", idmap[[1]]$nodeLabel, value = TRUE) +sel_mets <- c(sel_mets_LPE, sel_mets_PE) + +p <- getIDMAPheatmapGG(idmap, rev(intersect(sel_mets, sig_mets)), cluster.row = FALSE, cex.labx = 2, + cex.laby = 1.5, title = NULL, col.lab = "black", object.only = TRUE) +p_lpe_pe_lipids <- p + +pdf(file = file.path(reportDir, "P15038_LungManuscript_LPE_Lipids_HM.pdf"), width = 5, height = 7) +print(p_lpe_pe_lipids) +dev.off() + +# * Sub-Section * LIPID CLASS SUMMARY STAT HEATMAP +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +dat <- dats[["LIPID"]] +X <- (2^dat$data) - 1 +X[is.na(X)] <- 0 +lc <- getsplit(rownames(X), " ", 1) +X <- do.call(rbind, by(X, lc, function(x) apply(x, 2, sum, na.rm = TRUE))) +X <- log2(X) +idmap <- getLimmaResults(X, dat$L, dat$CO, covariates = NULL, include.ordinary.pvalues = TRUE) +idmap <- lapply(idmap, function(tmp) { + tmp$moderated.adj.p.value <- tmp$adj.p.value + tmp$moderated.p.value <- tmp$p.value + tmp$moderated.t <- tmp$t + tmp$adj.p.value <- tmp$ord.adj.p.value + tmp$p.value <- tmp$ord.p.value + tmp$t <- tmp$ord.t + return(tmp) +}) +names(idmap) <- gsub(" vs.+", "", names(idmap)) + +p <- getIDMAPheatmapGG(idmap, + idmap[[1]]$nodeLabel, + cluster.row = FALSE, + cex.labx = 2, + cex.laby = 1.5, + title = NULL, + col.lab = "black", + object.only = TRUE) +p_lipid_class_hm <- p + +pdf(file = file.path(reportDir, "P15038_LungManuscript_LipidClass_HM.pdf"), width = 5, height = 4) +print(p_lipid_class_hm) +dev.off() + +# * Sub-Section * phosphoglycerolipid pathway etc +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +idmap <- idmaps[["MRNA"]] + +sig_genes <- unique(unlist(lapply(getDEG(idmap), function(x) as.character(x$nodeLabel)))) +sig_genes <- sig_genes[!is.na(sig_genes)] + +gsc_c2 <- getGMT_GS("../DATA/EXTERNAL/c2.all.v6.2.symbols.gmt") + +sel_genes <- gsc_c2[["KEGG_GLYCEROPHOSPHOLIPID_METABOLISM"]] +sel_genes <- GetOrtholog(sel_genes, species_from = "Hs", species_to = "Mm") + +#complement +sel_genes <- c(sel_genes, "Pisd", "Pla2g7", "Lpcat1", "Pld3", "Pla2g2d", "Lpcat2b", "Pnpla7", "Lcat") +sel_genes <- unique(sel_genes) +sel_genes <- sel_genes[!is.na(sel_genes)] + +p_glycerolipid_met <- getIDMAPheatmapGG(idmap, intersect(sel_genes, sig_genes), cluster.row = TRUE, + cex.labx = 2, cex.laby = 1.5, title = NULL, col.lab = "black", + object.only = TRUE) +pdf(file = file.path(reportDir, "P15038_LungManuscript_GLYCEROPHOSPHOLIPID_METABOLISM_mRNAs_HM.pdf"), width = 5, height = 4.9) +print(p_glycerolipid_met) +dev.off() + +sel_genes <- gsc_c2[["REACTOME_CHOLESTEROL_BIOSYNTHESIS"]] +sel_genes <- GetOrtholog(sel_genes, species_from = "Hs", species_to = "Mm") +sel_genes <- unique(sel_genes) +sel_genes <- sel_genes[!is.na(sel_genes)] + +pdf(file = file.path(reportDir, "P15038_LungManuscript_REACTOME_CHOLESTEROL_BIOSYNTHESIS_mRNAs_HM.pdf"), width = 5, height = 4.7) +getIDMAPheatmapGG(idmap, intersect(sel_genes, sig_genes), cluster.row = TRUE, cex.labx = 2, + cex.laby = 1.5, title = NULL, col.lab = "black", object.only = TRUE) +dev.off() + +sel_genes <- gsc_c2[["KEGG_FATTY_ACID_METABOLISM"]] +sel_genes <- GetOrtholog(sel_genes, species_from = "Hs", species_to = "Mm") +sel_genes <- unique(sel_genes) +sel_genes <- sel_genes[!is.na(sel_genes)] + +p <- getIDMAPheatmapGG(idmap, + intersect(sel_genes, sig_genes), + cluster.row = TRUE, + cex.labx = 2, + cex.laby = 1.5, + title = NULL, + col.lab = "black") +p_fa_met_mRNAs <- p + +pdf(file = file.path(reportDir, "P15038_LungManuscript_KEGG_FATTY_ACID_METABOLISM_mRNAs_HM.pdf"), width = 5, height = 4.7) +print(p_fa_met_mRNAs) +dev.off() +``` + + +```{r FigureSurfactantProts, echo=FALSE, fig.cap="\\label{fig:FigureSurfactantProts} Abundance profiles of surfactant proteins.", cache=FALSE} +print(p_surfactant_proteins) +``` + +```{r FigureSurfactantMRNAs, echo=FALSE, fig.cap="\\label{fig:FigureSurfactantMRNAs} Expression profiles of surfactant mRNA transcripts.", cache=FALSE} +print(p_surfactant_MRNAs) +``` + +```{r FigureSurfactantLipids, echo=FALSE, fig.cap="\\label{fig:FigureSurfactantLipids} Abundance profiles of candidate surfactant lipids.", cache=FALSE} +print(p_surfactant_lipids) +``` + +```{r FigureLPELipids, echo=FALSE, fig.cap="\\label{fig:FigureLPELipids} Oxidative stress-related mRNA transcripts.", cache=FALSE} +print(p_lpe_pe_lipids) +``` + +```{r FigureLipidClass, echo=FALSE, fig.cap="\\label{fig:FigureLipidClass} Lipid class heatmap.", cache=FALSE} +print(p_lipid_class_hm) +``` + +```{r FigureFAProteins, echo=FALSE, fig.cap="\\label{fig:FigureFAProteins} Expression of proteins involved in FA metabolism.", cache=FALSE} +print(p_FAMet_proteins) +``` + +```{r FigureFAMRNAS, echo=FALSE, fig.cap="\\label{fig:FigureFAMRNAS} Expression of genes involved in FA metabolism.", cache=FALSE} +print(p_fa_met_mRNAs) +``` + +```{r FigurePLMRNAS, echo=FALSE, fig.cap="\\label{fig:FigurePLMRNAS} Expression of genes involved in glycerophospholipid metabolism.", cache=FALSE} +print(p_glycerolipid_met) +``` + + +# Additional +```{r AddFigureNucleotide, message=FALSE, warning=FALSE, size="scriptsize"} +idmap <- idmaps[["METABOLITE"]] +sig_mets <- unique(unlist(lapply(getDEG(idmap), function(x) as.character(x$nodeLabel)))) +sig_mets <- sig_mets[!is.na(sig_mets)] + +I_met <- dats[["METABOLITE"]]$I_metabolite +sel_mets <- I_met[I_met$SUPER_PATHWAY == "Nucleotide", "BIOCHEMICAL"] + +pdf(file = file.path(reportDir, "P15038_LungManuscript_Nucleotides_HM.pdf"), width = 5, height = 5) +getIDMAPheatmapGG(idmap, intersect(sel_mets, sig_mets), cluster.row = FALSE, cex.labx = 2, + cex.laby = 1.5, title = NULL, col.lab = "black", object.only = TRUE) +dev.off() +``` + +```{r C1qtnf4Question, message=FALSE, warning=FALSE, size="scriptsize"} + # got question, whether C1qtnf4 detected by proteomics + all_detected <- unique(unlist(lapply(idmaps[["PROTEIN"]], function(x) { + as.character(x$nodeLabel) + }))) + "Grb2" %in% all_detected + "C1qtnf4" %in% all_detected +``` + + +# Competing Interests statement +The work reported in the associated publication involved candidate/potential modified risk tobacco products developed by PMI and was solely funded by PMI. Except for B.K., all authors are (or were) employees of PMI R&D or worked for PMI R&D under contractual agreements. B.K. is an employee of Metabolon Inc. + +# Version information +```{r echo=FALSE, message=FALSE, warning=FALSE, size="scriptsize"} + si <- sessionInfo() + si2 <- devtools::session_info() + save(si, file = file.path(reportDir, + paste0("P15038_LungManuscript_SessionInfo_", + format(Sys.time(), '%d%B%Y'), + ".rda"))) + save(si2, file = file.path(reportDir, + paste0("P15038_LungManuscript_SessionInfoDevTools_", + format(Sys.time(), '%d%B%Y'), + ".rda"))) + write.csv2(si2$packages, file = file.path(reportDir, + paste0("P15038_LungManuscript_SessionInfoDevTools_", + format(Sys.time(), '%d%B%Y'), + ".csv"))) + print(si) +```