[0b32b6]: / R-scripts / scripts / .ipynb_checkpoints / 模拟数据测试-checkpoint.ipynb

Download this file

2428 lines (2427 with data), 156.2 kB

{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "NMF - BioConductor layer [OK] | Shared memory capabilities [NO: bigmemory] | Cores 27/28\n",
      "\n",
      "  To enable shared memory capabilities, try: install.extras('\n",
      "NMF\n",
      "')\n",
      "\n",
      "Loading required package: mclust\n",
      "\n",
      "Package 'mclust' version 5.4.6\n",
      "Type 'citation(\"mclust\")' for citing this R package in publications.\n",
      "\n",
      "Loading required package: ade4\n",
      "\n",
      "\n",
      "Attaching package: ‘ade4’\n",
      "\n",
      "\n",
      "The following object is masked from ‘package:BiocGenerics’:\n",
      "\n",
      "    score\n",
      "\n",
      "\n",
      "\n",
      "Attaching package: ‘GPArotation’\n",
      "\n",
      "\n",
      "The following object is masked from ‘package:NMF’:\n",
      "\n",
      "    entropy\n",
      "\n",
      "\n",
      "\n",
      "Attaching package: ‘MOFAtools’\n",
      "\n",
      "\n",
      "The following objects are masked from ‘package:NMF’:\n",
      "\n",
      "    featureNames, featureNames<-, predict, sampleNames, sampleNames<-\n",
      "\n",
      "\n",
      "The following objects are masked from ‘package:Biobase’:\n",
      "\n",
      "    featureNames, featureNames<-, sampleNames, sampleNames<-\n",
      "\n",
      "\n",
      "The following object is masked from ‘package:stats’:\n",
      "\n",
      "    predict\n",
      "\n",
      "\n",
      "Loading required package: JADE\n",
      "\n",
      "Loading required package: lattice\n",
      "\n",
      "Loading required package: caTools\n",
      "\n",
      "Loading required package: gdata\n",
      "\n",
      "gdata: read.xls support for 'XLS' (Excel 97-2004) files ENABLED.\n",
      "\n",
      "\n",
      "\n",
      "gdata: read.xls support for 'XLSX' (Excel 2007+) files ENABLED.\n",
      "\n",
      "\n",
      "Attaching package: ‘gdata’\n",
      "\n",
      "\n",
      "The following object is masked from ‘package:Biobase’:\n",
      "\n",
      "    combine\n",
      "\n",
      "\n",
      "The following object is masked from ‘package:BiocGenerics’:\n",
      "\n",
      "    combine\n",
      "\n",
      "\n",
      "The following object is masked from ‘package:stats’:\n",
      "\n",
      "    nobs\n",
      "\n",
      "\n",
      "The following object is masked from ‘package:utils’:\n",
      "\n",
      "    object.size\n",
      "\n",
      "\n",
      "The following object is masked from ‘package:base’:\n",
      "\n",
      "    startsWith\n",
      "\n",
      "\n",
      "Loading required package: gtools\n",
      "\n",
      "\n",
      "Attaching package: ‘gtools’\n",
      "\n",
      "\n",
      "The following object is masked from ‘package:InterSIM’:\n",
      "\n",
      "    logit\n",
      "\n",
      "\n",
      "Loading required package: gplots\n",
      "\n",
      "\n",
      "Attaching package: ‘gplots’\n",
      "\n",
      "\n",
      "The following object is masked from ‘package:stats’:\n",
      "\n",
      "    lowess\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "library(\"InterSIM\", quietly = TRUE)\n",
    "source(\"runfactorization.R\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1] \"../data/\"\n",
      "[1] \"20210329212141\"\n",
      "[1] \"../data/simulations_20210329212141/\"\n",
      "[1] \"../results20210329212141/\"\n"
     ]
    }
   ],
   "source": [
    "# Base folder for data\n",
    "data_folder <- \"../data/\"\n",
    "# Label to identify current run\n",
    "tag <- format(Sys.time(), \"%Y%m%d%H%M%S\")\n",
    "# Folder containing simulated data\n",
    "simul_folder <- paste0(data_folder, \"simulations_\", tag, \"/\") \n",
    "# Folder for comparison results\n",
    "results_folder <- paste0(\"../results\", tag, \"/\")\n",
    "print(data_folder)\n",
    "print(tag)\n",
    "print(simul_folder)\n",
    "print(results_folder)\n",
    "dir.create(data_folder, showWarnings = FALSE)\n",
    "dir.create(simul_folder, showWarnings = FALSE)\n",
    "dir.create(results_folder, showWarnings = FALSE)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "list_clusters <- seq(5,15,5)\n",
    "list_distrib <-  c(\"heterogeneous\",\"equal\")\n",
    "\n",
    "# For a given number of clusters\n",
    "for(size in list_distrib) {\n",
    "    thisdir1 <- paste(simul_folder,size, sep=\"\")\n",
    "    dir.create(thisdir1, showWarnings = FALSE)\n",
    "    # Data distribution among clusters will either be heterogeneous or equal \n",
    "    for (num.clusters in list_clusters) {\n",
    "        thisdir2 <- paste(thisdir1,\"/\",num.clusters, sep=\"\")\n",
    "        dir.create(thisdir2, showWarnings = FALSE)\n",
    "        }\n",
    "    }\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "## Simulate data\n",
    "## INPUTS:\n",
    "# folder = location  where the simulated data should be saved\n",
    "# num.clusters = number of clusters to be imposed on the data\n",
    "# size = heterogeneous for heterogeneous clusters, equal for equally-sized clusters\n",
    "## OUPUTS: matrices of simulated data are saved to file in folder\n",
    "##模拟数据\n",
    "##输入:\n",
    "#folder=应保存模拟数据的位置\n",
    "#num.clusters =要施加在数据上的集群数\n",
    "#size =对于异构集群,heterogeneous,对于相等大小的集群,equal\n",
    "## OUPUTS:模拟数据矩阵保存到文件夹中的文件中\n",
    "simulated_data_generation <- function(out.folder, num.clusters, size=\"heterogeneous\", predefined=TRUE) {\n",
    "    \n",
    "    # Number of clusters\n",
    "    num.clusters <- as.numeric(num.clusters)\n",
    "    # Size of the effect\n",
    "    effect <- 2.5\n",
    "    # Sample proportions per clusters defined here are those used for the paper\n",
    "    #此处定义的每类样本比例是本文使用的比例\n",
    "    prop_predefined <- list(\n",
    "        \"heterogeneous\" = list(\n",
    "            \"5\" = c(0.35, 0.13, 0.19, 0.08, 0.25),\n",
    "            \"10\" = c(0.20, 0.10, 0.07, 0.10, 0.15, 0.13, 0.10, 0.08, 0.05, 0.02),\n",
    "            \"15\" = c(0.10,0.08,0.04,0.03,0.12,0.03,0.10,0.03,0.05,0.02,0.1,0.2,0.03,0.02,0.05)\n",
    "        ),\n",
    "        \"equal\" = list(\n",
    "            \"5\" = c(0.25,0.2,0.2,0.2,0.15),\n",
    "            \"10\" = c(0.15,0.1,0.1,0.1,0.1,0.1,0.05,0.1,0.1,0.1),\n",
    "            \"15\" = c(0.07,0.07,0.07,0.06,0.07,0.07,0.07,0.06,0.07,0.06,0.07,0.06,0.07,0.06,0.07)\n",
    "        )\n",
    "    )\n",
    "\n",
    "    # Check provided parameter (size) against allowed values\n",
    "    if(! size %in% names(prop_predefined)) {\n",
    "        print(paste0(\"ERROR: size can only assume value : \", \n",
    "                     paste0(names(prop_predefined), collapse=\",\"),\n",
    "                     \" found : \", size))\n",
    "    }\n",
    "\n",
    "    # If article proportions are to be used\n",
    "    if(predefined) {\n",
    "        # Check provided parameter (number of clusters) against allowed values\n",
    "        if(! as.character(num.clusters) %in% names(prop_predefined[[size]])) {\n",
    "            print(paste0(\"ERROR: num.clusters can only assume value : \", \n",
    "                         paste0(names(prop_predefined[[size]]), collapse=\",\"),\n",
    "                         \" found : \",\n",
    "                         num.clusters))\n",
    "        }\n",
    "        prop <- prop_predefined[[size]][[as.character(num.clusters)]]\n",
    "        prop[1] <- 1-sum(prop[-1])\n",
    "    }\n",
    "    # Otherwise\n",
    "    else {\n",
    "        if(size == \"equal\") {\n",
    "            # Could be simplified! Only necessary because InterSIM is \"easily offended\" :\n",
    "            # ensure same object type as in the heterogeneous case, and that not all \n",
    "            # values are exactly the same (should not impact the number of samples per group)\n",
    "            # - same type\n",
    "            equals <- rep(1, num.clusters)\n",
    "            prop <- equals/sum(equals)\n",
    "            # - slightly imbalanced\n",
    "            delta <- 0.05*prop[1]\n",
    "            prop[1] <- prop[1]+delta\n",
    "            prop[num.clusters] <- prop[num.clusters]-delta\n",
    "            # - sum is 1\n",
    "            prop <- round(prop, digits = 10)\n",
    "            prop[1] <- 1-sum(prop[-1])\n",
    "        }\n",
    "        else {\n",
    "            random <- runif(n = num.clusters, min = 0, max = 1)\n",
    "            prop <- random/sum(random)\n",
    "        }\n",
    "    }\n",
    "\n",
    "    # Simulate data based on provided parameters\n",
    "    print(prop)\n",
    "    print(sum(prop))\n",
    "    print(sum(prop)==1)\n",
    "    sim.D <- InterSIM(n.sample=100, cluster.sample.prop=prop, \n",
    "                      delta.methyl=effect, delta.expr=effect, delta.protein=effect, \n",
    "                      p.DMP=0.25, p.DEG=NULL, p.DEP=NULL,\n",
    "                      do.plot=FALSE, sample.cluster=TRUE, feature.cluster=TRUE)\n",
    "                      \n",
    "    \n",
    "    thisdir <- paste(out.folder,size,\"/\",num.clusters, sep=\"\")\n",
    "    print(thisdir)\n",
    "    #dir.create(paste(out.folder,size,num.clusters, sep=\"/\"), showWarnings = FALSE)\n",
    "    #dir.create(paste(out.folder,size,num.clusters, sep=\"/\"), showWarnings = FALSE)\n",
    "    #dir.create(paste(out.folder,size,num.clusters, sep=\"/\"), showWarnings = FALSE)\n",
    "\n",
    "                \n",
    "\n",
    "    # Export simulations as tables\n",
    "    write.table(sim.D$clustering.assignment, paste(thisdir, \"clusters.txt\", sep=\"/\"), sep=\"\\t\")\n",
    "    write_table_with_index_header(t(sim.D$dat.methyl), paste(thisdir, \"omics1.txt\", sep=\"/\"))\n",
    "    write_table_with_index_header(t(sim.D$dat.expr), paste(thisdir, \"omics2.txt\", sep=\"/\"))\n",
    "    write_table_with_index_header(t(sim.D$dat.protein), paste(thisdir, \"omics3.txt\", sep=\"/\"))\n",
    "\n",
    "    return(\"data saved in folder\")\n",
    "}\n",
    "\n",
    "## Support function\n",
    "write_table_with_index_header <- function(data, file, sep=\"\\t\") {\n",
    "    write.table(cbind(probe=row.names(data),data), file, sep = sep, \n",
    "                append = FALSE, quote = FALSE, row.names = FALSE, col.names = TRUE)\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1] \"##########\"\n",
      "[1] \"-> Distribution: heterogeneous, Nb clusters: 5\"\n",
      "[1] \"-> Simulating data...\"\n",
      "[1] 0.35 0.13 0.19 0.08 0.25\n",
      "[1] 1\n",
      "[1] TRUE\n",
      "[1] \"../data/simulations_20210329212141/heterogeneous/5\"\n",
      "[1] \"-> Done.\"\n",
      "[1] \"##########\"\n",
      "[1] \"-> Distribution: equal, Nb clusters: 5\"\n",
      "[1] \"-> Simulating data...\"\n",
      "[1] 0.25 0.20 0.20 0.20 0.15\n",
      "[1] 1\n",
      "[1] TRUE\n",
      "[1] \"../data/simulations_20210329212141/equal/5\"\n",
      "[1] \"-> Done.\"\n",
      "[1] \"##########\"\n",
      "[1] \"-> Distribution: heterogeneous, Nb clusters: 10\"\n",
      "[1] \"-> Simulating data...\"\n",
      " [1] 0.20 0.10 0.07 0.10 0.15 0.13 0.10 0.08 0.05 0.02\n",
      "[1] 1\n",
      "[1] TRUE\n",
      "[1] \"../data/simulations_20210329212141/heterogeneous/10\"\n",
      "[1] \"-> Done.\"\n",
      "[1] \"##########\"\n",
      "[1] \"-> Distribution: equal, Nb clusters: 10\"\n",
      "[1] \"-> Simulating data...\"\n",
      " [1] 0.15 0.10 0.10 0.10 0.10 0.10 0.05 0.10 0.10 0.10\n",
      "[1] 1\n",
      "[1] TRUE\n",
      "[1] \"../data/simulations_20210329212141/equal/10\"\n",
      "[1] \"-> Done.\"\n",
      "[1] \"##########\"\n",
      "[1] \"-> Distribution: heterogeneous, Nb clusters: 15\"\n",
      "[1] \"-> Simulating data...\"\n",
      " [1] 0.10 0.08 0.04 0.03 0.12 0.03 0.10 0.03 0.05 0.02 0.10 0.20 0.03 0.02 0.05\n",
      "[1] 1\n",
      "[1] TRUE\n",
      "[1] \"../data/simulations_20210329212141/heterogeneous/15\"\n",
      "[1] \"-> Done.\"\n",
      "[1] \"##########\"\n",
      "[1] \"-> Distribution: equal, Nb clusters: 15\"\n",
      "[1] \"-> Simulating data...\"\n",
      " [1] 0.07 0.07 0.07 0.06 0.07 0.07 0.07 0.06 0.07 0.06 0.07 0.06 0.07 0.06 0.07\n",
      "[1] 1\n",
      "[1] TRUE\n",
      "[1] \"../data/simulations_20210329212141/equal/15\"\n",
      "[1] \"-> Done.\"\n"
     ]
    }
   ],
   "source": [
    "## Simulate data, factorize and compare the results\n",
    "\n",
    "list_clusters <- seq(5,15,5)\n",
    "list_distrib <-  c(\"heterogeneous\",\"equal\")\n",
    "\n",
    "# For a given number of clusters\n",
    "for(num.clusters in list_clusters) {\n",
    "    # Data distribution among clusters will either be heterogeneous or equal \n",
    "    for (size in list_distrib) {\n",
    "        \n",
    "        print(\"##########\")\n",
    "        print(paste0(\"-> Distribution: \", size, \", Nb clusters: \", num.clusters))\n",
    "        \n",
    "        # Make simulated data\n",
    "        print(\"-> Simulating data...\")\n",
    "        simulated_data_generation(simul_folder, num.clusters, size, predefined=TRUE)\n",
    "        \n",
    "        print(\"-> Done.\")\n",
    "    }\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Warning message in createMOFAobject(omics):\n",
      "“View names are not specified in the data, renaming them to: view_1, view_2, view_3\n",
      "”\n",
      "Creating MOFA object from list of matrices,\n",
      " please make sure that samples are columns and features are rows...\n",
      "\n",
      "\n",
      "Checking data options...\n",
      "\n",
      "Checking training options...\n",
      "\n",
      "Checking model options...\n",
      "\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1] \"No output file provided, using a temporary file...\"\n",
      "Generating warm start... \n",
      "K=6:12\n"
     ]
    }
   ],
   "source": [
    "out <- runfactorization(\"../data/simulations_20210329212141/equal/5\", paste0(\"omics\",1:3,\".txt\"), 5, sep=\"\\t\", filtering=\"none\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "           [,1]\n",
      "subject1      9\n",
      "subject2      1\n",
      "subject3     12\n",
      "subject4     13\n",
      "subject5     11\n",
      "subject6     14\n",
      "subject7     12\n",
      "subject8     12\n",
      "subject9     16\n",
      "subject10    15\n",
      "subject11     3\n",
      "subject12     3\n",
      "subject13    12\n",
      "subject14    15\n",
      "subject15    16\n",
      "subject16    14\n",
      "subject17     5\n",
      "subject18    15\n",
      "subject19    15\n",
      "subject20    15\n",
      "subject21     3\n",
      "subject22     9\n",
      "subject23    10\n",
      "subject24    12\n",
      "subject25     1\n",
      "subject26    14\n",
      "subject27     7\n",
      "subject28    12\n",
      "subject29     7\n",
      "subject30    12\n",
      "subject31     8\n",
      "subject32    12\n",
      "subject33    16\n",
      "subject34    16\n",
      "subject35     1\n",
      "subject36    14\n",
      "subject37     9\n",
      "subject38    12\n",
      "subject39     6\n",
      "subject40     9\n",
      "subject41    10\n",
      "subject42    14\n",
      "subject43     4\n",
      "subject44    13\n",
      "subject45    12\n",
      "subject46    11\n",
      "subject47    15\n",
      "subject48    13\n",
      "subject49     3\n",
      "subject50     4\n",
      "subject51     2\n",
      "subject52    16\n",
      "subject53    10\n",
      "subject54     4\n",
      "subject55     7\n",
      "subject56     3\n",
      "subject57    15\n",
      "subject58     8\n",
      "subject59    13\n",
      "subject60    16\n",
      "subject61     8\n",
      "subject62     9\n",
      "subject63    12\n",
      "subject64     2\n",
      "subject65     4\n",
      "subject66    13\n",
      "subject67    12\n",
      "subject68    14\n",
      "subject69    10\n",
      "subject70     2\n",
      "subject71     6\n",
      "subject72     5\n",
      "subject73    15\n",
      "subject74    16\n",
      "subject75     9\n",
      "subject76    16\n",
      "subject77    12\n",
      "subject78    16\n",
      "subject79     6\n",
      "subject80    13\n",
      "subject81    16\n",
      "subject82     3\n",
      "subject83    14\n",
      "subject84     1\n",
      "subject85     8\n",
      "subject86    10\n",
      "subject87    14\n",
      "subject88     1\n",
      "subject89     3\n",
      "subject90    14\n",
      "subject91     9\n",
      "subject92     3\n",
      "subject93     5\n",
      "subject94    12\n",
      "subject95     8\n",
      "subject96     2\n",
      "subject97     2\n",
      "subject98    10\n",
      "subject99    11\n",
      "subject100   10\n"
     ]
    }
   ],
   "source": [
    "print(out$icluster.clusters)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Loading required package: MASS\n",
      "\n",
      "Loading required package: NMF\n",
      "\n",
      "Loading required package: pkgmaker\n",
      "\n",
      "Loading required package: registry\n",
      "\n",
      "Loading required package: rngtools\n",
      "\n",
      "Loading required package: cluster\n",
      "\n",
      "NMF - BioConductor layer [OK] | Shared memory capabilities [NO: bigmemory] | Cores 27/28\n",
      "\n",
      "  To enable shared memory capabilities, try: install.extras('\n",
      "NMF\n",
      "')\n",
      "\n",
      "Loading required package: mclust\n",
      "\n",
      "Package 'mclust' version 5.4.6\n",
      "Type 'citation(\"mclust\")' for citing this R package in publications.\n",
      "\n",
      "Loading required package: InterSIM\n",
      "\n",
      "Loading required package: tools\n",
      "\n",
      "Loading required package: ade4\n",
      "\n",
      "\n",
      "Attaching package: ‘ade4’\n",
      "\n",
      "\n",
      "The following object is masked from ‘package:BiocGenerics’:\n",
      "\n",
      "    score\n",
      "\n",
      "\n",
      "\n",
      "Attaching package: ‘GPArotation’\n",
      "\n",
      "\n",
      "The following object is masked from ‘package:NMF’:\n",
      "\n",
      "    entropy\n",
      "\n",
      "\n",
      "\n",
      "Attaching package: ‘MOFAtools’\n",
      "\n",
      "\n",
      "The following objects are masked from ‘package:NMF’:\n",
      "\n",
      "    featureNames, featureNames<-, predict, sampleNames, sampleNames<-\n",
      "\n",
      "\n",
      "The following objects are masked from ‘package:Biobase’:\n",
      "\n",
      "    featureNames, featureNames<-, sampleNames, sampleNames<-\n",
      "\n",
      "\n",
      "The following object is masked from ‘package:stats’:\n",
      "\n",
      "    predict\n",
      "\n",
      "\n",
      "Loading required package: JADE\n",
      "\n",
      "Loading required package: lattice\n",
      "\n",
      "Loading required package: caTools\n",
      "\n",
      "Loading required package: gdata\n",
      "\n",
      "gdata: read.xls support for 'XLS' (Excel 97-2004) files ENABLED.\n",
      "\n",
      "\n",
      "\n",
      "gdata: read.xls support for 'XLSX' (Excel 2007+) files ENABLED.\n",
      "\n",
      "\n",
      "Attaching package: ‘gdata’\n",
      "\n",
      "\n",
      "The following object is masked from ‘package:Biobase’:\n",
      "\n",
      "    combine\n",
      "\n",
      "\n",
      "The following object is masked from ‘package:BiocGenerics’:\n",
      "\n",
      "    combine\n",
      "\n",
      "\n",
      "The following object is masked from ‘package:stats’:\n",
      "\n",
      "    nobs\n",
      "\n",
      "\n",
      "The following object is masked from ‘package:utils’:\n",
      "\n",
      "    object.size\n",
      "\n",
      "\n",
      "The following object is masked from ‘package:base’:\n",
      "\n",
      "    startsWith\n",
      "\n",
      "\n",
      "Loading required package: gtools\n",
      "\n",
      "\n",
      "Attaching package: ‘gtools’\n",
      "\n",
      "\n",
      "The following object is masked from ‘package:InterSIM’:\n",
      "\n",
      "    logit\n",
      "\n",
      "\n",
      "Loading required package: gplots\n",
      "\n",
      "\n",
      "Attaching package: ‘gplots’\n",
      "\n",
      "\n",
      "The following object is masked from ‘package:stats’:\n",
      "\n",
      "    lowess\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "##### runfactoization runs all the considered multi-omics factorization\n",
    "### the required inputs are:\n",
    "### \"folder\" corresponding to the path to the folder where the input files are contained, in the idea that all omics matrices are organized inside a unique folder\n",
    "### \"file.names\" corresponding to a vector containing the names of all the omics files\n",
    "### \"num.factors\" containing the number of factors in which we desire to decompose the matrices\n",
    "### \"sep=\" \"\" corresponding to the separator used in the omics files required to properly read them\n",
    "### \"single.cell\" indicating if the data are single cell data. In this case the filtering of the data will be more intense in respect to other data types\n",
    "### \"filtering\"\n",
    "\n",
    "### the input files need to be log2 transformed before running the analysis\n",
    "\n",
    "\n",
    "library(\"RGCCA\")\n",
    "library(\"r.jive\")\n",
    "library(\"IntNMF\")\n",
    "library(\"omicade4\")\n",
    "library(\"MSFA\")\n",
    "library(\"GPArotation\")\n",
    "library(\"MOFAtools\")\n",
    "library(\"tensorBSS\")\n",
    "source(\"tICA.R\")\n",
    "library(\"iCluster\")\n",
    "\n",
    "testrunfactorization <- function(folder,file.names,num.factors,sep=\" \",filtering=\"none\"){\n",
    "  factorizations<-list()\n",
    "  t<-1\n",
    "  method<-numeric(0)\n",
    "  \n",
    "  num.factors<-as.numeric(num.factors)\n",
    "\n",
    "  \n",
    "  ##creating list of omics\n",
    "  omics <- list()\n",
    "  for(i in 1:length(file.names)){\n",
    "    omics[[i]]<-as.matrix(read.table(paste(folder,file.names[i],sep=\"/\"),sep=sep,row.names=1,header=T))\n",
    "  }\n",
    "  #print(omics)\n",
    "    \n",
    "  ####\n",
    "  #omics<-lapply(omics, function(x) t(x))\n",
    "  ######\n",
    "  \n",
    "  ##restricting to common samples and filtering\n",
    "  samples<-colnames(omics[[1]])\n",
    "  for(j in 1:length(omics)){\n",
    "    samples<-intersect(samples,colnames(omics[[j]]))\n",
    "  }\n",
    "  for(j in 1:length(omics)){\n",
    "    omics[[j]]<-omics[[j]][,samples]\n",
    "    if(filtering!=\"none\"){\n",
    "      x<-apply( omics[[j]],1,sd)\n",
    "      x<-as.matrix(sort(x, decreasing = T))\n",
    "      w<-which(x>0)\n",
    "      if(filtering==\"stringent\"){\n",
    "        selected<-rownames(x)[1:min(w[length(w)],5000)]\n",
    "      }else{\n",
    "        selected<-rownames(x)[1:min(w[length(w)],6000)]\n",
    "      }\n",
    "      m<-match(rownames(omics[[j]]),selected)\n",
    "      w<-which(!is.na(m))\n",
    "      omics[[j]]<-omics[[j]][w,]\n",
    "    }else{\n",
    "      omics[[j]]<-omics[[j]][which(apply(omics[[j]],2,sd)>0),]\n",
    "    }\n",
    "  }\n",
    "  print(length(omics))  \n",
    "  \n",
    " \n",
    "  ##RGCCA \n",
    "  factorizations_RGCCA<-rgcca(lapply(omics, function(x) t(x)), ncomp = rep(num.factors, length(omics)), scheme = \"centroid\", scale = TRUE, init = \"svd\",bias = TRUE, tol = 1e-08, verbose = F)\n",
    "  factors_rgcca<-as.matrix(factorizations_RGCCA$Y[[1]])\n",
    "  metagenes_rgcca <- list()\n",
    "  for(j in 1:length(omics)){\n",
    "    metagenes_rgcca[[j]]<-as.matrix(factorizations_RGCCA$a[[j]])\n",
    "    rownames(metagenes_rgcca[[j]])<-rownames(omics[[j]])\n",
    "    colnames(metagenes_rgcca[[j]])<-1:num.factors\n",
    "  }\n",
    "  print(factors_rgcca)                                   \n",
    "  factorizations[[t]]<-list(factors_rgcca,metagenes_rgcca)\n",
    "  t<-t+1\n",
    "  method<-c(method,\"RGCCA\")\n",
    "  \n",
    " \n",
    "  \n",
    "  \n",
    "  \n",
    "  \n",
    "  out<-list(factorizations=factorizations,method=method)\n",
    "  \n",
    "  return(out)\n",
    "}\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1] 3\n",
      "                 comp1         comp2        comp3       comp4        comp5\n",
      "subject1   -0.66795710 -0.1975975691 -0.300867807 -0.27752304  0.046597119\n",
      "subject2    0.34576508 -0.2629359330  0.241120840 -0.28930964 -0.084342734\n",
      "subject3   -0.18025509 -0.0176580168  0.248585176  0.28288886 -0.563893934\n",
      "subject4    0.36050703 -0.1890522412 -0.408620222  0.17398881 -0.043598118\n",
      "subject5    0.35911618 -0.3781877286  0.258566999 -0.36205334  0.226873122\n",
      "subject6    0.28325320 -0.1622556746  0.181241457 -0.21227011 -0.559915019\n",
      "subject7   -0.11612513  0.0788346274  0.220124930  0.33526312 -0.408510876\n",
      "subject8   -0.07780757 -0.0141900772  0.335851483  0.28675003 -0.508347353\n",
      "subject9    0.23910572 -0.1559110417 -0.458080182  0.26396763 -0.191666676\n",
      "subject10   0.29560944 -0.1561401151  0.260168096 -0.14995656 -0.479010526\n",
      "subject11  -0.48458731 -0.0735627161 -0.102832592 -0.12385138 -0.621762842\n",
      "subject12  -0.40942839 -0.1172649178 -0.123315575 -0.13509267 -0.508532015\n",
      "subject13  -0.19549696 -0.0472492050  0.451490816  0.50806521 -0.123621935\n",
      "subject14   0.39955927 -0.2851241355  0.271590149 -0.31162352  0.072921505\n",
      "subject15   0.32758984 -0.2064551003 -0.653680908  0.34347063  0.560935168\n",
      "subject16   0.30672961 -0.1742978200  0.213687656 -0.20118681 -0.315973999\n",
      "subject17  -0.34042109  0.0094594151  0.498483605  0.42013004  0.375227744\n",
      "subject18   0.40118542 -0.2734121639  0.251444907 -0.24741560 -0.035026155\n",
      "subject19   0.37087343 -0.2281502347  0.227306543 -0.13034463 -0.294658628\n",
      "subject20   0.33360340 -0.2361817170  0.369069661 -0.26769134  0.022237249\n",
      "subject21  -0.52471917 -0.1427221966 -0.160799669 -0.21163478 -0.034265692\n",
      "subject22  -0.69679088 -0.1816307996 -0.190834122 -0.28495996  0.012379644\n",
      "subject23   0.12198428  0.9913928035 -0.044774322 -0.13749865  0.118102528\n",
      "subject24  -0.15083689 -0.0048478563  0.355681978  0.39781971 -0.290817913\n",
      "subject25   0.37459760 -0.2149748122  0.333619860 -0.32522255  0.050167823\n",
      "subject26   0.40536926 -0.3524025172  0.341182290 -0.31587600  0.569370103\n",
      "subject27   0.11113972  1.2053399506 -0.164090254 -0.19666250  0.737646931\n",
      "subject28  -0.26649175 -0.0039560291  0.373027247  0.46078534 -0.088915510\n",
      "subject29   0.13245557  0.9972172785 -0.180399738 -0.18447479  0.036228901\n",
      "subject30   0.04381088 -0.0209174788  0.230704944  0.27547222 -0.819244333\n",
      "subject31  -0.42005698 -0.1287161305 -0.155971367 -0.15704278 -0.372743880\n",
      "subject32  -0.20348204  0.0009880961  0.299796328  0.32610320 -0.360080596\n",
      "subject33   0.28535050 -0.2713312474 -0.500023051  0.36026331  0.222183508\n",
      "subject34   0.36639250 -0.2101325265 -0.489283192  0.30912583  0.088598721\n",
      "subject35   0.40052578 -0.2974581772  0.255015971 -0.45895052  0.290803574\n",
      "subject36   0.32790701 -0.1703322633  0.240954041 -0.07700836 -0.524146348\n",
      "subject37  -0.61693839 -0.0942186029 -0.177411533 -0.18328804 -0.247984667\n",
      "subject38  -0.23920350  0.0260360668  0.395750936  0.45292016  0.083874166\n",
      "subject39  -0.41820019  0.0546330698  0.603785400  0.64903814  1.044504163\n",
      "subject40  -0.70401354 -0.1581552091 -0.280909078 -0.21301229 -0.018808455\n",
      "subject41   0.13214984  0.6871584180 -0.016649327 -0.03980170 -0.148488390\n",
      "subject42   0.38114498 -0.2299476492  0.154361399 -0.30505595 -0.226334074\n",
      "subject43   0.29988888 -0.2001701560 -0.431435212  0.31410946 -0.131627216\n",
      "subject44   0.25168987 -0.0954950718 -0.322214740  0.18270367 -0.469802161\n",
      "subject45  -0.32035124  0.0046356596  0.477170403  0.47590852  0.234729477\n",
      "subject46   0.41149062 -0.4124026217  0.275973912 -0.41554365  0.502762300\n",
      "subject47   0.33933161 -0.1961931092  0.165805850 -0.22897229 -0.350842819\n",
      "subject48   0.32737821 -0.0920039617 -0.230312555  0.17569330 -0.632712306\n",
      "subject49  -0.62112071 -0.0938839090 -0.075833583 -0.18950765 -0.262536893\n",
      "subject50   0.39773655 -0.2355097842 -0.639536514  0.36126441  0.572461179\n",
      "subject51   0.12040917  0.7432439531 -0.018828592 -0.12949232 -0.079918547\n",
      "subject52   0.29100778 -0.2047539625 -0.592615932  0.33531966  0.255890133\n",
      "subject53   0.14404575  0.8066309601 -0.028532983 -0.13038362 -0.167896287\n",
      "subject54   0.43806126 -0.2719940971 -0.666439000  0.27156816  0.468453204\n",
      "subject55   0.16338689  0.7534885853 -0.046822843 -0.14356642 -0.258904701\n",
      "subject56  -0.54330671 -0.1888214867 -0.182831910 -0.17865797 -0.066583743\n",
      "subject57   0.38319068 -0.3144127998  0.270625410 -0.28931411  0.236546652\n",
      "subject58  -0.65351047 -0.1274028816 -0.195864111 -0.21498599  0.006272390\n",
      "subject59   0.27531783 -0.0800134576 -0.242423159  0.15085070 -0.645005862\n",
      "subject60   0.29125858 -0.1328721023 -0.369428039  0.25297635 -0.433646048\n",
      "subject61  -0.78060876 -0.2821848066 -0.185503052 -0.21796513  0.072287754\n",
      "subject62  -0.85465449 -0.1673919058 -0.303664385 -0.31019783  0.266539258\n",
      "subject63  -0.16479915 -0.0090984830  0.356200241  0.39062847 -0.183072327\n",
      "subject64   0.04786201  1.1937650392 -0.043303979 -0.19370464  0.250076084\n",
      "subject65   0.30532165 -0.1704268507 -0.358892836  0.27005600 -0.249180710\n",
      "subject66   0.37707053 -0.1771229460 -0.454937274  0.24098709  0.062682104\n",
      "subject67  -0.22037895  0.0177286001  0.417926483  0.36863521  0.071323646\n",
      "subject68   0.39512069 -0.2366673774  0.216649037 -0.29284511  0.008576342\n",
      "subject69   0.12827505  0.8567863582 -0.013746448 -0.11409165  0.081832362\n",
      "subject70   0.15024314  0.7453052610  0.005392764 -0.06270430 -0.173802527\n",
      "subject71  -0.28791437  0.0203331599  0.466262963  0.45433729  0.072583937\n",
      "subject72  -0.32868728 -0.0338625503  0.415598533  0.43109624 -0.025039045\n",
      "subject73   0.30380123 -0.2405506953  0.229286741 -0.25038761 -0.240826397\n",
      "subject74   0.28413695 -0.2080696476 -0.594344920  0.37635640  0.259888196\n",
      "subject75  -1.01616042 -0.2629562915 -0.356372272 -0.49848437  0.628756397\n",
      "subject76   0.24568194 -0.1835798153 -0.443551837  0.35915120  0.026318724\n",
      "subject77  -0.27789916 -0.0048473473  0.345856825  0.39243126 -0.234121870\n",
      "subject78   0.38427805 -0.2223340178 -0.656837020  0.25087347  0.354163259\n",
      "subject79  -0.39981804 -0.0196969046  0.584051104  0.53694953  1.134921916\n",
      "subject80   0.27705694 -0.1080970749 -0.386685037  0.24076333 -0.241880315\n",
      "subject81   0.31335961 -0.2561279021 -0.682036273  0.35385352  0.453455172\n",
      "subject82  -0.43985970 -0.1495504622 -0.095994877 -0.20146180 -0.264895053\n",
      "subject83   0.44732835 -0.2583292762  0.202537607 -0.26059137 -0.098211699\n",
      "subject84   0.39698952 -0.3499256864  0.325258636 -0.40885985  0.289307634\n",
      "subject85  -0.75136801 -0.1232615110 -0.231802292 -0.26259688 -0.074211961\n",
      "subject86   0.12936870  0.8954234066 -0.093754585 -0.13571839  0.105100811\n",
      "subject87   0.35678871 -0.2465073482  0.249338939 -0.29102546 -0.027625860\n",
      "subject88   0.45373993 -0.2961290693  0.331510086 -0.41422877  0.355016508\n",
      "subject89  -0.55235599 -0.0882347574 -0.133777889 -0.24414535 -0.415535261\n",
      "subject90   0.39405941 -0.3377337316  0.432651264 -0.28667185  0.678702952\n",
      "subject91  -0.91228550 -0.1851716392 -0.320023754 -0.44279513  0.559760637\n",
      "subject92  -0.59550423 -0.1053352454 -0.159220342 -0.25166634 -0.258521010\n",
      "subject93  -0.40457224  0.0165940814  0.477644984  0.57539863  0.640072913\n",
      "subject94  -0.18494150  0.0596899207  0.354371616  0.41316953 -0.272703209\n",
      "subject95  -0.71579607 -0.1496541724 -0.296889784 -0.28595335  0.138126582\n",
      "subject96   0.21892346  0.5690727182 -0.064691902 -0.10351738 -0.497977461\n",
      "subject97   0.09944305  0.8931895607 -0.037956288 -0.10140124  0.008295167\n",
      "subject98   0.14312408  0.8875227295 -0.014458296 -0.12274998  0.103570903\n",
      "subject99   0.47719454 -0.3540176751  0.237126518 -0.39867246  0.707972555\n",
      "subject100  0.16961816  1.0156947761 -0.069745172 -0.14946591  0.462672836\n",
      "                  comp6        comp7        comp8         comp9       comp10\n",
      "subject1   -0.120527756  0.089269771 -0.097534334 -0.1702471985 -0.193372267\n",
      "subject2    0.004226896  0.213313895  0.056469727 -0.0621672992 -0.082684709\n",
      "subject3   -0.009572400 -0.050562396 -0.177692353  0.0132125699 -0.030125332\n",
      "subject4   -0.233439107 -0.004897228 -0.042481797 -0.0431395365  0.042920360\n",
      "subject5   -0.101725554  0.152754911 -0.064126811 -0.1048910435 -0.026664461\n",
      "subject6   -0.121315872  0.065821450 -0.133365238 -0.0471982522  0.047490306\n",
      "subject7   -0.074883798  0.073023859 -0.251574325  0.0015331721 -0.034307365\n",
      "subject8    0.031263663  0.232016560  0.064997932  0.1407648072  0.020675983\n",
      "subject9   -0.002449634 -0.048508331 -0.137655422  0.0621313298 -0.199873772\n",
      "subject10  -0.007289828  0.050208836  0.092218099 -0.0833417404 -0.003616362\n",
      "subject11   0.281516652 -0.073907960 -0.191225455  0.0756521635 -0.015227249\n",
      "subject12   0.063767411  0.115550550  0.036992505 -0.0671939782 -0.047665225\n",
      "subject13   0.186032236 -0.107735814  0.184641855  0.0231450173 -0.120664078\n",
      "subject14  -0.040851876 -0.119457601  0.082474195 -0.1878446686 -0.232646964\n",
      "subject15   0.116922471 -0.058805510  0.040698173  0.2085556488 -0.059526824\n",
      "subject16   0.032427895 -0.118124461 -0.042078403 -0.1077030778 -0.031625451\n",
      "subject17  -0.107272283  0.128840560  0.066709982  0.0013035855  0.015980911\n",
      "subject18   0.061674579 -0.142786799 -0.107827346  0.0452381083 -0.131811646\n",
      "subject19  -0.190428102 -0.045703612  0.064201058  0.0464326957  0.142239436\n",
      "subject20   0.398324754 -0.095815790  0.037435264 -0.0224074519 -0.018019439\n",
      "subject21  -0.039471884 -0.204420196 -0.018540301  0.1214560737  0.149521584\n",
      "subject22   0.218295455  0.107811873  0.194562543  0.1544748606 -0.006001307\n",
      "subject23   0.022706959 -0.118780292 -0.121719736  0.1713794660  0.013766617\n",
      "subject24  -0.179755278 -0.055944043  0.139511528  0.0102685184  0.111178009\n",
      "subject25   0.042279315  0.140621811 -0.033915933  0.0953615318  0.136970022\n",
      "subject26   0.011192978 -0.046892582 -0.126118130  0.0760056899  0.089159417\n",
      "subject27  -0.282658351 -0.203976896  0.059147532 -0.1742293933  0.003661646\n",
      "subject28   0.230634472 -0.063020205 -0.112998976 -0.1153263994  0.010407902\n",
      "subject29   0.303270120  0.013229247 -0.035605017 -0.1182645049  0.019351448\n",
      "subject30  -0.204927862  0.079252447  0.073391621  0.0608968098  0.056732799\n",
      "subject31  -0.130193659 -0.017482579 -0.020319186 -0.0009300793 -0.044918815\n",
      "subject32  -0.262863803  0.066727212 -0.248598758  0.0007732203  0.181997022\n",
      "subject33  -0.029974181  0.059840851  0.004518458 -0.0768388919 -0.009395006\n",
      "subject34   0.083727237  0.182907119  0.045898338  0.0244726561  0.056318036\n",
      "subject35  -0.078730564  0.117345006  0.003569678 -0.0172958409  0.164834429\n",
      "subject36  -0.088932807  0.001377762  0.144625497 -0.0125983414 -0.037551815\n",
      "subject37   0.103515073  0.166386767 -0.113779725  0.0567002461  0.005822713\n",
      "subject38  -0.125644886 -0.137872500 -0.045275334  0.0257804707  0.062144121\n",
      "subject39   0.143571363 -0.007869125  0.123370419 -0.0031550389 -0.033781297\n",
      "subject40  -0.017339043 -0.126717478 -0.146898137 -0.0990836451 -0.022792638\n",
      "subject41  -0.022995977 -0.007088292  0.264648880  0.0458398718 -0.302084998\n",
      "subject42  -0.217904116  0.022873660  0.065336995 -0.0711811434  0.066586917\n",
      "subject43  -0.102858073  0.045970091 -0.027778070  0.0126378802  0.231109562\n",
      "subject44  -0.116098461  0.003005239  0.074544873 -0.0992129050  0.185484635\n",
      "subject45   0.126593041 -0.137645284  0.015837232 -0.0141721418  0.211804220\n",
      "subject46   0.179509605 -0.064698501 -0.124951489 -0.1077195467  0.057652405\n",
      "subject47  -0.145083949 -0.105387685 -0.092561808 -0.0439197410 -0.060264144\n",
      "subject48   0.064277420  0.108670700  0.182984821 -0.0643780823 -0.027975377\n",
      "subject49   0.129844116  0.018010073  0.061036795  0.0256026094  0.198502142\n",
      "subject50  -0.359814235 -0.039325659 -0.278097413  0.1412902457  0.023430785\n",
      "subject51   0.136465798  0.169683506  0.030153683 -0.0612677201 -0.231784599\n",
      "subject52   0.105356641  0.059267826  0.235461063 -0.1427750397 -0.298113788\n",
      "subject53  -0.016649505  0.066025352 -0.026913898  0.1226367714 -0.073002141\n",
      "subject54  -0.009989079  0.027507846  0.088106911  0.1344099481  0.134375588\n",
      "subject55   0.099860055 -0.007823125  0.108892819  0.0296759495 -0.100682449\n",
      "subject56  -0.016761808 -0.098842416  0.188934511  0.0218956686 -0.054346941\n",
      "subject57   0.086342593 -0.111257838 -0.145133472  0.0327387862  0.010680016\n",
      "subject58  -0.064192065 -0.022402684  0.099209919  0.1361553981 -0.118059479\n",
      "subject59   0.095455829  0.061409633  0.066158607 -0.1123746318  0.013860252\n",
      "subject60   0.217960959 -0.161764979 -0.045802443 -0.1423415639 -0.076198063\n",
      "subject61   0.051603467 -0.036894560 -0.022201099  0.1273570742 -0.055863520\n",
      "subject62   0.222677701 -0.159208410 -0.049054713 -0.0674252822  0.064644548\n",
      "subject63  -0.044901212 -0.111192877 -0.129100070  0.0027564383 -0.032462170\n",
      "subject64   0.500058785  0.013753890 -0.255887318 -0.2318415781  0.409561805\n",
      "subject65  -0.124222358 -0.136270938  0.135634561 -0.0540689175  0.129152860\n",
      "subject66  -0.379216016 -0.232544526  0.250088520 -0.1908379569  0.053404037\n",
      "subject67  -0.076461648 -0.010110478  0.045686733  0.0277020963  0.080121378\n",
      "subject68   0.164055786 -0.098763381 -0.182399430  0.0144437568 -0.135614125\n",
      "subject69  -0.079557506  0.133005192  0.210474761  0.0356557328 -0.122668496\n",
      "subject70  -0.193824712 -0.003820219  0.012476358  0.0473446308  0.088661105\n",
      "subject71   0.286824936  0.168787823  0.081325339 -0.0596225823  0.043116340\n",
      "subject72   0.069640416 -0.088747070  0.047157744  0.0688290303 -0.203251914\n",
      "subject73  -0.015826824  0.029457231 -0.103687531  0.0233830453  0.013345101\n",
      "subject74   0.473298126  0.053182757 -0.101742589 -0.1950247687  0.003410624\n",
      "subject75  -0.210421131  0.282141875  0.138184970 -0.1423715328  0.005149426\n",
      "subject76   0.125020309 -0.247179038 -0.141479027 -0.1450587203 -0.118514754\n",
      "subject77   0.130389949  0.042774772 -0.182330411  0.0875370943 -0.230943129\n",
      "subject78   0.068672808  0.170619701 -0.130795950  0.2250514472 -0.058582691\n",
      "subject79  -0.328524961  0.210135098  0.008863878 -0.1911564342  0.024015915\n",
      "subject80  -0.095809255 -0.055590045  0.031929293  0.0217299517  0.001010701\n",
      "subject81   0.260733745  0.171127244  0.048117526  0.1419551407  0.167074180\n",
      "subject82  -0.136835024 -0.134988782  0.184618242 -0.1379254530  0.151334001\n",
      "subject83  -0.055041534  0.298466563 -0.043152473  0.0697841421  0.062840926\n",
      "subject84   0.053344480  0.078484729 -0.056796655 -0.0031438732 -0.255918037\n",
      "subject85  -0.093239763  0.029301281 -0.106782368  0.0836195597 -0.016232928\n",
      "subject86  -0.213279840  0.002349685 -0.138282070  0.0328068263 -0.036380892\n",
      "subject87  -0.097703326 -0.015676309  0.156453234 -0.0203886958 -0.177227533\n",
      "subject88   0.181105495  0.110829521  0.244295694  0.0699982015  0.195790279\n",
      "subject89   0.088550607  0.074659343  0.072658776 -0.0131414793  0.142865901\n",
      "subject90   0.111185160 -0.374737809  0.372786719  0.2175164061  0.156073099\n",
      "subject91  -0.063241156 -0.035320425  0.147811183 -0.0950638683 -0.074931190\n",
      "subject92   0.032442412 -0.101095705  0.056549284  0.0915908694  0.251762188\n",
      "subject93  -0.193185856  0.021395882 -0.200418861 -0.0345433971 -0.091650678\n",
      "subject94   0.129775936  0.002394459  0.161781268  0.0519052471 -0.006700779\n",
      "subject95  -0.205438321 -0.075315520 -0.258885805  0.0732863894 -0.147775141\n",
      "subject96  -0.148701488 -0.007105358 -0.115993108  0.0341610297  0.028430958\n",
      "subject97  -0.129739813 -0.077809413 -0.005543718  0.0545460024  0.221063529\n",
      "subject98   0.008835134 -0.091502037  0.116944653  0.2076298016 -0.258801698\n",
      "subject99  -0.072723416 -0.007263865 -0.302585519  0.0525258812 -0.070646477\n",
      "subject100 -0.054739884  0.175063171  0.017107780 -0.0267241288  0.061461970\n"
     ]
    }
   ],
   "source": [
    "out2 <- testrunfactorization(\"../data/simulations_20210329212141/equal/5\", paste0(\"omics\",1:3,\".txt\"), 10, sep=\"\\t\", filtering=\"none\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1]]\n",
      "[[1]][[1]]\n",
      "                 comp1         comp2        comp3       comp4        comp5\n",
      "subject1   -0.66795710 -0.1975975691 -0.300867807 -0.27752304  0.046597119\n",
      "subject2    0.34576508 -0.2629359330  0.241120840 -0.28930964 -0.084342734\n",
      "subject3   -0.18025509 -0.0176580168  0.248585176  0.28288886 -0.563893934\n",
      "subject4    0.36050703 -0.1890522412 -0.408620222  0.17398881 -0.043598118\n",
      "subject5    0.35911618 -0.3781877286  0.258566999 -0.36205334  0.226873122\n",
      "subject6    0.28325320 -0.1622556746  0.181241457 -0.21227011 -0.559915019\n",
      "subject7   -0.11612513  0.0788346274  0.220124930  0.33526312 -0.408510876\n",
      "subject8   -0.07780757 -0.0141900772  0.335851483  0.28675003 -0.508347353\n",
      "subject9    0.23910572 -0.1559110417 -0.458080182  0.26396763 -0.191666676\n",
      "subject10   0.29560944 -0.1561401151  0.260168096 -0.14995656 -0.479010526\n",
      "subject11  -0.48458731 -0.0735627161 -0.102832592 -0.12385138 -0.621762842\n",
      "subject12  -0.40942839 -0.1172649178 -0.123315575 -0.13509267 -0.508532015\n",
      "subject13  -0.19549696 -0.0472492050  0.451490816  0.50806521 -0.123621935\n",
      "subject14   0.39955927 -0.2851241355  0.271590149 -0.31162352  0.072921505\n",
      "subject15   0.32758984 -0.2064551003 -0.653680908  0.34347063  0.560935168\n",
      "subject16   0.30672961 -0.1742978200  0.213687656 -0.20118681 -0.315973999\n",
      "subject17  -0.34042109  0.0094594151  0.498483605  0.42013004  0.375227744\n",
      "subject18   0.40118542 -0.2734121639  0.251444907 -0.24741560 -0.035026155\n",
      "subject19   0.37087343 -0.2281502347  0.227306543 -0.13034463 -0.294658628\n",
      "subject20   0.33360340 -0.2361817170  0.369069661 -0.26769134  0.022237249\n",
      "subject21  -0.52471917 -0.1427221966 -0.160799669 -0.21163478 -0.034265692\n",
      "subject22  -0.69679088 -0.1816307996 -0.190834122 -0.28495996  0.012379644\n",
      "subject23   0.12198428  0.9913928035 -0.044774322 -0.13749865  0.118102528\n",
      "subject24  -0.15083689 -0.0048478563  0.355681978  0.39781971 -0.290817913\n",
      "subject25   0.37459760 -0.2149748122  0.333619860 -0.32522255  0.050167823\n",
      "subject26   0.40536926 -0.3524025172  0.341182290 -0.31587600  0.569370103\n",
      "subject27   0.11113972  1.2053399506 -0.164090254 -0.19666250  0.737646931\n",
      "subject28  -0.26649175 -0.0039560291  0.373027247  0.46078534 -0.088915510\n",
      "subject29   0.13245557  0.9972172785 -0.180399738 -0.18447479  0.036228901\n",
      "subject30   0.04381088 -0.0209174788  0.230704944  0.27547222 -0.819244333\n",
      "subject31  -0.42005698 -0.1287161305 -0.155971367 -0.15704278 -0.372743880\n",
      "subject32  -0.20348204  0.0009880961  0.299796328  0.32610320 -0.360080596\n",
      "subject33   0.28535050 -0.2713312474 -0.500023051  0.36026331  0.222183508\n",
      "subject34   0.36639250 -0.2101325265 -0.489283192  0.30912583  0.088598721\n",
      "subject35   0.40052578 -0.2974581772  0.255015971 -0.45895052  0.290803574\n",
      "subject36   0.32790701 -0.1703322633  0.240954041 -0.07700836 -0.524146348\n",
      "subject37  -0.61693839 -0.0942186029 -0.177411533 -0.18328804 -0.247984667\n",
      "subject38  -0.23920350  0.0260360668  0.395750936  0.45292016  0.083874166\n",
      "subject39  -0.41820019  0.0546330698  0.603785400  0.64903814  1.044504163\n",
      "subject40  -0.70401354 -0.1581552091 -0.280909078 -0.21301229 -0.018808455\n",
      "subject41   0.13214984  0.6871584180 -0.016649327 -0.03980170 -0.148488390\n",
      "subject42   0.38114498 -0.2299476492  0.154361399 -0.30505595 -0.226334074\n",
      "subject43   0.29988888 -0.2001701560 -0.431435212  0.31410946 -0.131627216\n",
      "subject44   0.25168987 -0.0954950718 -0.322214740  0.18270367 -0.469802161\n",
      "subject45  -0.32035124  0.0046356596  0.477170403  0.47590852  0.234729477\n",
      "subject46   0.41149062 -0.4124026217  0.275973912 -0.41554365  0.502762300\n",
      "subject47   0.33933161 -0.1961931092  0.165805850 -0.22897229 -0.350842819\n",
      "subject48   0.32737821 -0.0920039617 -0.230312555  0.17569330 -0.632712306\n",
      "subject49  -0.62112071 -0.0938839090 -0.075833583 -0.18950765 -0.262536893\n",
      "subject50   0.39773655 -0.2355097842 -0.639536514  0.36126441  0.572461179\n",
      "subject51   0.12040917  0.7432439531 -0.018828592 -0.12949232 -0.079918547\n",
      "subject52   0.29100778 -0.2047539625 -0.592615932  0.33531966  0.255890133\n",
      "subject53   0.14404575  0.8066309601 -0.028532983 -0.13038362 -0.167896287\n",
      "subject54   0.43806126 -0.2719940971 -0.666439000  0.27156816  0.468453204\n",
      "subject55   0.16338689  0.7534885853 -0.046822843 -0.14356642 -0.258904701\n",
      "subject56  -0.54330671 -0.1888214867 -0.182831910 -0.17865797 -0.066583743\n",
      "subject57   0.38319068 -0.3144127998  0.270625410 -0.28931411  0.236546652\n",
      "subject58  -0.65351047 -0.1274028816 -0.195864111 -0.21498599  0.006272390\n",
      "subject59   0.27531783 -0.0800134576 -0.242423159  0.15085070 -0.645005862\n",
      "subject60   0.29125858 -0.1328721023 -0.369428039  0.25297635 -0.433646048\n",
      "subject61  -0.78060876 -0.2821848066 -0.185503052 -0.21796513  0.072287754\n",
      "subject62  -0.85465449 -0.1673919058 -0.303664385 -0.31019783  0.266539258\n",
      "subject63  -0.16479915 -0.0090984830  0.356200241  0.39062847 -0.183072327\n",
      "subject64   0.04786201  1.1937650392 -0.043303979 -0.19370464  0.250076084\n",
      "subject65   0.30532165 -0.1704268507 -0.358892836  0.27005600 -0.249180710\n",
      "subject66   0.37707053 -0.1771229460 -0.454937274  0.24098709  0.062682104\n",
      "subject67  -0.22037895  0.0177286001  0.417926483  0.36863521  0.071323646\n",
      "subject68   0.39512069 -0.2366673774  0.216649037 -0.29284511  0.008576342\n",
      "subject69   0.12827505  0.8567863582 -0.013746448 -0.11409165  0.081832362\n",
      "subject70   0.15024314  0.7453052610  0.005392764 -0.06270430 -0.173802527\n",
      "subject71  -0.28791437  0.0203331599  0.466262963  0.45433729  0.072583937\n",
      "subject72  -0.32868728 -0.0338625503  0.415598533  0.43109624 -0.025039045\n",
      "subject73   0.30380123 -0.2405506953  0.229286741 -0.25038761 -0.240826397\n",
      "subject74   0.28413695 -0.2080696476 -0.594344920  0.37635640  0.259888196\n",
      "subject75  -1.01616042 -0.2629562915 -0.356372272 -0.49848437  0.628756397\n",
      "subject76   0.24568194 -0.1835798153 -0.443551837  0.35915120  0.026318724\n",
      "subject77  -0.27789916 -0.0048473473  0.345856825  0.39243126 -0.234121870\n",
      "subject78   0.38427805 -0.2223340178 -0.656837020  0.25087347  0.354163259\n",
      "subject79  -0.39981804 -0.0196969046  0.584051104  0.53694953  1.134921916\n",
      "subject80   0.27705694 -0.1080970749 -0.386685037  0.24076333 -0.241880315\n",
      "subject81   0.31335961 -0.2561279021 -0.682036273  0.35385352  0.453455172\n",
      "subject82  -0.43985970 -0.1495504622 -0.095994877 -0.20146180 -0.264895053\n",
      "subject83   0.44732835 -0.2583292762  0.202537607 -0.26059137 -0.098211699\n",
      "subject84   0.39698952 -0.3499256864  0.325258636 -0.40885985  0.289307634\n",
      "subject85  -0.75136801 -0.1232615110 -0.231802292 -0.26259688 -0.074211961\n",
      "subject86   0.12936870  0.8954234066 -0.093754585 -0.13571839  0.105100811\n",
      "subject87   0.35678871 -0.2465073482  0.249338939 -0.29102546 -0.027625860\n",
      "subject88   0.45373993 -0.2961290693  0.331510086 -0.41422877  0.355016508\n",
      "subject89  -0.55235599 -0.0882347574 -0.133777889 -0.24414535 -0.415535261\n",
      "subject90   0.39405941 -0.3377337316  0.432651264 -0.28667185  0.678702952\n",
      "subject91  -0.91228550 -0.1851716392 -0.320023754 -0.44279513  0.559760637\n",
      "subject92  -0.59550423 -0.1053352454 -0.159220342 -0.25166634 -0.258521010\n",
      "subject93  -0.40457224  0.0165940814  0.477644984  0.57539863  0.640072913\n",
      "subject94  -0.18494150  0.0596899207  0.354371616  0.41316953 -0.272703209\n",
      "subject95  -0.71579607 -0.1496541724 -0.296889784 -0.28595335  0.138126582\n",
      "subject96   0.21892346  0.5690727182 -0.064691902 -0.10351738 -0.497977461\n",
      "subject97   0.09944305  0.8931895607 -0.037956288 -0.10140124  0.008295167\n",
      "subject98   0.14312408  0.8875227295 -0.014458296 -0.12274998  0.103570903\n",
      "subject99   0.47719454 -0.3540176751  0.237126518 -0.39867246  0.707972555\n",
      "subject100  0.16961816  1.0156947761 -0.069745172 -0.14946591  0.462672836\n",
      "                  comp6        comp7        comp8         comp9       comp10\n",
      "subject1   -0.120527756  0.089269771 -0.097534334 -0.1702471985 -0.193372267\n",
      "subject2    0.004226896  0.213313895  0.056469727 -0.0621672992 -0.082684709\n",
      "subject3   -0.009572400 -0.050562396 -0.177692353  0.0132125699 -0.030125332\n",
      "subject4   -0.233439107 -0.004897228 -0.042481797 -0.0431395365  0.042920360\n",
      "subject5   -0.101725554  0.152754911 -0.064126811 -0.1048910435 -0.026664461\n",
      "subject6   -0.121315872  0.065821450 -0.133365238 -0.0471982522  0.047490306\n",
      "subject7   -0.074883798  0.073023859 -0.251574325  0.0015331721 -0.034307365\n",
      "subject8    0.031263663  0.232016560  0.064997932  0.1407648072  0.020675983\n",
      "subject9   -0.002449634 -0.048508331 -0.137655422  0.0621313298 -0.199873772\n",
      "subject10  -0.007289828  0.050208836  0.092218099 -0.0833417404 -0.003616362\n",
      "subject11   0.281516652 -0.073907960 -0.191225455  0.0756521635 -0.015227249\n",
      "subject12   0.063767411  0.115550550  0.036992505 -0.0671939782 -0.047665225\n",
      "subject13   0.186032236 -0.107735814  0.184641855  0.0231450173 -0.120664078\n",
      "subject14  -0.040851876 -0.119457601  0.082474195 -0.1878446686 -0.232646964\n",
      "subject15   0.116922471 -0.058805510  0.040698173  0.2085556488 -0.059526824\n",
      "subject16   0.032427895 -0.118124461 -0.042078403 -0.1077030778 -0.031625451\n",
      "subject17  -0.107272283  0.128840560  0.066709982  0.0013035855  0.015980911\n",
      "subject18   0.061674579 -0.142786799 -0.107827346  0.0452381083 -0.131811646\n",
      "subject19  -0.190428102 -0.045703612  0.064201058  0.0464326957  0.142239436\n",
      "subject20   0.398324754 -0.095815790  0.037435264 -0.0224074519 -0.018019439\n",
      "subject21  -0.039471884 -0.204420196 -0.018540301  0.1214560737  0.149521584\n",
      "subject22   0.218295455  0.107811873  0.194562543  0.1544748606 -0.006001307\n",
      "subject23   0.022706959 -0.118780292 -0.121719736  0.1713794660  0.013766617\n",
      "subject24  -0.179755278 -0.055944043  0.139511528  0.0102685184  0.111178009\n",
      "subject25   0.042279315  0.140621811 -0.033915933  0.0953615318  0.136970022\n",
      "subject26   0.011192978 -0.046892582 -0.126118130  0.0760056899  0.089159417\n",
      "subject27  -0.282658351 -0.203976896  0.059147532 -0.1742293933  0.003661646\n",
      "subject28   0.230634472 -0.063020205 -0.112998976 -0.1153263994  0.010407902\n",
      "subject29   0.303270120  0.013229247 -0.035605017 -0.1182645049  0.019351448\n",
      "subject30  -0.204927862  0.079252447  0.073391621  0.0608968098  0.056732799\n",
      "subject31  -0.130193659 -0.017482579 -0.020319186 -0.0009300793 -0.044918815\n",
      "subject32  -0.262863803  0.066727212 -0.248598758  0.0007732203  0.181997022\n",
      "subject33  -0.029974181  0.059840851  0.004518458 -0.0768388919 -0.009395006\n",
      "subject34   0.083727237  0.182907119  0.045898338  0.0244726561  0.056318036\n",
      "subject35  -0.078730564  0.117345006  0.003569678 -0.0172958409  0.164834429\n",
      "subject36  -0.088932807  0.001377762  0.144625497 -0.0125983414 -0.037551815\n",
      "subject37   0.103515073  0.166386767 -0.113779725  0.0567002461  0.005822713\n",
      "subject38  -0.125644886 -0.137872500 -0.045275334  0.0257804707  0.062144121\n",
      "subject39   0.143571363 -0.007869125  0.123370419 -0.0031550389 -0.033781297\n",
      "subject40  -0.017339043 -0.126717478 -0.146898137 -0.0990836451 -0.022792638\n",
      "subject41  -0.022995977 -0.007088292  0.264648880  0.0458398718 -0.302084998\n",
      "subject42  -0.217904116  0.022873660  0.065336995 -0.0711811434  0.066586917\n",
      "subject43  -0.102858073  0.045970091 -0.027778070  0.0126378802  0.231109562\n",
      "subject44  -0.116098461  0.003005239  0.074544873 -0.0992129050  0.185484635\n",
      "subject45   0.126593041 -0.137645284  0.015837232 -0.0141721418  0.211804220\n",
      "subject46   0.179509605 -0.064698501 -0.124951489 -0.1077195467  0.057652405\n",
      "subject47  -0.145083949 -0.105387685 -0.092561808 -0.0439197410 -0.060264144\n",
      "subject48   0.064277420  0.108670700  0.182984821 -0.0643780823 -0.027975377\n",
      "subject49   0.129844116  0.018010073  0.061036795  0.0256026094  0.198502142\n",
      "subject50  -0.359814235 -0.039325659 -0.278097413  0.1412902457  0.023430785\n",
      "subject51   0.136465798  0.169683506  0.030153683 -0.0612677201 -0.231784599\n",
      "subject52   0.105356641  0.059267826  0.235461063 -0.1427750397 -0.298113788\n",
      "subject53  -0.016649505  0.066025352 -0.026913898  0.1226367714 -0.073002141\n",
      "subject54  -0.009989079  0.027507846  0.088106911  0.1344099481  0.134375588\n",
      "subject55   0.099860055 -0.007823125  0.108892819  0.0296759495 -0.100682449\n",
      "subject56  -0.016761808 -0.098842416  0.188934511  0.0218956686 -0.054346941\n",
      "subject57   0.086342593 -0.111257838 -0.145133472  0.0327387862  0.010680016\n",
      "subject58  -0.064192065 -0.022402684  0.099209919  0.1361553981 -0.118059479\n",
      "subject59   0.095455829  0.061409633  0.066158607 -0.1123746318  0.013860252\n",
      "subject60   0.217960959 -0.161764979 -0.045802443 -0.1423415639 -0.076198063\n",
      "subject61   0.051603467 -0.036894560 -0.022201099  0.1273570742 -0.055863520\n",
      "subject62   0.222677701 -0.159208410 -0.049054713 -0.0674252822  0.064644548\n",
      "subject63  -0.044901212 -0.111192877 -0.129100070  0.0027564383 -0.032462170\n",
      "subject64   0.500058785  0.013753890 -0.255887318 -0.2318415781  0.409561805\n",
      "subject65  -0.124222358 -0.136270938  0.135634561 -0.0540689175  0.129152860\n",
      "subject66  -0.379216016 -0.232544526  0.250088520 -0.1908379569  0.053404037\n",
      "subject67  -0.076461648 -0.010110478  0.045686733  0.0277020963  0.080121378\n",
      "subject68   0.164055786 -0.098763381 -0.182399430  0.0144437568 -0.135614125\n",
      "subject69  -0.079557506  0.133005192  0.210474761  0.0356557328 -0.122668496\n",
      "subject70  -0.193824712 -0.003820219  0.012476358  0.0473446308  0.088661105\n",
      "subject71   0.286824936  0.168787823  0.081325339 -0.0596225823  0.043116340\n",
      "subject72   0.069640416 -0.088747070  0.047157744  0.0688290303 -0.203251914\n",
      "subject73  -0.015826824  0.029457231 -0.103687531  0.0233830453  0.013345101\n",
      "subject74   0.473298126  0.053182757 -0.101742589 -0.1950247687  0.003410624\n",
      "subject75  -0.210421131  0.282141875  0.138184970 -0.1423715328  0.005149426\n",
      "subject76   0.125020309 -0.247179038 -0.141479027 -0.1450587203 -0.118514754\n",
      "subject77   0.130389949  0.042774772 -0.182330411  0.0875370943 -0.230943129\n",
      "subject78   0.068672808  0.170619701 -0.130795950  0.2250514472 -0.058582691\n",
      "subject79  -0.328524961  0.210135098  0.008863878 -0.1911564342  0.024015915\n",
      "subject80  -0.095809255 -0.055590045  0.031929293  0.0217299517  0.001010701\n",
      "subject81   0.260733745  0.171127244  0.048117526  0.1419551407  0.167074180\n",
      "subject82  -0.136835024 -0.134988782  0.184618242 -0.1379254530  0.151334001\n",
      "subject83  -0.055041534  0.298466563 -0.043152473  0.0697841421  0.062840926\n",
      "subject84   0.053344480  0.078484729 -0.056796655 -0.0031438732 -0.255918037\n",
      "subject85  -0.093239763  0.029301281 -0.106782368  0.0836195597 -0.016232928\n",
      "subject86  -0.213279840  0.002349685 -0.138282070  0.0328068263 -0.036380892\n",
      "subject87  -0.097703326 -0.015676309  0.156453234 -0.0203886958 -0.177227533\n",
      "subject88   0.181105495  0.110829521  0.244295694  0.0699982015  0.195790279\n",
      "subject89   0.088550607  0.074659343  0.072658776 -0.0131414793  0.142865901\n",
      "subject90   0.111185160 -0.374737809  0.372786719  0.2175164061  0.156073099\n",
      "subject91  -0.063241156 -0.035320425  0.147811183 -0.0950638683 -0.074931190\n",
      "subject92   0.032442412 -0.101095705  0.056549284  0.0915908694  0.251762188\n",
      "subject93  -0.193185856  0.021395882 -0.200418861 -0.0345433971 -0.091650678\n",
      "subject94   0.129775936  0.002394459  0.161781268  0.0519052471 -0.006700779\n",
      "subject95  -0.205438321 -0.075315520 -0.258885805  0.0732863894 -0.147775141\n",
      "subject96  -0.148701488 -0.007105358 -0.115993108  0.0341610297  0.028430958\n",
      "subject97  -0.129739813 -0.077809413 -0.005543718  0.0545460024  0.221063529\n",
      "subject98   0.008835134 -0.091502037  0.116944653  0.2076298016 -0.258801698\n",
      "subject99  -0.072723416 -0.007263865 -0.302585519  0.0525258812 -0.070646477\n",
      "subject100 -0.054739884  0.175063171  0.017107780 -0.0267241288  0.061461970\n",
      "\n",
      "[[1]][[2]]\n",
      "[[1]][[2]][[1]]\n",
      "                       1             2             3             4\n",
      "cg20139214 -1.998182e-01 -0.0214569130 -0.1050743144 -0.1340864385\n",
      "cg10999429  2.436173e-02  0.0117950961 -0.0116255213 -0.0008131201\n",
      "cg23640701  1.305839e-02 -0.0278297573  0.0030397937 -0.0147799394\n",
      "cg02956093 -3.315323e-02  0.0281695761 -0.0019699719 -0.0037421399\n",
      "cg08711674 -2.217898e-01 -0.0411499187  0.0860261728  0.0705078954\n",
      "cg09842540 -1.805685e-01 -0.0204251895 -0.0840965191 -0.1112591752\n",
      "cg11739626  1.618832e-01 -0.1127695984 -0.0569626305 -0.0329293044\n",
      "cg19073614 -3.848398e-02 -0.0827814612  0.0192287044 -0.2494513225\n",
      "cg01894895  1.367579e-01 -0.0631459179  0.0547535150 -0.1318915388\n",
      "cg01086868  1.629820e-02  0.2096644512 -0.0367409556 -0.0490403101\n",
      "cg04755662  1.265591e-01 -0.0849238280  0.0814143068 -0.1332677954\n",
      "cg05019001  8.596026e-04 -0.0276692660 -0.0133722345  0.0112721664\n",
      "cg05786601 -1.786337e-01 -0.0333525566 -0.1026860373 -0.1273420694\n",
      "cg07780118  3.064776e-02  0.1897745726 -0.0208630198 -0.0336585121\n",
      "cg12589433  5.009120e-02  0.2113016371 -0.0403342162 -0.0775475921\n",
      "cg14807303 -5.689657e-02  0.0711259928 -0.2495637414 -0.0294008212\n",
      "cg16679837 -8.976965e-02  0.0523592622  0.1593712385 -0.1265128601\n",
      "cg20878850  6.184810e-02 -0.0646328090 -0.1662740502  0.1149602411\n",
      "cg21966410 -8.458515e-02 -0.0893072781 -0.2358558718  0.0132879277\n",
      "cg27271368  1.312689e-01 -0.1612754559  0.0658534658  0.1454312102\n",
      "cg04283377  1.572627e-02 -0.0027684147 -0.0165752909  0.0522837506\n",
      "cg10455133 -1.890420e-01 -0.0359625127  0.0386907512  0.0865264737\n",
      "cg01245656 -1.840544e-01  0.1037613386  0.0629446809  0.0486359927\n",
      "cg14785449 -1.960222e-01 -0.0210067044 -0.0993539149 -0.1230358187\n",
      "cg01800843  1.842359e-01  0.0269339931 -0.0530040309 -0.0746342593\n",
      "cg03165700 -1.784032e-01 -0.0168573914 -0.0909093841 -0.1118593550\n",
      "cg18457775  6.739214e-02 -0.0655234113 -0.1676469258  0.1307786785\n",
      "cg22477592 -4.740641e-02 -0.0737514931  0.0113900755 -0.2245804122\n",
      "cg24027342  8.882959e-02 -0.0900769343 -0.1651967300  0.0995918948\n",
      "cg00925229  3.610238e-02  0.2464215712 -0.0211853152 -0.0526340880\n",
      "cg07588779 -9.022292e-05 -0.0280726756  0.0087570604  0.0001292806\n",
      "cg13620770 -9.065881e-03 -0.0035174072  0.0342894233 -0.0054209452\n",
      "cg07679836 -6.766326e-02 -0.0396612814  0.1703493475  0.2160478691\n",
      "cg14666892 -1.471954e-02 -0.0033786208  0.0496468774 -0.0162737329\n",
      "cg22753768 -1.041897e-01 -0.1099092249  0.1672774178 -0.0932874003\n",
      "cg24747396  1.866957e-01 -0.1224264471 -0.0580966960 -0.0424592983\n",
      "cg14833160 -5.201762e-02 -0.0348700686  0.0030904223 -0.0001325541\n",
      "cg15951107  2.984169e-02  0.2315055988 -0.0171939602 -0.0424804457\n",
      "cg01803238  1.582203e-01 -0.1116372246 -0.0362645185 -0.0303896218\n",
      "cg03813215 -3.252602e-02  0.0076383403  0.0183964210 -0.0163683599\n",
      "cg08223235 -1.355856e-01 -0.1213929267 -0.0800035497  0.1784682354\n",
      "cg08554462 -2.079760e-02  0.0075560047  0.0201175658  0.0068589937\n",
      "cg09752703  9.048428e-02  0.1193918498 -0.1753183809  0.0810995300\n",
      "cg11255230 -1.374272e-01 -0.0892909459 -0.0439696552  0.1671354990\n",
      "cg11330108  1.531043e-02 -0.1307471024 -0.1452693557 -0.1258570602\n",
      "cg12459502  1.150659e-01 -0.0723245040  0.0287363935 -0.1285489334\n",
      "cg14455307  3.992597e-02 -0.0781812582  0.2049237630  0.0372688142\n",
      "cg17602451 -3.471746e-02 -0.0722287966  0.0110837104 -0.2110211348\n",
      "cg21602520  8.369835e-03 -0.0581420774 -0.0161931713 -0.0038580935\n",
      "cg23756272  2.553128e-02 -0.0548722143 -0.0800428908 -0.0257682179\n",
      "cg25059899  6.145889e-02 -0.0440103563 -0.1473016768  0.0366329284\n",
      "cg00782854 -1.609597e-02  0.0051941460  0.0007177902  0.0168716345\n",
      "cg16137862 -1.017091e-01 -0.0702187361 -0.2151085281  0.0125138733\n",
      "cg27608154  4.485358e-02  0.1301531066 -0.0166941485 -0.0428101556\n",
      "cg16225441  1.591144e-02 -0.0262436927 -0.0059459751  0.0313368250\n",
      "cg26709863 -3.623720e-02 -0.0489914094  0.1628769103  0.1942529352\n",
      "cg05566965 -2.100117e-02 -0.0186868401  0.0634978308  0.0027788870\n",
      "cg03148461 -2.045014e-01 -0.0190397393 -0.0912175189 -0.1249560221\n",
      "cg10141022 -6.865888e-02 -0.0717018423 -0.2151127357  0.0287095947\n",
      "cg11414046 -2.198245e-02 -0.0028140721  0.0042863282  0.0356729568\n",
      "cg14094063  1.237665e-01 -0.0709845609  0.1107100278 -0.1542230717\n",
      "cg17095753 -2.596851e-02 -0.0298739810  0.0199483322  0.0665652234\n",
      "cg21043558 -4.937191e-02 -0.0901378852  0.0201336245 -0.2447650058\n",
      "cg23066879 -7.023439e-02 -0.0347972166  0.1838574760  0.2077950846\n",
      "cg12836863  2.299353e-02 -0.0109319147 -0.0262541705  0.0097736080\n",
      "cg27253386 -3.717562e-02  0.1150073223  0.1411597732  0.1479508511\n",
      "cg22906389  7.021167e-02 -0.0652406967 -0.1718132131  0.1271219168\n",
      "cg04677163  9.166773e-04 -0.0202540212  0.0387159096  0.0027456764\n",
      "cg07964538  7.213909e-02 -0.0642885687 -0.1714185641  0.1310378257\n",
      "cg17469978 -2.533875e-02 -0.0249445671 -0.0028036921  0.0452127574\n",
      "cg18329349  1.363163e-01 -0.0860267268  0.1277136248 -0.1794072613\n",
      "cg22126032 -3.737478e-02  0.1401891187  0.1415643068  0.1425821720\n",
      "cg27242945 -3.692249e-03  0.0005167594  0.0062475594  0.0098697454\n",
      "cg13849825  7.635998e-02  0.1617125530 -0.0903083547 -0.0303523290\n",
      "cg23935746  3.658103e-02  0.2113897330 -0.0167199391 -0.0523549962\n",
      "cg00858899  1.359960e-01 -0.0813369222  0.1177217202 -0.1641196252\n",
      "cg00953256  5.426032e-02  0.1159419230  0.0176062741  0.0169889218\n",
      "cg02723533 -4.761620e-04 -0.1083395596 -0.0358727059 -0.0186385110\n",
      "cg04717045 -7.906173e-02 -0.1417306408  0.1509377367 -0.0466492452\n",
      "cg05164185  1.473396e-02 -0.1157737652 -0.1217653545 -0.1048328146\n",
      "cg05200606  1.020154e-01  0.1379524317 -0.1982444864  0.0848712982\n",
      "cg06539449  3.649220e-02  0.0015292001  0.0042385830  0.0137989482\n",
      "cg08170622  1.627275e-01 -0.1064622597 -0.0398413760 -0.0388536139\n",
      "cg09637363  5.532293e-03  0.0095832033  0.0419885944  0.0031970005\n",
      "cg10539418 -2.163660e-01 -0.0542200827  0.0818440658  0.0804101886\n",
      "cg11802013  1.506523e-01 -0.1159202925  0.0003023888  0.0315859408\n",
      "cg12266049  3.348925e-02 -0.0094300381  0.0301865236 -0.0030378946\n",
      "cg13608094 -7.156075e-02  0.0921365265 -0.0577862535 -0.0888700686\n",
      "cg16794682  1.415216e-01 -0.0350973892  0.1075894878 -0.1343804251\n",
      "cg19047670  3.842232e-02 -0.0117361139  0.0645675212  0.0428203709\n",
      "cg25060573  8.181338e-02 -0.0692594126 -0.2010767752  0.1514946483\n",
      "cg26605086 -1.661809e-01  0.0873054613  0.0564355645  0.0421194588\n",
      "cg12187567 -1.837935e-01 -0.0172248186 -0.0959742410 -0.1201402068\n",
      "cg16328273  3.293909e-02  0.2292614196 -0.0214804271 -0.0461673800\n",
      "cg11255163  6.269549e-04  0.0459358658  0.0260376404  0.0190380024\n",
      "cg11667754  3.595623e-02  0.2250716540 -0.0090028243 -0.0501089110\n",
      "cg17655614 -2.033407e-01 -0.0217101645 -0.0940529132 -0.1367491679\n",
      "cg20716119 -7.206442e-04  0.0185698571  0.0310857854 -0.0042302835\n",
      "cg22832044  2.208774e-02  0.2381400411 -0.0079094293 -0.0389560226\n",
      "cg23989635  3.642093e-02  0.2453521061 -0.0158799620 -0.0497458958\n",
      "                       5            6            7             8             9\n",
      "cg20139214  1.191702e-02 -0.033407743 -0.003471416  0.0446939060  1.891871e-02\n",
      "cg10999429  1.335283e-01 -0.240681344 -0.101276210  0.2021944023 -2.131737e-03\n",
      "cg23640701 -1.194878e-02 -0.217273447 -0.226365260  0.0751636367 -7.110590e-02\n",
      "cg02956093  1.164428e-01  0.022486468  0.035403918  0.3189389677  2.869513e-01\n",
      "cg08711674 -2.645669e-02  0.034832812 -0.016647198  0.0238948367  3.553509e-02\n",
      "cg09842540  4.951281e-02 -0.031115396 -0.000727749  0.0623103909 -3.264866e-02\n",
      "cg11739626  1.875304e-02 -0.075092294  0.020346789  0.0040866819 -1.245343e-01\n",
      "cg19073614  6.182635e-02  0.020040327 -0.032070394 -0.0169291668  1.605448e-02\n",
      "cg01894895 -8.616114e-02 -0.189528662 -0.113759898 -0.0254973048  4.950709e-02\n",
      "cg01086868 -3.354395e-02 -0.063951860  0.097514088 -0.1243207940 -6.075905e-02\n",
      "cg04755662  1.981694e-02 -0.123232250  0.042776517 -0.1605932084 -6.304571e-02\n",
      "cg05019001  2.681751e-03 -0.056481365  0.048232845 -0.4779714517  2.548833e-01\n",
      "cg05786601 -4.690777e-02  0.013944403  0.129799810 -0.1123544069 -7.634561e-02\n",
      "cg07780118  1.453806e-02 -0.065142820 -0.080440692 -0.1923455430  2.419407e-01\n",
      "cg12589433  1.832834e-02 -0.090876259 -0.105970756 -0.1279930418  1.206163e-01\n",
      "cg14807303  7.783294e-03 -0.072911108 -0.044233078 -0.1321493318 -1.265950e-01\n",
      "cg16679837 -9.362176e-03 -0.059888433  0.141617524 -0.1913580874  1.455272e-02\n",
      "cg20878850  3.046833e-02  0.054161903  0.128873257 -0.0396368846 -7.237014e-02\n",
      "cg21966410 -9.055733e-04 -0.056256693 -0.098265425 -0.0823488303  9.258363e-02\n",
      "cg27271368 -1.742610e-03 -0.024868292  0.115593207 -0.0507072518 -1.628798e-01\n",
      "cg04283377  1.139233e-01 -0.287077102 -0.182316035 -0.2143486609 -3.577434e-02\n",
      "cg10455133 -1.087826e-02 -0.031771810 -0.106386666 -0.1135176432 -3.771122e-03\n",
      "cg01245656  7.031830e-02 -0.052145260  0.096125122  0.0335975727 -7.354223e-02\n",
      "cg14785449  2.883297e-02 -0.055099514  0.037995022  0.0121524381  5.663338e-03\n",
      "cg01800843  8.897752e-02  0.084867854  0.162337713 -0.0328868547  1.036175e-01\n",
      "cg03165700  4.901269e-02 -0.040870832  0.030056579  0.1010467289 -2.274887e-02\n",
      "cg18457775  7.242332e-02  0.114980017  0.053457728 -0.0756766324  1.460930e-01\n",
      "cg22477592  7.090544e-02 -0.039995660 -0.038281359  0.0118869942  8.362138e-02\n",
      "cg24027342 -2.171981e-02 -0.008935301 -0.085700969 -0.1247162903 -1.422637e-01\n",
      "cg00925229  7.086529e-02 -0.005252184  0.004217532  0.0501280012 -1.690612e-02\n",
      "cg07588779  2.160107e-01 -0.127731976  0.043987822 -0.0213600893  2.465827e-01\n",
      "cg13620770  1.925315e-01 -0.015342840 -0.211068265  0.1155278043  7.872970e-02\n",
      "cg07679836 -2.923217e-02 -0.093044053 -0.163675764  0.0195554479  5.262255e-02\n",
      "cg14666892  1.419576e-01 -0.015417406 -0.098809801 -0.0360471068 -2.115001e-01\n",
      "cg22753768  2.077435e-02  0.007431258  0.050481148 -0.0102226954  5.330554e-02\n",
      "cg24747396  8.724204e-02  0.018041584 -0.080780737 -0.0373032114  2.840662e-02\n",
      "cg14833160  1.017438e-01 -0.076336344 -0.158124039 -0.2389482874  8.318213e-02\n",
      "cg15951107  8.328308e-02 -0.044552350  0.009217646  0.0363442731 -5.805804e-03\n",
      "cg01803238  1.141206e-01  0.101589258  0.146635503 -0.0065936917  3.183911e-02\n",
      "cg03813215  1.726782e-01  0.117559961 -0.025646168  0.0260997531 -3.814264e-02\n",
      "cg08223235 -1.940607e-02 -0.184558431  0.082487386 -0.0406136714 -3.343983e-03\n",
      "cg08554462  2.221652e-01  0.002319491  0.039438255  0.0946649958  1.105520e-01\n",
      "cg09752703  7.986879e-02  0.052609262  0.037010706  0.0065555990  2.666656e-02\n",
      "cg11255230  1.068627e-01  0.025334061  0.050770753 -0.0819022131  7.005569e-03\n",
      "cg11330108  8.958729e-02  0.058162881  0.051246933  0.0573162357  6.232165e-02\n",
      "cg12459502 -6.554362e-02 -0.126530083  0.050118394  0.0692141300 -8.786619e-02\n",
      "cg14455307  1.753947e-01  0.048795465  0.059754358 -0.0986867959 -6.117333e-02\n",
      "cg17602451  7.209610e-02  0.053897903 -0.023365104 -0.0244318287 -1.475624e-01\n",
      "cg21602520  1.246893e-01 -0.066852194  0.191551665  0.0364951402 -1.790664e-01\n",
      "cg23756272 -2.030271e-02 -0.302597638  0.038354042  0.0200210480 -1.082509e-01\n",
      "cg25059899 -1.019224e-01 -0.151623927  0.160694013 -0.0390672810  1.018102e-02\n",
      "cg00782854  1.972516e-01 -0.097265551  0.225551432 -0.1535077043 -1.091810e-01\n",
      "cg16137862  8.629279e-02 -0.024409879  0.040257940  0.0064611194 -3.787288e-02\n",
      "cg27608154 -1.021038e-01 -0.201952442  0.020251673 -0.1086206386 -8.344193e-02\n",
      "cg16225441  1.617237e-01 -0.349211390 -0.183560767  0.0937817829 -1.822444e-01\n",
      "cg26709863 -4.845531e-02 -0.015259671  0.050601007 -0.0445081352  1.043937e-01\n",
      "cg05566965  2.180918e-01 -0.021808854  0.061988559 -0.0888900075 -7.511805e-02\n",
      "cg03148461  1.776816e-02  0.043698828  0.062950948 -0.0426519699 -1.973366e-04\n",
      "cg10141022  7.530490e-02 -0.039161722  0.010588033 -0.0266052015 -5.014457e-02\n",
      "cg11414046  2.266553e-01  0.049861996  0.140559796 -0.0437592495 -9.301660e-02\n",
      "cg14094063  9.469947e-02 -0.014686742  0.005099552 -0.1656212255  6.742144e-02\n",
      "cg17095753  1.792515e-01  0.046766790  0.115413684 -0.0394913005  2.976070e-03\n",
      "cg21043558  3.538737e-02  0.038825160  0.024747923 -0.0360994022 -1.280453e-02\n",
      "cg23066879  9.868344e-02 -0.006724054  0.018675887 -0.0587006253 -1.016954e-01\n",
      "cg12836863 -8.107020e-02 -0.096318315  0.192349110  0.0419784101  6.333554e-02\n",
      "cg27253386  1.192428e-01 -0.039763447  0.085849815  0.0025881964 -8.296630e-02\n",
      "cg22906389  8.797571e-02 -0.043165778  0.025701594 -0.0525260164  1.356145e-02\n",
      "cg04677163  2.371319e-01 -0.051083516  0.025846135  0.0259356195  1.364166e-01\n",
      "cg07964538  8.329287e-02  0.079464947  0.079993306 -0.0077304872  1.033316e-01\n",
      "cg17469978  8.175045e-02 -0.035934931 -0.114640246  0.0292947624  1.600137e-01\n",
      "cg18329349  6.081058e-02  0.040627999 -0.015410233 -0.0541378626 -2.413848e-02\n",
      "cg22126032  5.130415e-02 -0.061469598  0.083915754  0.0601413858  1.267807e-01\n",
      "cg27242945  2.307104e-01  0.012922762 -0.103301377  0.0784030375  8.401828e-02\n",
      "cg13849825 -1.018683e-01 -0.045797493  0.043910461  0.0470949884  8.140363e-03\n",
      "cg23935746  8.726273e-02  0.020185726  0.116721667 -0.0041578738 -5.342620e-02\n",
      "cg00858899  7.917459e-02  0.123523252 -0.015758887  0.0312246077 -5.538007e-02\n",
      "cg00953256 -3.174401e-02 -0.089083841  0.166040427  0.0056242601  4.049423e-02\n",
      "cg02723533 -3.900157e-02 -0.194696803  0.009285833  0.1252619083  2.526024e-01\n",
      "cg04717045 -5.831463e-02 -0.125768245  0.093426931 -0.0460140153  1.094484e-01\n",
      "cg05164185  9.970093e-02 -0.043228178  0.063133001  0.0005539495  1.145531e-01\n",
      "cg05200606  3.607500e-02 -0.046433440 -0.068964280  0.0420371065  6.363339e-03\n",
      "cg06539449 -1.203098e-02 -0.150797965  0.233326383  0.1957503807  3.136770e-02\n",
      "cg08170622  1.254542e-01  0.068488151 -0.027452638  0.0147941586  1.087937e-01\n",
      "cg09637363  4.102344e-02 -0.092241403  0.183867708  0.0475945689 -5.114048e-02\n",
      "cg10539418  3.166040e-02 -0.010957071  0.038981608 -0.0169973274  5.157786e-02\n",
      "cg11802013  3.766704e-02 -0.113612709  0.025850766  0.1794698158 -1.338142e-01\n",
      "cg12266049 -4.328629e-02 -0.214993113  0.122240545  0.0204164730  2.194064e-01\n",
      "cg13608094 -7.609505e-02 -0.076627653  0.203093998  0.0825533198  1.942374e-02\n",
      "cg16794682 -3.578745e-03 -0.125061307  0.106922532  0.0204016497  2.753403e-02\n",
      "cg19047670 -3.897142e-05 -0.146023428  0.093908714  0.0476894817  3.633930e-02\n",
      "cg25060573  6.358982e-02  0.057702707 -0.020977440  0.0086796431  7.540517e-05\n",
      "cg26605086  9.550536e-02 -0.050433543  0.106733080 -0.0173557147 -7.085433e-02\n",
      "cg12187567  3.158224e-02 -0.040912703 -0.008532636  0.0619718337  2.588840e-02\n",
      "cg16328273  9.340860e-02  0.015822188 -0.035917440  0.0155915178 -6.649149e-03\n",
      "cg11255163  1.833700e-01 -0.011812378 -0.013894003  0.0304328164 -1.110034e-01\n",
      "cg11667754  8.723824e-02  0.041686094 -0.077975796 -0.0946710815 -3.604659e-02\n",
      "cg17655614  2.580228e-02  0.037931679 -0.030052667 -0.0035120434 -5.851575e-02\n",
      "cg20716119  1.963394e-01  0.036165107 -0.152992714  0.0307312469 -5.589369e-02\n",
      "cg22832044  1.025453e-01 -0.017578024  0.082553566  0.0015110562  2.967508e-03\n",
      "cg23989635  7.077825e-02 -0.016170697 -0.012306511 -0.0267608514 -8.931635e-03\n",
      "                      10\n",
      "cg20139214  1.002827e-02\n",
      "cg10999429  1.207567e-01\n",
      "cg23640701  4.811143e-02\n",
      "cg02956093 -1.457258e-02\n",
      "cg08711674  7.699848e-02\n",
      "cg09842540 -9.750224e-03\n",
      "cg11739626  1.198649e-01\n",
      "cg19073614 -9.956525e-03\n",
      "cg01894895 -5.104505e-02\n",
      "cg01086868 -2.342288e-02\n",
      "cg04755662  2.595450e-02\n",
      "cg05019001  1.093703e-01\n",
      "cg05786601  8.672699e-02\n",
      "cg07780118 -4.531470e-02\n",
      "cg12589433 -7.313747e-02\n",
      "cg14807303  1.381747e-01\n",
      "cg16679837  3.905897e-02\n",
      "cg20878850 -5.482074e-02\n",
      "cg21966410  2.768413e-02\n",
      "cg27271368  2.927637e-02\n",
      "cg04283377  1.113183e-01\n",
      "cg10455133  4.371044e-02\n",
      "cg01245656 -4.635368e-02\n",
      "cg14785449  8.597418e-04\n",
      "cg01800843  4.243511e-02\n",
      "cg03165700  8.178434e-05\n",
      "cg18457775 -2.869589e-02\n",
      "cg22477592 -9.244359e-03\n",
      "cg24027342 -1.259806e-02\n",
      "cg00925229 -5.525808e-02\n",
      "cg07588779  2.060592e-02\n",
      "cg13620770 -1.347061e-01\n",
      "cg07679836 -1.835603e-02\n",
      "cg14666892 -2.840567e-01\n",
      "cg22753768  2.840300e-02\n",
      "cg24747396 -9.927170e-03\n",
      "cg14833160 -2.541554e-01\n",
      "cg15951107 -5.673391e-02\n",
      "cg01803238  3.996537e-02\n",
      "cg03813215 -1.303554e-01\n",
      "cg08223235  3.647351e-02\n",
      "cg08554462 -1.375980e-02\n",
      "cg09752703 -3.113491e-02\n",
      "cg11255230 -9.855680e-02\n",
      "cg11330108  5.368550e-02\n",
      "cg12459502 -7.276521e-02\n",
      "cg14455307 -1.284859e-02\n",
      "cg17602451 -1.132514e-01\n",
      "cg21602520 -2.076095e-01\n",
      "cg23756272  8.120470e-02\n",
      "cg25059899 -1.735700e-02\n",
      "cg00782854 -1.107485e-01\n",
      "cg16137862 -2.936238e-02\n",
      "cg27608154 -9.386994e-02\n",
      "cg16225441 -3.754163e-02\n",
      "cg26709863  4.522898e-02\n",
      "cg05566965 -3.555575e-02\n",
      "cg03148461 -4.347388e-02\n",
      "cg10141022 -6.485247e-02\n",
      "cg11414046 -2.199963e-02\n",
      "cg14094063  4.866011e-02\n",
      "cg17095753  4.363418e-02\n",
      "cg21043558 -1.034292e-02\n",
      "cg23066879 -4.168903e-03\n",
      "cg12836863 -2.954105e-01\n",
      "cg27253386 -1.659819e-02\n",
      "cg22906389  2.879171e-02\n",
      "cg04677163 -3.142131e-02\n",
      "cg07964538  3.533510e-03\n",
      "cg17469978 -2.100395e-01\n",
      "cg18329349 -3.303018e-02\n",
      "cg22126032  9.173847e-03\n",
      "cg27242945  1.966446e-01\n",
      "cg13849825 -8.569561e-03\n",
      "cg23935746  6.327782e-02\n",
      "cg00858899 -2.712912e-02\n",
      "cg00953256 -1.584662e-01\n",
      "cg02723533 -1.505044e-01\n",
      "cg04717045 -1.056002e-01\n",
      "cg05164185  2.868877e-02\n",
      "cg05200606 -3.557128e-02\n",
      "cg06539449  8.024698e-02\n",
      "cg08170622  4.273189e-02\n",
      "cg09637363  3.085258e-01\n",
      "cg10539418  4.648956e-02\n",
      "cg11802013 -1.445410e-01\n",
      "cg12266049  2.288073e-02\n",
      "cg13608094  4.867725e-02\n",
      "cg16794682  7.356945e-02\n",
      "cg19047670  2.350505e-01\n",
      "cg25060573  3.123252e-03\n",
      "cg26605086 -6.529743e-02\n",
      "cg12187567  2.038545e-02\n",
      "cg16328273 -5.917483e-02\n",
      "cg11255163  2.115901e-01\n",
      "cg11667754  8.885887e-02\n",
      "cg17655614  7.256193e-02\n",
      "cg20716119  2.657788e-01\n",
      "cg22832044 -5.546603e-02\n",
      "cg23989635  8.374022e-02\n",
      "\n",
      "[[1]][[2]][[2]]\n",
      "                     1             2             3             4             5\n",
      "ACACA    -1.922805e-01  0.0142860854 -0.0681175148 -1.356159e-01  0.0079582934\n",
      "ACVRL1    8.993108e-04  0.0390918095  0.0011819377 -7.204728e-04  0.2684468882\n",
      "AKT1     -3.876608e-02  0.0172230435  0.0347359172  1.380618e-02 -0.0786571823\n",
      "AKT1S1   -3.419939e-02  0.2215019363  0.0239869858  1.800339e-03 -0.0467832356\n",
      "ANXA1     9.770849e-02  0.0591090071  0.0454229166 -1.363267e-01  0.0089829165\n",
      "AR       -1.806369e-02 -0.0200951835  0.0135228620  4.279454e-02 -0.0564137487\n",
      "ARAF     -1.913711e-01  0.0400354340  0.0794077339  4.189909e-02  0.0958157841\n",
      "ASNS     -1.691223e-01 -0.1224522167  0.0745847761  4.208192e-02 -0.0763015853\n",
      "ATM       5.943876e-02 -0.0275742410 -0.1562454782 -1.553762e-01 -0.0954280664\n",
      "BAD       4.263850e-02 -0.2236227302 -0.0042706736 -6.555145e-03 -0.0545151070\n",
      "BAK1     -6.624015e-02  0.0232505460  0.1602588101  1.550227e-01 -0.0564431602\n",
      "BAP1     -4.336555e-02  0.2148854501  0.0249733551 -6.004445e-03 -0.0332800617\n",
      "BAX       3.553488e-02 -0.2275709958 -0.0010978081  1.160798e-02  0.0454711543\n",
      "BCL2      9.446225e-05  0.0062387018 -0.0164626860  3.035738e-02  0.0032833886\n",
      "BCL2L1   -7.633627e-02  0.0934935093 -0.2143311356 -4.946933e-03 -0.0314505973\n",
      "BCL2L11   1.383360e-02 -0.2272458053 -0.0027417299  4.325218e-02 -0.1518272899\n",
      "BECN1    -7.329712e-02  0.0232428081  0.1596873776  1.855094e-01  0.0066192709\n",
      "BID      -2.090075e-02  0.0099671683  0.0305736661 -3.668786e-02 -0.0344355285\n",
      "BRAF     -3.817766e-02  0.1954544848  0.0224735658 -1.734189e-02 -0.0063251555\n",
      "BRCA2    -1.678795e-02 -0.1449090055  0.1356671010  1.272382e-01 -0.1498827500\n",
      "CASP7     7.121977e-02  0.0609404253 -0.1844966583  1.056027e-01  0.0301115857\n",
      "CAV1      1.532671e-01 -0.0201017067  0.0649903355  1.143789e-01  0.0739845508\n",
      "CCNB1     4.162289e-02 -0.2036975961  0.0138212683  4.258207e-03 -0.0018271031\n",
      "CCND1    -2.683148e-02  0.0402352996 -0.0063840713 -2.034746e-02 -0.0739442193\n",
      "CCNE1    -1.319072e-01 -0.1147913564  0.0650475543  5.579030e-02 -0.0725196417\n",
      "CCNE2    -8.784915e-02 -0.1502069979 -0.0649630933 -9.769081e-02 -0.0309854967\n",
      "CDH1     -1.680456e-01 -0.1304620321  0.0801704783  4.763322e-02  0.0110291057\n",
      "CDH2     -8.957333e-02  0.0129241473 -0.0341230531 -4.536218e-02 -0.0018174089\n",
      "CDH3     -2.495631e-02 -0.1126081350  0.1022487767  1.115934e-01 -0.0487312253\n",
      "CDKN1A   -4.904522e-02  0.0428565646 -0.0015293561  3.528269e-03 -0.0579418236\n",
      "CDKN1B    1.778657e-01  0.1104485957 -0.0543390508  2.059417e-06  0.0831193820\n",
      "CHEK1     1.880590e-01 -0.0511632510 -0.0356408084 -3.898712e-02 -0.0621812564\n",
      "CHEK2     1.439941e-02 -0.0536506277  0.0005284004  4.615686e-02 -0.2993494507\n",
      "CLDN7    -1.909107e-01  0.0131801513 -0.0415829490 -6.942468e-02  0.0368603050\n",
      "COL6A1   -5.266419e-02 -0.0664471684 -0.1957180132 -1.449808e-02  0.0960334977\n",
      "CTNNB1   -1.706452e-01  0.0225153702 -0.0589304919 -1.434670e-01  0.0048677240\n",
      "DIRAS3   -8.390967e-03  0.0004314582 -0.0055933533  8.314133e-03  0.0320976233\n",
      "DVL3      4.767421e-03  0.0350494797  0.0031562541 -2.680572e-02 -0.2051677772\n",
      "EEF2      1.363936e-01 -0.0841207275  0.0738460803 -1.495446e-01 -0.0162651326\n",
      "EEF2K     1.297108e-01 -0.1095042026  0.0893211460 -1.369450e-01  0.0001610050\n",
      "EGFR     -1.923415e-01  0.0265404516  0.0814095357  1.925468e-02  0.0082448249\n",
      "EIF4E     2.200403e-02  0.0217374605  0.0385182418  5.170885e-02  0.2041760323\n",
      "EIF4EBP1 -1.215446e-01 -0.1323776889 -0.0625531603 -1.080387e-01 -0.0424860293\n",
      "EIF4G1   -6.980910e-02  0.0162035683  0.1569502683  1.597224e-01 -0.1037699183\n",
      "ERBB2     8.314938e-02 -0.0367379603 -0.1463150435 -1.545506e-01  0.0673444804\n",
      "ERBB3    -1.144515e-01  0.0906829502  0.1643169625 -9.157749e-02  0.0349554761\n",
      "ERRFI1   -7.379959e-02  0.0433981725  0.1327659884  1.480376e-01  0.0430790690\n",
      "ESR1     -2.953070e-02 -0.0435233528  0.0005699838  5.133280e-02 -0.0241064605\n",
      "ETS1     -6.192161e-02 -0.0959641959 -0.1947313925 -1.143377e-02  0.0750346022\n",
      "FASN     -1.425217e-01  0.0805002466 -0.0615203045  1.297970e-01 -0.0350857204\n",
      "FN1      -1.116781e-01 -0.0846945616 -0.0568107780 -8.516664e-02  0.2120297431\n",
      "FOXM1    -1.388456e-02  0.1854059320  0.0301141537 -2.319670e-02 -0.1789810726\n",
      "FOXO3     5.387568e-02  0.0802142229  0.2083231288 -7.051124e-03 -0.0146483463\n",
      "G6PD     -1.419602e-01 -0.1415341771 -0.0624264970 -1.057744e-01  0.0408146209\n",
      "GAB2      9.677943e-02  0.0638959883  0.0729326549 -1.615252e-01 -0.0808415428\n",
      "GAPDH     1.209388e-01 -0.0859006724  0.0924702716 -1.495118e-01 -0.0221876420\n",
      "GATA3     1.099621e-01  0.0906266151  0.0916962534 -1.785345e-01  0.0531891688\n",
      "GSK3A     9.278926e-02  0.0690228933 -0.1729869145  1.537905e-01 -0.0306937404\n",
      "HSPA1A    9.262086e-03  0.0083334740  0.0452416726  4.404835e-02  0.0687951100\n",
      "IGFBP2   -4.281623e-02  0.0391010718 -0.1563420736  2.440855e-02 -0.1384126056\n",
      "IRS1      6.668070e-02  0.0493708320 -0.1722733939  1.118580e-01  0.0456669811\n",
      "ITGA2    -1.588541e-01  0.0057131971 -0.0538611564 -1.411402e-01  0.0047985680\n",
      "JUN      -2.560712e-02  0.0953449588 -0.0026398968 -1.907789e-01 -0.0656198514\n",
      "KDR       8.916064e-02 -0.0823326677  0.1980962353  1.389394e-02  0.1223054927\n",
      "KIT      -1.010126e-01  0.0083156756 -0.0461163036 -1.094299e-01  0.2012419339\n",
      "LCK      -6.987622e-02  0.0316056265  0.1390726487  1.295769e-01  0.0645479175\n",
      "MAP2K1   -2.731534e-02  0.2316529990 -0.0013345732 -6.925288e-03 -0.0840269253\n",
      "MAPK1     9.096303e-02 -0.1171078175 -0.1427561471  1.409121e-01 -0.0008842903\n",
      "MAPK14   -1.886998e-01  0.0255104012 -0.0787444857 -1.247127e-01 -0.0241145766\n",
      "MAPK9    -7.369324e-03  0.0031566208  0.0248262612  2.705669e-02  0.4227877187\n",
      "MET      -1.822598e-01  0.0240323433  0.0676525254  2.182503e-02 -0.0126449001\n",
      "MRE11A    1.458894e-01 -0.0908127258  0.0823642706 -1.461441e-01 -0.0324264841\n",
      "MYC      -1.846915e-01  0.0126227733  0.0574525948  6.043469e-02 -0.0097722021\n",
      "MYH11     2.586325e-02  0.0566704434  0.0142000339 -1.765898e-02  0.0909864085\n",
      "NDRG1    -1.463543e-01  0.0701344806 -0.0512731542  9.024288e-02 -0.0845659603\n",
      "NF2      -1.807622e-01  0.0060011897 -0.0556196909 -1.364257e-01  0.0046573408\n",
      "NFKB1    -2.306134e-02  0.0277289094  0.0304446389  6.609401e-03  0.1070514804\n",
      "NOTCH1   -3.182347e-02  0.0094550727 -0.0154892683 -7.058497e-02  0.0982244154\n",
      "NRAS     -5.758506e-02 -0.0597215417  0.1732397462 -8.262892e-02 -0.0046841381\n",
      "NRG1      1.496318e-01 -0.0215844226  0.0733758520  8.643988e-02 -0.0161604568\n",
      "PARK7     2.983364e-02 -0.0205305344 -0.0039231477  7.531367e-02 -0.0378533331\n",
      "PCNA     -6.483663e-02 -0.0580387903  0.1808925937 -1.093270e-01 -0.0449620662\n",
      "PDCD4     5.291690e-02  0.0961894374  0.2118163865 -2.674133e-03  0.0170407783\n",
      "PDK1     -1.031884e-01  0.0723797515  0.1644491709 -9.710483e-02 -0.0970815523\n",
      "PEA15     6.234964e-02  0.0980220410  0.1969660379  1.240774e-02 -0.0546596749\n",
      "PGR       1.095082e-02 -0.1382249731  0.0100151371  2.041291e-02 -0.1997597672\n",
      "PIK3R1    3.539498e-02 -0.1935240943  0.0326723496 -9.210021e-04  0.0750922554\n",
      "PRDX1     1.353994e-01 -0.0911206627  0.0995174562 -1.239505e-01 -0.0503531268\n",
      "PREX1    -2.246995e-02 -0.1397932196  0.1125773421  1.529635e-01  0.1170022605\n",
      "PRKAA1    1.119774e-01  0.0758407949  0.0976224451 -1.687660e-01 -0.0396929883\n",
      "PRKCD    -3.746693e-02 -0.0827459108  0.0100210789 -2.403332e-01 -0.0751569220\n",
      "PTEN     -7.196702e-02 -0.0399927872  0.1575713437 -1.261308e-01  0.2121704074\n",
      "PXN       8.684981e-02  0.0642126881 -0.1923442325  1.289572e-01 -0.0372918458\n",
      "RAB25    -3.146321e-02  0.0941574957  0.0332263818  1.675747e-02  0.1165241977\n",
      "RAD50     1.759505e-01  0.1285646042 -0.0759876678 -3.203240e-02 -0.0189439620\n",
      "RAD51    -1.055621e-01 -0.1602330852 -0.0425701952 -1.089201e-01 -0.1385659711\n",
      "RAF1     -1.370305e-01 -0.0928246024 -0.0898864345  1.660775e-01 -0.0519176456\n",
      "RB1       2.179497e-03  0.0351169196  0.0540174596  5.209941e-02 -0.0519214324\n",
      "RBM15    -2.968653e-02  0.2199943820 -0.0005566858  3.543472e-03 -0.0899800715\n",
      "RPS6      4.041759e-02 -0.0982178249 -0.0216528934  2.337913e-01  0.0706640613\n",
      "                     6            7             8             9            10\n",
      "ACACA    -0.0054879690 -0.008538992 -0.0829485828  0.0868392025  0.0692186251\n",
      "ACVRL1   -0.0386061861  0.123642071 -0.0545415797 -0.0200401287  0.2074588280\n",
      "AKT1     -0.2816575572  0.055785526  0.2797503101 -0.2239372573 -0.0884694578\n",
      "AKT1S1   -0.1016391925  0.027465324  0.0460240907 -0.0603020327  0.0659469434\n",
      "ANXA1    -0.0433245351  0.076914197 -0.0208120412 -0.1673134556  0.0166884816\n",
      "AR        0.1884040662 -0.072834224  0.1648958270 -0.0356965586  0.0898768831\n",
      "ARAF     -0.0633474852 -0.034024648  0.0426319252 -0.1159526368 -0.0170729623\n",
      "ASNS     -0.0047474444  0.015620051 -0.1534890217  0.0131642609 -0.0646944610\n",
      "ATM       0.1082017208 -0.010102847 -0.0383862144  0.0196795603 -0.1444462459\n",
      "BAD       0.0720269307  0.109507219  0.0039037512 -0.0064865703  0.0352614745\n",
      "BAK1     -0.1532439547  0.086343951  0.0162062564  0.0357545378  0.0326392820\n",
      "BAP1     -0.1211242148 -0.035989717  0.0320913599 -0.0732699752 -0.0425631119\n",
      "BAX      -0.0261342368 -0.009802316  0.0573912170 -0.0017800072  0.0782885118\n",
      "BCL2      0.1903280632 -0.032262581 -0.0924099558  0.0495860941 -0.0523356318\n",
      "BCL2L1   -0.0119749807  0.019923347  0.0195720700  0.0212388802  0.0063260487\n",
      "BCL2L11  -0.0488508305  0.083668722  0.0180966965 -0.0556360896 -0.0303831044\n",
      "BECN1     0.0178247410 -0.028773113  0.0360598249  0.0642015737  0.0013701023\n",
      "BID      -0.1868507403  0.170284714 -0.1407427435  0.1245808434 -0.0838610278\n",
      "BRAF     -0.0815603461  0.009053676 -0.1091464326 -0.2704193310  0.1074515040\n",
      "BRCA2    -0.0102825140  0.032693879  0.0666148797  0.0225517912  0.1236109342\n",
      "CASP7    -0.0723293036  0.113951007  0.0353809286 -0.1544875859 -0.0127362527\n",
      "CAV1      0.0689865365  0.004026757  0.0226809103  0.0881955453  0.0449187879\n",
      "CCNB1    -0.1135991921 -0.044714201 -0.0318841160  0.0930498691 -0.0133204415\n",
      "CCND1     0.2176563354 -0.053568103  0.3008025689 -0.0696165907 -0.1528141863\n",
      "CCNE1    -0.1461029297  0.130859784  0.0390921014  0.1503522182 -0.0008939865\n",
      "CCNE2    -0.0562502468  0.038213534 -0.2190835792 -0.1129101495  0.0545041316\n",
      "CDH1      0.0568635883 -0.027287971  0.0530404071 -0.1320654961 -0.0093925418\n",
      "CDH2      0.0579034420 -0.193508927 -0.0389098494  0.0584966426 -0.3404984286\n",
      "CDH3     -0.0463506161 -0.184595437  0.0858898060 -0.0075023799  0.0706684056\n",
      "CDKN1A   -0.0950183952  0.131648525 -0.0724590502  0.0030368449  0.0527878564\n",
      "CDKN1B   -0.1132520460 -0.019038098 -0.0379291266  0.0104993850 -0.0201925716\n",
      "CHEK1    -0.1439846499  0.036701352 -0.1299384966  0.0414525042 -0.0346914676\n",
      "CHEK2    -0.2050322851  0.029481948 -0.0703456163  0.1989091209 -0.0837541728\n",
      "CLDN7    -0.0162130657 -0.017570489  0.0707706140 -0.0014928393  0.0141860331\n",
      "COL6A1   -0.0908492634  0.075047076  0.1392580780  0.0933842608  0.0252934393\n",
      "CTNNB1   -0.0820559798 -0.036791572  0.0171657823 -0.0757722126  0.0005885137\n",
      "DIRAS3   -0.1627705247 -0.300211530  0.2970395908  0.1257447716  0.0262857397\n",
      "DVL3     -0.0344889800  0.167917437  0.2846062870 -0.0027059060 -0.0133633002\n",
      "EEF2      0.0090078651  0.063907140  0.1603175532  0.0019444459 -0.1018194259\n",
      "EEF2K    -0.0257720429  0.055538613  0.0785352882 -0.0646285382 -0.0214454224\n",
      "EGFR      0.1208001201  0.075540478  0.0046412058  0.0027589320 -0.0084248463\n",
      "EIF4E    -0.1975920748 -0.231992475 -0.0515412019 -0.0122882846 -0.2218915934\n",
      "EIF4EBP1 -0.0457520269  0.015582610 -0.0453595753  0.0308731309  0.1236310452\n",
      "EIF4G1   -0.0078869390  0.123221496  0.0858604483  0.0246805789 -0.0055137906\n",
      "ERBB2     0.0796949273  0.028696757  0.0957540200 -0.0081587276  0.0101083670\n",
      "ERBB3    -0.0041415903  0.110805306  0.0072068986  0.0082387679  0.0621099964\n",
      "ERRFI1    0.0367515110  0.008789995 -0.0609411134  0.0978803358  0.0234183577\n",
      "ESR1      0.0673602808 -0.062616169  0.0312084323 -0.4305359824  0.0873697019\n",
      "ETS1     -0.0601776548  0.107477295  0.0015095010 -0.0009426077  0.0428396414\n",
      "FASN     -0.0623766288  0.022086019  0.0803178724 -0.0445698744 -0.0261054418\n",
      "FN1      -0.0576971282  0.087175099  0.0930739407  0.1011001426 -0.0024638102\n",
      "FOXM1    -0.1067347422  0.021783431  0.0015977806 -0.0071580036  0.0318370322\n",
      "FOXO3     0.0672226180 -0.062265582  0.1048331482  0.0184330790  0.0620849197\n",
      "G6PD     -0.0412773612 -0.052791044  0.0594839228 -0.0144604930 -0.0772299146\n",
      "GAB2      0.0308035836  0.113155543  0.0316930107 -0.0915965831  0.0710456949\n",
      "GAPDH    -0.0486693716  0.032504630  0.0658235911 -0.0549631554 -0.0700148847\n",
      "GATA3    -0.0486528181 -0.010852403  0.0086047127  0.0923686258 -0.0983070879\n",
      "GSK3A    -0.0509799375  0.058897089  0.0283102970  0.0008862686  0.0527898573\n",
      "HSPA1A   -0.1439698981  0.214066517  0.1514818498 -0.0419677512 -0.3601984500\n",
      "IGFBP2   -0.2271504785 -0.196385680  0.1240356153  0.0025277186  0.0329673441\n",
      "IRS1      0.0178381345 -0.089896898  0.0596697305  0.0300632692  0.0769469702\n",
      "ITGA2     0.1171792498 -0.023458787 -0.0193333493  0.0368762124 -0.0654758695\n",
      "JUN       0.0946757645 -0.066883795 -0.0301183932  0.1419815067  0.0625892158\n",
      "KDR      -0.0313244096  0.052760999  0.0304078440 -0.0085166863  0.0777014449\n",
      "KIT      -0.0722785501 -0.078068957  0.0691734144  0.2665073834 -0.0146628386\n",
      "LCK      -0.0699757898  0.125790635 -0.0790612369  0.1587968457 -0.0567623959\n",
      "MAP2K1   -0.0605089471 -0.039548098  0.0594285128  0.0089403171 -0.0891493128\n",
      "MAPK1    -0.1781366959  0.112028144 -0.0173204461 -0.0263586656 -0.0811466866\n",
      "MAPK14   -0.0428846170 -0.080963026  0.0277345656 -0.0663576879  0.0571648129\n",
      "MAPK9    -0.2493265222 -0.098469547 -0.0070611047 -0.2128009202  0.0363995819\n",
      "MET       0.1122638237  0.049479862 -0.0374679974 -0.1068620454 -0.0620993660\n",
      "MRE11A   -0.0100217393  0.016766148  0.0010011451 -0.0355053598  0.0064988572\n",
      "MYC       0.1576968616 -0.112107212  0.0173427672 -0.1095388279 -0.0890847565\n",
      "MYH11     0.0108531992  0.060751759  0.0335129158  0.2669629031  0.1879886254\n",
      "NDRG1     0.0153876872  0.228796707 -0.0402766268 -0.0218539048  0.0666892801\n",
      "NF2      -0.0879697958  0.039488654  0.0432297252  0.0764433250 -0.0724061895\n",
      "NFKB1     0.1397588035  0.268997554 -0.0187504554  0.0151567294 -0.2194182913\n",
      "NOTCH1    0.1131135312  0.228016962  0.2107767582  0.0599665139  0.2355869746\n",
      "NRAS     -0.1092195455 -0.076935820 -0.0258563830  0.0922164527  0.0589834444\n",
      "NRG1      0.1409002577 -0.072277328 -0.0276009175  0.0429231169 -0.2059023317\n",
      "PARK7    -0.0418723049 -0.222611457 -0.0874407156  0.0880219435  0.2014845264\n",
      "PCNA     -0.0831181259 -0.044954976 -0.1078422602 -0.0917522150 -0.0212480760\n",
      "PDCD4     0.0005813872 -0.073252124  0.0028244564  0.0251628501  0.0319641840\n",
      "PDK1     -0.1173185400 -0.123205753 -0.0757563623  0.0190040212 -0.0044889871\n",
      "PEA15    -0.0243585810  0.078810475  0.0111123852 -0.0495830454  0.0555739892\n",
      "PGR      -0.0280881614 -0.104287461 -0.0314635508 -0.0467115998  0.2081541423\n",
      "PIK3R1    0.0068862986 -0.006088678  0.1123135460 -0.1671074318 -0.0590148516\n",
      "PRDX1    -0.0923360002 -0.041610632  0.0421099041 -0.0075900264 -0.0574057013\n",
      "PREX1    -0.0762560808  0.086166621  0.0260401682  0.0651106387 -0.1110746915\n",
      "PRKAA1   -0.0539248149 -0.013536037 -0.0351639496 -0.0159619527  0.0785231848\n",
      "PRKCD    -0.0420830485  0.102177278  0.0657539268 -0.0448629702  0.0133295772\n",
      "PTEN      0.1111038073  0.038703230  0.0124092234 -0.0050063860 -0.0714470083\n",
      "PXN       0.0463995725  0.075583711  0.0628786553  0.0241667989 -0.0454527296\n",
      "RAB25    -0.0409968111  0.119965117  0.1775014285  0.0733075977  0.2122433167\n",
      "RAD50    -0.0449579379  0.006852360 -0.0009571342 -0.0109169727  0.0111816718\n",
      "RAD51    -0.0094255508 -0.010572308  0.0163863583 -0.0007045560  0.0470430785\n",
      "RAF1     -0.0111800914 -0.005503908  0.0003697090  0.0160304941 -0.0684696719\n",
      "RB1       0.0964458141 -0.106218778  0.3416520683  0.1516762375 -0.0081803658\n",
      "RBM15     0.0429700275  0.074035878 -0.1267399253  0.0195343464 -0.1329087760\n",
      "RPS6      0.0792556717 -0.039591293 -0.0744506713 -0.0934816936  0.0378285711\n",
      "\n",
      "[[1]][[2]][[3]]\n",
      "                                   1             2            3             4\n",
      "ACC1                    -0.148689116  0.0464705410 -0.078182626  0.1142004389\n",
      "ACC_pS79                -0.149167425  0.0386757803 -0.080265475  0.1196517312\n",
      "ACVRL1                  -0.021036552  0.0471769535  0.011427153  0.0301869094\n",
      "Akt_pS473               -0.023096244  0.0246262884  0.026419173  0.0189205576\n",
      "PRAS40_pT246            -0.033814499  0.2357681044  0.003455191  0.0118030506\n",
      "Annexin.1                0.086981532  0.0931502030  0.095782132  0.1582274647\n",
      "AR                      -0.006168150  0.0007461875 -0.008226675 -0.0173869910\n",
      "A.Raf_pS299             -0.183378645  0.0435391640  0.070233110 -0.0453757470\n",
      "ASNS                    -0.148104028 -0.1177011976  0.051471108 -0.0551072373\n",
      "ATM                      0.064379622 -0.0187647970 -0.142537569  0.1322364064\n",
      "Bad_pS112                0.027939079 -0.2076974197  0.018002807  0.0064603288\n",
      "Bak                     -0.063514870  0.0149612299  0.162450649 -0.1746956321\n",
      "Bap1.c.4                -0.023632160  0.2308733647 -0.008636205 -0.0088888680\n",
      "Bax                      0.021935753 -0.2369733654  0.008196731 -0.0151743619\n",
      "Bcl.2                   -0.018310593 -0.0149616187  0.029184903  0.0387188944\n",
      "Bcl.xL                  -0.074451004  0.0753318965 -0.219691473 -0.0151086009\n",
      "Bim                      0.035912881 -0.2252218708 -0.012283692 -0.0034265606\n",
      "Beclin                  -0.062286197  0.0198041284  0.157368004 -0.1708907861\n",
      "Bid                     -0.027968102 -0.0617984552  0.001310626  0.0009496965\n",
      "B.Raf                   -0.027300038  0.2162626098 -0.013259786  0.0109835701\n",
      "BRCA2                   -0.030949037 -0.1674038903  0.130719288 -0.1535551747\n",
      "Caspase.7_cleavedD198    0.057445947  0.0448817640 -0.145574461 -0.1399267823\n",
      "Caveolin.1               0.089807242 -0.0218040095  0.040004833 -0.0761454730\n",
      "Cyclin_B1                0.038121442 -0.1654459140 -0.006084344 -0.0231990874\n",
      "Cyclin_D1               -0.018329067 -0.0138987086  0.010064294  0.0343449119\n",
      "Cyclin_E1               -0.146487771 -0.1182033270  0.032509498 -0.0353308873\n",
      "Cyclin_E2               -0.113728036 -0.1557942450 -0.055492676  0.1030690723\n",
      "E.Cadherin              -0.127775637 -0.1187367235  0.041387398 -0.0227036946\n",
      "N.Cadherin              -0.158867078  0.0222552629 -0.080677945  0.1203997895\n",
      "P.Cadherin              -0.033029860 -0.1609079502  0.128466602 -0.1487428780\n",
      "p21                     -0.016230748 -0.0441671638  0.008090589  0.0050649389\n",
      "p27                      0.151603579  0.1286379481 -0.053762895  0.0526513381\n",
      "p27_pT157                0.164892673  0.1254087898 -0.067411948  0.0529058029\n",
      "p27_pT198                0.163382809  0.1264388156 -0.062416807  0.0422740937\n",
      "Chk1                     0.188712813 -0.0482959503 -0.058984720  0.0488951930\n",
      "Chk1_pS345               0.188705342 -0.0512535067 -0.063370152  0.0486964594\n",
      "Chk2                     0.047192976 -0.0030387623 -0.046254437 -0.0242168595\n",
      "Chk2_pT68                0.031961749 -0.0298119246 -0.039804185  0.0254295610\n",
      "Claudin.7               -0.113362302  0.0162284490 -0.078708511  0.0874823456\n",
      "Collagen_VI             -0.060716170 -0.1059311481 -0.181736647 -0.0326438616\n",
      "beta.Catenin            -0.127354249  0.0247847085 -0.096834310  0.1052042832\n",
      "ARHI                    -0.027800488  0.0256744569  0.018271011  0.0402709687\n",
      "Dvl3                    -0.002331544 -0.0080543794 -0.036735396  0.0023847164\n",
      "eEF2                     0.134379359 -0.0985366236  0.084624658  0.1600226682\n",
      "eEF2K                    0.134737748 -0.0886166607  0.067760343  0.1483959549\n",
      "EGFR                    -0.188660211  0.0433645624  0.067391230 -0.0403642835\n",
      "EGFR_pY1068             -0.174375962  0.0397580813  0.067139466 -0.0336435716\n",
      "EGFR_pY1173             -0.193118047  0.0353877181  0.065075957 -0.0343565081\n",
      "eIF4E                    0.023470764  0.0356174837 -0.019612538 -0.0292507896\n",
      "4E.BP1                  -0.112510972 -0.1573910547 -0.065788329  0.0780261637\n",
      "4E.BP1_pS65             -0.110821545 -0.1516857969 -0.068717127  0.1032039330\n",
      "4E.BP1_pT70             -0.112413345 -0.1585988525 -0.068314782  0.0918423996\n",
      "eIF4G                   -0.044350264  0.0197971278  0.109233150 -0.1590951368\n",
      "HER2                     0.067479442 -0.0193927266 -0.140486759  0.1479326304\n",
      "HER2_pY1248              0.061239096 -0.0207602839 -0.141919994  0.1649160823\n",
      "HER3                    -0.089764407  0.1102597317  0.150255093  0.1381511890\n",
      "HER3_pY1289             -0.084647207  0.1218879404  0.155411378  0.1179195209\n",
      "MIG.6                   -0.064580229  0.0091562692  0.158797045 -0.1779914466\n",
      "ER.alpha                 0.001214476  0.0169567804 -0.003560290 -0.0187349585\n",
      "ER.alpha_pS118           0.030927817  0.0162763780 -0.010134779  0.0308334102\n",
      "ETS.1                   -0.051785336 -0.0957828275 -0.210048583 -0.0213687218\n",
      "FASN                    -0.116562726  0.0845297627 -0.069264012 -0.1638411762\n",
      "Fibronectin             -0.097436291 -0.1143418761 -0.034546479  0.0445751094\n",
      "FoxM1                   -0.017998814  0.1919005123 -0.002643953  0.0025981992\n",
      "FOXO3a                   0.050281691  0.0850883242  0.214696457  0.0391155021\n",
      "FOXO3a_pS318_S321        0.049424222  0.0871965031  0.214533656  0.0261372819\n",
      "G6PD                    -0.119111256 -0.1494754940 -0.064196039  0.0994732404\n",
      "GAB2                     0.102789810  0.0688194782  0.072005267  0.1631442680\n",
      "GAPDH                    0.112781069 -0.0663133972  0.063070627  0.1173573927\n",
      "GATA3                    0.116092432  0.0918639550  0.099394328  0.1966954491\n",
      "GSK3.alpha.beta          0.063427556  0.0636810096 -0.173066702 -0.1511303149\n",
      "GSK3.alpha.beta_pS21_S9  0.056054275  0.0609298103 -0.162150220 -0.1459257792\n",
      "GSK3_pS9                 0.050260561  0.0660833913 -0.160176431 -0.1404731137\n",
      "HSP70                   -0.014241717 -0.0369177599  0.011754217  0.0142490266\n",
      "IGFBP2                  -0.067391037  0.0643025232 -0.180861021 -0.0221979552\n",
      "IRS1                     0.069858489  0.0557690222 -0.185065458 -0.1519147707\n",
      "CD49b                   -0.166612159  0.0351921354 -0.070875620  0.1253580064\n",
      "c.Jun_pS73              -0.032327670  0.1055897249  0.031234900  0.2618848838\n",
      "VEGFR2                   0.070757030 -0.0705938107  0.194279599  0.0267963365\n",
      "c.Kit                   -0.144089037  0.0328509916 -0.065425860  0.1253446211\n",
      "Lck                     -0.067125420  0.0130916421  0.152976085 -0.1599750804\n",
      "MEK1                    -0.012630777  0.2183507074  0.001308527 -0.0093474438\n",
      "MEK1_pS217_S221         -0.030941528  0.2318928285  0.004010297  0.0083449824\n",
      "ERK2                     0.087565692 -0.1079920787 -0.139325221 -0.1254722842\n",
      "p38_MAPK                -0.161538014  0.0338754166 -0.076456544  0.1288425695\n",
      "p38_pT180_Y182          -0.138012404  0.0436444044 -0.043680183  0.1167648673\n",
      "JNK2                    -0.012411337  0.0334635336 -0.004481356 -0.0354013123\n",
      "c.Met_pY1235            -0.191591526  0.0382267582  0.061028161 -0.0420255564\n",
      "Mre11                    0.128420186 -0.1048844159  0.082303311  0.1685214665\n",
      "c.Myc                   -0.190408782  0.0345809924  0.057704053 -0.0414294087\n",
      "MYH11                   -0.021060375 -0.0392854684  0.029025648 -0.0242927570\n",
      "NDRG1_pT346             -0.124694096  0.0945253399 -0.066096362 -0.1231505329\n",
      "NF2                     -0.154265482  0.0237446020 -0.094382821  0.1229357778\n",
      "NF.kB.p65_pS536         -0.002041525 -0.0061295643  0.008685604 -0.0307085765\n",
      "Notch1                   0.010048334 -0.0315432552  0.004176455  0.0125401124\n",
      "N.Ras                   -0.076543536 -0.0577973189  0.185070246  0.1522937155\n",
      "Heregulin                0.166827050 -0.0240122544  0.086482035 -0.1128214538\n",
      "DJ.1                     0.010437762  0.0009256618  0.005567332 -0.0166874375\n",
      "PCNA                    -0.060578704 -0.0661905360  0.178153081  0.1634771358\n",
      "PDCD4                    0.043876756  0.1001616576  0.170416491  0.0181978212\n",
      "                                    5            6             7            8\n",
      "ACC1                    -1.590916e-02  0.056637657 -0.0291572261  0.027014913\n",
      "ACC_pS79                -3.672456e-05  0.067375789 -0.0215268690  0.047032868\n",
      "ACVRL1                   4.434559e-02 -0.019930508 -0.3379945786 -0.002002896\n",
      "Akt_pS473                3.647476e-01 -0.231426290  0.2764927898  0.081113490\n",
      "PRAS40_pT246             2.495298e-02 -0.005037642  0.0378536741  0.001180361\n",
      "Annexin.1               -7.169524e-02 -0.021427751  0.1379080602 -0.099117637\n",
      "AR                      -1.012086e-01  0.168390767 -0.0029531798  0.022855752\n",
      "A.Raf_pS299              6.129378e-02 -0.013264752  0.0107638984 -0.026841046\n",
      "ASNS                    -5.205255e-02  0.043039331  0.0126585860 -0.009228605\n",
      "ATM                     -8.443678e-03  0.028295835 -0.0082518084  0.033904678\n",
      "Bad_pS112                1.775954e-01 -0.015398281  0.1432272984 -0.202980362\n",
      "Bak                     -1.113021e-02 -0.021492782 -0.0191994975  0.074005413\n",
      "Bap1.c.4                -2.766827e-02 -0.032993727 -0.0602527315  0.068603073\n",
      "Bax                     -2.527365e-03 -0.089684646 -0.0324889383  0.020198051\n",
      "Bcl.2                    1.947428e-01 -0.236299873 -0.2075945756 -0.122770401\n",
      "Bcl.xL                  -1.159638e-02 -0.017889347 -0.0123764841  0.027058239\n",
      "Bim                      5.354875e-02  0.015700904 -0.1059000834  0.159624174\n",
      "Beclin                  -2.370605e-02  0.047774411  0.0176662273 -0.077263626\n",
      "Bid                     -2.192471e-01  0.163874024 -0.0380478557  0.014818161\n",
      "B.Raf                    7.216991e-02  0.118980205  0.0132925866  0.055094621\n",
      "BRCA2                   -5.277151e-03  0.012115117 -0.0045415401  0.001353572\n",
      "Caspase.7_cleavedD198   -4.476196e-02  0.085136739  0.0493808789 -0.124240940\n",
      "Caveolin.1              -1.685529e-01 -0.140679058  0.0415099938  0.142024070\n",
      "Cyclin_B1                6.094770e-02  0.059594691 -0.0517403469  0.246032239\n",
      "Cyclin_D1               -2.617888e-01  0.010794255  0.0899183499 -0.111948803\n",
      "Cyclin_E1                4.338835e-02  0.072081960  0.0157535765  0.037394170\n",
      "Cyclin_E2               -7.510310e-03 -0.043727599 -0.0492400256  0.037904038\n",
      "E.Cadherin               6.083599e-02  0.090208653  0.0408111561 -0.221822410\n",
      "N.Cadherin              -1.679289e-02 -0.024245271 -0.0606337979  0.046249788\n",
      "P.Cadherin               3.155054e-02  0.111604160  0.0667626986  0.009271805\n",
      "p21                     -2.921662e-01 -0.046596456  0.1933973552  0.233406309\n",
      "p27                     -2.227482e-02 -0.057994676 -0.0148583321  0.041492502\n",
      "p27_pT157               -2.734349e-03 -0.007793828 -0.0018647547 -0.009119116\n",
      "p27_pT198               -6.573849e-02 -0.024021745  0.0022642643  0.076815028\n",
      "Chk1                    -3.065943e-02 -0.092659723 -0.0214575696 -0.061071157\n",
      "Chk1_pS345              -2.181779e-03 -0.043151349  0.0122576965 -0.047931655\n",
      "Chk2                     1.519296e-01  0.170745089 -0.1951028069  0.048401597\n",
      "Chk2_pT68                1.478490e-01  0.069482105 -0.0776790368 -0.078945641\n",
      "Claudin.7               -9.116777e-02  0.170758265 -0.0877943258 -0.139610300\n",
      "Collagen_VI             -9.821704e-02 -0.064771399 -0.0547173641 -0.025915551\n",
      "beta.Catenin             5.572662e-02  0.032778495  0.0738730216 -0.115072998\n",
      "ARHI                    -3.852530e-02 -0.195149079 -0.3613434423  0.077513579\n",
      "Dvl3                     9.357551e-02 -0.187034600 -0.0329803210  0.041823357\n",
      "eEF2                    -6.949445e-03  0.068602100  0.0096395134 -0.010223256\n",
      "eEF2K                   -2.855109e-03  0.068850218 -0.0367871688 -0.088135612\n",
      "EGFR                    -3.346978e-03  0.007159569 -0.0018417113 -0.021917589\n",
      "EGFR_pY1068              1.831675e-02  0.112286057 -0.0043077245  0.046551938\n",
      "EGFR_pY1173             -7.272145e-03  0.028026964 -0.0055559491 -0.003116126\n",
      "eIF4E                    9.693457e-02 -0.201545515 -0.0404870428  0.118147883\n",
      "4E.BP1                  -1.336148e-02 -0.044283442 -0.0221473820  0.056449365\n",
      "4E.BP1_pS65              3.608542e-02 -0.002823710  0.0146358025 -0.046536973\n",
      "4E.BP1_pT70              2.088600e-02 -0.019241786  0.0103147696 -0.018972511\n",
      "eIF4G                    3.297306e-02  0.126185241 -0.0232710441  0.148061417\n",
      "HER2                    -5.387541e-02  0.188236916  0.0631591644  0.101619075\n",
      "HER2_pY1248             -6.650418e-02  0.095353350 -0.0049441661  0.076503004\n",
      "HER3                    -8.087102e-02  0.053212705  0.0491936889 -0.030630060\n",
      "HER3_pY1289             -2.673808e-02 -0.073479502 -0.0067628283  0.056382878\n",
      "MIG.6                   -5.745966e-02  0.030867523 -0.0003629101  0.037605596\n",
      "ER.alpha                 3.057090e-02  0.254903715 -0.1709248514 -0.022525331\n",
      "ER.alpha_pS118          -2.950234e-03  0.226883161 -0.0452795211 -0.201670453\n",
      "ETS.1                   -3.109059e-02 -0.017083967 -0.0251064705 -0.043981848\n",
      "FASN                     1.918802e-03  0.111012624 -0.1278032895  0.060660363\n",
      "Fibronectin             -9.564361e-02 -0.084854579  0.1117021167  0.211576291\n",
      "FoxM1                    9.844516e-02  0.058565636 -0.1097909505  0.177603141\n",
      "FOXO3a                   8.046785e-04 -0.005642557 -0.0163627252  0.055767564\n",
      "FOXO3a_pS318_S321       -5.138558e-02  0.006838428  0.0605184814  0.045686863\n",
      "G6PD                     4.801222e-02 -0.011593056 -0.0068687968 -0.010232130\n",
      "GAB2                     3.090316e-02  0.173965451 -0.1096912705  0.045770380\n",
      "GAPDH                    1.472107e-01  0.235912189  0.0521034554  0.093595042\n",
      "GATA3                    1.299640e-02 -0.005892770 -0.0083276622 -0.002887516\n",
      "GSK3.alpha.beta         -1.562603e-02  0.031177638  0.0868463383  0.015022635\n",
      "GSK3.alpha.beta_pS21_S9  9.549126e-02 -0.042409720  0.0795487928 -0.122360096\n",
      "GSK3_pS9                 1.152648e-01 -0.046144329  0.0700173533 -0.098335665\n",
      "HSP70                   -2.779555e-01 -0.079680351 -0.0689728047 -0.258213162\n",
      "IGFBP2                  -6.021270e-02  0.023170170 -0.0259773415  0.082125959\n",
      "IRS1                    -5.333218e-02 -0.016160521 -0.0306911051 -0.032450202\n",
      "CD49b                   -3.273944e-02 -0.010940969  0.0250894241  0.008393707\n",
      "c.Jun_pS73               3.864512e-02  0.002798426  0.0358482698  0.047795588\n",
      "VEGFR2                  -5.194025e-02 -0.117063449  0.1571438734 -0.025740083\n",
      "c.Kit                    1.532138e-02 -0.054946258  0.0836905486  0.072677989\n",
      "Lck                     -2.248814e-02 -0.015239892 -0.0346068462 -0.063421200\n",
      "MEK1                    -9.315295e-02  0.020555002 -0.0469722791  0.005571314\n",
      "MEK1_pS217_S221         -7.943575e-03 -0.037296737  0.1036411428 -0.081038923\n",
      "ERK2                     3.618475e-02  0.115845232  0.0962519088 -0.018074625\n",
      "p38_MAPK                 5.842730e-03 -0.078780167  0.0671295784 -0.066105179\n",
      "p38_pT180_Y182           1.193773e-01 -0.142461140  0.0869447202 -0.204896479\n",
      "JNK2                     1.643955e-01  0.318699239  0.1813775234  0.030481037\n",
      "c.Met_pY1235             2.211256e-03  0.012885186  0.0044558942 -0.018451216\n",
      "Mre11                   -4.638794e-02 -0.004655554  0.0315293053 -0.042148287\n",
      "c.Myc                   -4.312237e-02  0.050670897 -0.0166974123 -0.012504146\n",
      "MYH11                   -2.347654e-01 -0.131087603 -0.0699010925  0.105206268\n",
      "NDRG1_pT346              2.810678e-02 -0.123388223  0.0964591517  0.051989701\n",
      "NF2                      9.354895e-04 -0.013249259  0.0260392080  0.035480666\n",
      "NF.kB.p65_pS536          2.627501e-03 -0.027749889 -0.3050347795 -0.281544336\n",
      "Notch1                   4.554585e-02 -0.077173525 -0.3083447049  0.042058640\n",
      "N.Ras                    1.294464e-02  0.012584551 -0.0563697378  0.007501046\n",
      "Heregulin               -1.076455e-02 -0.047356253 -0.0794210971  0.034309763\n",
      "DJ.1                     3.514215e-01  0.010367383 -0.0439090375  0.170588349\n",
      "PCNA                     7.834237e-02  0.027250663 -0.0395295758  0.058374930\n",
      "PDCD4                    5.579626e-02 -0.027653604  0.0270696469 -0.289718117\n",
      "                                    9           10\n",
      "ACC1                     0.0114817550 -0.012752389\n",
      "ACC_pS79                 0.0446109106 -0.026128661\n",
      "ACVRL1                   0.0451577903 -0.347354807\n",
      "Akt_pS473                0.0926598082 -0.097244266\n",
      "PRAS40_pT246             0.0682105150 -0.041147230\n",
      "Annexin.1                0.0526605879  0.019164135\n",
      "AR                      -0.0425510415  0.081453198\n",
      "A.Raf_pS299              0.0030370480 -0.024854489\n",
      "ASNS                     0.0705018700 -0.000600001\n",
      "ATM                     -0.0664362513  0.077362522\n",
      "Bad_pS112                0.0119289106 -0.100710658\n",
      "Bak                     -0.0236948958 -0.036631421\n",
      "Bap1.c.4                 0.0260582048  0.061137537\n",
      "Bax                     -0.0438368846  0.002664077\n",
      "Bcl.2                   -0.4090067674  0.133395459\n",
      "Bcl.xL                   0.0008857576 -0.024103568\n",
      "Bim                     -0.0233034418  0.046015459\n",
      "Beclin                   0.0509081720  0.009786699\n",
      "Bid                     -0.0854986397 -0.060598186\n",
      "B.Raf                   -0.0344198321  0.151985225\n",
      "BRCA2                    0.0240657976  0.013884553\n",
      "Caspase.7_cleavedD198   -0.0045306094 -0.058949736\n",
      "Caveolin.1              -0.1671768965  0.051333255\n",
      "Cyclin_B1                0.1528798894  0.185673663\n",
      "Cyclin_D1               -0.1006977642 -0.170148614\n",
      "Cyclin_E1                0.1440821308  0.007736146\n",
      "Cyclin_E2               -0.0007672942 -0.019289437\n",
      "E.Cadherin              -0.0339441354  0.069161749\n",
      "N.Cadherin               0.0632266327  0.017876046\n",
      "P.Cadherin              -0.0157946629 -0.066851655\n",
      "p21                      0.1272696400 -0.070974101\n",
      "p27                     -0.0418486426  0.028254105\n",
      "p27_pT157                0.0026602109 -0.032013875\n",
      "p27_pT198               -0.0076277832 -0.019257229\n",
      "Chk1                     0.0244436735 -0.005668330\n",
      "Chk1_pS345               0.0216846891  0.012746231\n",
      "Chk2                     0.0774645629 -0.179509646\n",
      "Chk2_pT68                0.2663443725 -0.077993954\n",
      "Claudin.7               -0.1017987479  0.099981431\n",
      "Collagen_VI             -0.0912967043  0.008524742\n",
      "beta.Catenin            -0.0000509920  0.184855993\n",
      "ARHI                     0.0256562665 -0.231036781\n",
      "Dvl3                     0.2919486530  0.278113789\n",
      "eEF2                     0.0087893978  0.014485302\n",
      "eEF2K                    0.0355001523  0.105488709\n",
      "EGFR                    -0.0339473632 -0.030156694\n",
      "EGFR_pY1068             -0.0698220800 -0.053395517\n",
      "EGFR_pY1173             -0.0205144876 -0.010791584\n",
      "eIF4E                   -0.0739320945 -0.126362580\n",
      "4E.BP1                  -0.0172546276 -0.008676656\n",
      "4E.BP1_pS65              0.0451709723  0.077385544\n",
      "4E.BP1_pT70              0.0450598591  0.038727817\n",
      "eIF4G                    0.1461122410  0.189946728\n",
      "HER2                    -0.0136513465 -0.080286270\n",
      "HER2_pY1248              0.0036445093 -0.082847651\n",
      "HER3                    -0.0368694827 -0.032804463\n",
      "HER3_pY1289              0.0748268424 -0.039070364\n",
      "MIG.6                    0.0250656524 -0.070596313\n",
      "ER.alpha                 0.0335580674  0.012876857\n",
      "ER.alpha_pS118           0.0520642215 -0.018212079\n",
      "ETS.1                   -0.0157225661 -0.103580696\n",
      "FASN                     0.0063518857 -0.038141014\n",
      "Fibronectin             -0.0011194370 -0.037079665\n",
      "FoxM1                    0.0970963894  0.128974406\n",
      "FOXO3a                  -0.0765152415  0.014497060\n",
      "FOXO3a_pS318_S321       -0.0132366244 -0.011959437\n",
      "G6PD                    -0.0360939218 -0.037468093\n",
      "GAB2                     0.1168798415  0.019126130\n",
      "GAPDH                   -0.1320396355 -0.071109679\n",
      "GATA3                   -0.0525255638 -0.022867855\n",
      "GSK3.alpha.beta         -0.0040756739  0.083468456\n",
      "GSK3.alpha.beta_pS21_S9 -0.0077938375 -0.006356566\n",
      "GSK3_pS9                 0.0102960691 -0.023594230\n",
      "HSP70                   -0.0030839057 -0.132714557\n",
      "IGFBP2                  -0.0298943695  0.120678979\n",
      "IRS1                    -0.0318865937 -0.010640542\n",
      "CD49b                    0.0525262181  0.002449562\n",
      "c.Jun_pS73               0.0403203821 -0.001307756\n",
      "VEGFR2                  -0.0535339976  0.106013548\n",
      "c.Kit                   -0.1579858723  0.047462532\n",
      "Lck                     -0.0738757809 -0.057426485\n",
      "MEK1                    -0.1110452532  0.038131300\n",
      "MEK1_pS217_S221         -0.0024521375 -0.001351452\n",
      "ERK2                    -0.0270946368 -0.054761515\n",
      "p38_MAPK                -0.0309559062  0.003253390\n",
      "p38_pT180_Y182          -0.0345738306 -0.088339644\n",
      "JNK2                    -0.4182992402 -0.007975316\n",
      "c.Met_pY1235             0.0284006038  0.017920557\n",
      "Mre11                    0.0187340906  0.026156432\n",
      "c.Myc                   -0.0163078605 -0.001689716\n",
      "MYH11                   -0.2553814960  0.288479720\n",
      "NDRG1_pT346              0.0474405498 -0.055798171\n",
      "NF2                     -0.0034813792 -0.032068760\n",
      "NF.kB.p65_pS536          0.0741507798  0.423519937\n",
      "Notch1                  -0.1622839848 -0.114651255\n",
      "N.Ras                    0.0242513748 -0.011715821\n",
      "Heregulin               -0.0059969500 -0.058164105\n",
      "DJ.1                    -0.2408137053  0.020894517\n",
      "PCNA                    -0.0635315667  0.024288568\n",
      "PDCD4                    0.0520780157 -0.046847938\n",
      "\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(out2$factorizations)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [],
   "source": [
    "## Compare factorizations obtained through different methods\n",
    "## INPUTS: \n",
    "# factorizations = list of factorization results\n",
    "# methods = list of ran factorization methods\n",
    "# in.folder = path to input folder\n",
    "# out.folder = path to output folder\n",
    "# icluster.clusters = clustering result of iCluster\n",
    "# intNMF.clusters = clustering result of intNMF\n",
    "# number_cl = number of clusters\n",
    "## OUPUTS: matrix of Jaccard Indexes is saved to table in out.folder\n",
    "clusters_comparison <- function(factorizations, methods, in.folder, out.folder,number_cl) {\n",
    "\n",
    "    ind <- 0\n",
    "    JI_final <- matrix(data=NA, nrow=number_cl, ncol=length(factorizations))\n",
    "    #cat(JI_final,\"\\n\")\n",
    "    # Read clusters imposed on simulated data \n",
    "    cl  <- as.matrix(read.table(paste0(in.folder, \"clusters.txt\"), \n",
    "                                sep=\"\\t\", row.names=1, header=TRUE))\n",
    "    #cat(\"cl:\",cl,\"\\t\")\n",
    "    cl2 <- as.matrix(as.numeric(cl[,2]))\n",
    "    cat(\"cl2:\",cl2[,1],\"\\n\")\n",
    "    rownames(cl2) <- cl[,1]\n",
    "    #print(length(factorizations))\n",
    "    # Assigning samples to cluster based on factors\n",
    "    for (i in 1:length(factorizations)) {\n",
    "        \n",
    "        if (methods[i]==\"iCluster\" || methods[i]==\"intNMF\") {\n",
    "            \n",
    "        } else {\n",
    "            \n",
    "            factors <- factorizations[[i]][[1]]\n",
    "            #print(factors)\n",
    "            # Clustering by Kmeans\n",
    "            JI_good <- numeric(0)\n",
    "            for (run in 1:1) {\n",
    "                kmeans.out <- kmeans(factors, centers=number_cl) \n",
    "                clust_iCluster <- as.matrix(kmeans.out$cluster)\n",
    "                cat(\"clust_iCluster:\",clust_iCluster,\"\\n\")\n",
    "                ######creation sets of samples\n",
    "                JI_mat <- numeric(0)\n",
    "                for (p in 1:number_cl) {\n",
    "                    x1  <- rownames(clust_iCluster)[which(clust_iCluster[,1]==p)]\n",
    "                    print(x1)\n",
    "                        \n",
    "                    row <- numeric(0)\n",
    "                    for(j in 1:number_cl) {\n",
    "                        x2  <- rownames(cl2)[which(cl2[,1]==j)]\n",
    "                        cat(\"x2:\",x2,\"\\n\")\n",
    "                        I   <- length(intersect(x1,x2))#交集\n",
    "                        cat(\"I:\",I,\"\\n\")\n",
    "                        S   <- I/(length(x1)+length(x2)-I)\n",
    "                        cat(\"S:\",S,\"\\n\")\n",
    "                        row <- cbind(row,S)\n",
    "                        cat(\"row:\",row,\"\\n\")\n",
    "                     }\n",
    "                     JI_mat <- rbind(JI_mat,row)\n",
    "                     cat(\"JI_mat:\",JI_mat,\"\\n\")\n",
    "                     print(JI_mat)\n",
    "                     \n",
    "                    \n",
    "                 }\n",
    "                 JI_good <- rbind(JI_good,apply(JI_mat,1,max))\n",
    "                 cat(\"JI_good:\",JI_good,\"\\n\")\n",
    "            }\n",
    "            JI_final[1:number_cl,i] <- apply(JI_good,2,mean)\n",
    "        }\n",
    "    }\n",
    "    \n",
    "    # Export JI values to a file \n",
    "    write.table(JI_final, paste0(out.folder,\"/JI.txt\"), sep=\"\\t\", row.names=FALSE, col.names=methods)\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "cl2: 4 1 2 3 1 1 2 2 3 1 4 4 2 1 3 1 2 1 1 1 4 4 5 2 1 1 5 2 5 2 4 2 3 3 1 1 4 2 2 4 5 1 3 3 2 1 1 3 4 3 5 3 5 3 5 4 1 4 3 3 4 4 2 5 3 3 2 1 5 5 2 2 1 3 4 3 2 3 2 3 3 4 1 1 4 5 1 1 4 1 4 4 2 2 4 5 5 5 1 5 \n",
      "[1] 1\n",
      "clust_iCluster: 5 1 3 4 1 1 3 3 4 1 5 5 3 1 4 1 3 1 1 1 5 5 2 3 1 1 2 3 2 3 5 3 4 4 1 1 5 3 3 5 2 1 4 4 3 1 1 4 5 4 2 4 2 4 2 5 1 5 4 4 5 5 3 2 4 4 3 1 2 2 3 3 1 4 5 4 3 4 3 4 4 5 1 1 5 2 1 1 5 1 5 5 3 3 5 2 2 2 1 2 \n",
      " [1] \"subject2\"  \"subject5\"  \"subject6\"  \"subject10\" \"subject14\" \"subject16\"\n",
      " [7] \"subject18\" \"subject19\" \"subject20\" \"subject25\" \"subject26\" \"subject35\"\n",
      "[13] \"subject36\" \"subject42\" \"subject46\" \"subject47\" \"subject57\" \"subject68\"\n",
      "[19] \"subject73\" \"subject83\" \"subject84\" \"subject87\" \"subject88\" \"subject90\"\n",
      "[25] \"subject99\"\n",
      "x2: subject2 subject5 subject6 subject10 subject14 subject16 subject18 subject19 subject20 subject25 subject26 subject35 subject36 subject42 subject46 subject47 subject57 subject68 subject73 subject83 subject84 subject87 subject88 subject90 subject99 \n",
      "I: 25 \n",
      "S: 1 \n",
      "row: 1 \n",
      "x2: subject3 subject7 subject8 subject13 subject17 subject24 subject28 subject30 subject32 subject38 subject39 subject45 subject63 subject67 subject71 subject72 subject77 subject79 subject93 subject94 \n",
      "I: 0 \n",
      "S: 0 \n",
      "row: 1 0 \n",
      "x2: subject4 subject9 subject15 subject33 subject34 subject43 subject44 subject48 subject50 subject52 subject54 subject59 subject60 subject65 subject66 subject74 subject76 subject78 subject80 subject81 \n",
      "I: 0 \n",
      "S: 0 \n",
      "row: 1 0 0 \n",
      "x2: subject1 subject11 subject12 subject21 subject22 subject31 subject37 subject40 subject49 subject56 subject58 subject61 subject62 subject75 subject82 subject85 subject89 subject91 subject92 subject95 \n",
      "I: 0 \n",
      "S: 0 \n",
      "row: 1 0 0 0 \n",
      "x2: subject23 subject27 subject29 subject41 subject51 subject53 subject55 subject64 subject69 subject70 subject86 subject96 subject97 subject98 subject100 \n",
      "I: 0 \n",
      "S: 0 \n",
      "row: 1 0 0 0 0 \n",
      "JI_mat: 1 0 0 0 0 \n",
      "     S S S S S\n",
      "[1,] 1 0 0 0 0\n",
      " [1] \"subject23\"  \"subject27\"  \"subject29\"  \"subject41\"  \"subject51\" \n",
      " [6] \"subject53\"  \"subject55\"  \"subject64\"  \"subject69\"  \"subject70\" \n",
      "[11] \"subject86\"  \"subject96\"  \"subject97\"  \"subject98\"  \"subject100\"\n",
      "x2: subject2 subject5 subject6 subject10 subject14 subject16 subject18 subject19 subject20 subject25 subject26 subject35 subject36 subject42 subject46 subject47 subject57 subject68 subject73 subject83 subject84 subject87 subject88 subject90 subject99 \n",
      "I: 0 \n",
      "S: 0 \n",
      "row: 0 \n",
      "x2: subject3 subject7 subject8 subject13 subject17 subject24 subject28 subject30 subject32 subject38 subject39 subject45 subject63 subject67 subject71 subject72 subject77 subject79 subject93 subject94 \n",
      "I: 0 \n",
      "S: 0 \n",
      "row: 0 0 \n",
      "x2: subject4 subject9 subject15 subject33 subject34 subject43 subject44 subject48 subject50 subject52 subject54 subject59 subject60 subject65 subject66 subject74 subject76 subject78 subject80 subject81 \n",
      "I: 0 \n",
      "S: 0 \n",
      "row: 0 0 0 \n",
      "x2: subject1 subject11 subject12 subject21 subject22 subject31 subject37 subject40 subject49 subject56 subject58 subject61 subject62 subject75 subject82 subject85 subject89 subject91 subject92 subject95 \n",
      "I: 0 \n",
      "S: 0 \n",
      "row: 0 0 0 0 \n",
      "x2: subject23 subject27 subject29 subject41 subject51 subject53 subject55 subject64 subject69 subject70 subject86 subject96 subject97 subject98 subject100 \n",
      "I: 15 \n",
      "S: 1 \n",
      "row: 0 0 0 0 1 \n",
      "JI_mat: 1 0 0 0 0 0 0 0 0 1 \n",
      "     S S S S S\n",
      "[1,] 1 0 0 0 0\n",
      "[2,] 0 0 0 0 1\n",
      " [1] \"subject3\"  \"subject7\"  \"subject8\"  \"subject13\" \"subject17\" \"subject24\"\n",
      " [7] \"subject28\" \"subject30\" \"subject32\" \"subject38\" \"subject39\" \"subject45\"\n",
      "[13] \"subject63\" \"subject67\" \"subject71\" \"subject72\" \"subject77\" \"subject79\"\n",
      "[19] \"subject93\" \"subject94\"\n",
      "x2: subject2 subject5 subject6 subject10 subject14 subject16 subject18 subject19 subject20 subject25 subject26 subject35 subject36 subject42 subject46 subject47 subject57 subject68 subject73 subject83 subject84 subject87 subject88 subject90 subject99 \n",
      "I: 0 \n",
      "S: 0 \n",
      "row: 0 \n",
      "x2: subject3 subject7 subject8 subject13 subject17 subject24 subject28 subject30 subject32 subject38 subject39 subject45 subject63 subject67 subject71 subject72 subject77 subject79 subject93 subject94 \n",
      "I: 20 \n",
      "S: 1 \n",
      "row: 0 1 \n",
      "x2: subject4 subject9 subject15 subject33 subject34 subject43 subject44 subject48 subject50 subject52 subject54 subject59 subject60 subject65 subject66 subject74 subject76 subject78 subject80 subject81 \n",
      "I: 0 \n",
      "S: 0 \n",
      "row: 0 1 0 \n",
      "x2: subject1 subject11 subject12 subject21 subject22 subject31 subject37 subject40 subject49 subject56 subject58 subject61 subject62 subject75 subject82 subject85 subject89 subject91 subject92 subject95 \n",
      "I: 0 \n",
      "S: 0 \n",
      "row: 0 1 0 0 \n",
      "x2: subject23 subject27 subject29 subject41 subject51 subject53 subject55 subject64 subject69 subject70 subject86 subject96 subject97 subject98 subject100 \n",
      "I: 0 \n",
      "S: 0 \n",
      "row: 0 1 0 0 0 \n",
      "JI_mat: 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 \n",
      "     S S S S S\n",
      "[1,] 1 0 0 0 0\n",
      "[2,] 0 0 0 0 1\n",
      "[3,] 0 1 0 0 0\n",
      " [1] \"subject4\"  \"subject9\"  \"subject15\" \"subject33\" \"subject34\" \"subject43\"\n",
      " [7] \"subject44\" \"subject48\" \"subject50\" \"subject52\" \"subject54\" \"subject59\"\n",
      "[13] \"subject60\" \"subject65\" \"subject66\" \"subject74\" \"subject76\" \"subject78\"\n",
      "[19] \"subject80\" \"subject81\"\n",
      "x2: subject2 subject5 subject6 subject10 subject14 subject16 subject18 subject19 subject20 subject25 subject26 subject35 subject36 subject42 subject46 subject47 subject57 subject68 subject73 subject83 subject84 subject87 subject88 subject90 subject99 \n",
      "I: 0 \n",
      "S: 0 \n",
      "row: 0 \n",
      "x2: subject3 subject7 subject8 subject13 subject17 subject24 subject28 subject30 subject32 subject38 subject39 subject45 subject63 subject67 subject71 subject72 subject77 subject79 subject93 subject94 \n",
      "I: 0 \n",
      "S: 0 \n",
      "row: 0 0 \n",
      "x2: subject4 subject9 subject15 subject33 subject34 subject43 subject44 subject48 subject50 subject52 subject54 subject59 subject60 subject65 subject66 subject74 subject76 subject78 subject80 subject81 \n",
      "I: 20 \n",
      "S: 1 \n",
      "row: 0 0 1 \n",
      "x2: subject1 subject11 subject12 subject21 subject22 subject31 subject37 subject40 subject49 subject56 subject58 subject61 subject62 subject75 subject82 subject85 subject89 subject91 subject92 subject95 \n",
      "I: 0 \n",
      "S: 0 \n",
      "row: 0 0 1 0 \n",
      "x2: subject23 subject27 subject29 subject41 subject51 subject53 subject55 subject64 subject69 subject70 subject86 subject96 subject97 subject98 subject100 \n",
      "I: 0 \n",
      "S: 0 \n",
      "row: 0 0 1 0 0 \n",
      "JI_mat: 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 \n",
      "     S S S S S\n",
      "[1,] 1 0 0 0 0\n",
      "[2,] 0 0 0 0 1\n",
      "[3,] 0 1 0 0 0\n",
      "[4,] 0 0 1 0 0\n",
      " [1] \"subject1\"  \"subject11\" \"subject12\" \"subject21\" \"subject22\" \"subject31\"\n",
      " [7] \"subject37\" \"subject40\" \"subject49\" \"subject56\" \"subject58\" \"subject61\"\n",
      "[13] \"subject62\" \"subject75\" \"subject82\" \"subject85\" \"subject89\" \"subject91\"\n",
      "[19] \"subject92\" \"subject95\"\n",
      "x2: subject2 subject5 subject6 subject10 subject14 subject16 subject18 subject19 subject20 subject25 subject26 subject35 subject36 subject42 subject46 subject47 subject57 subject68 subject73 subject83 subject84 subject87 subject88 subject90 subject99 \n",
      "I: 0 \n",
      "S: 0 \n",
      "row: 0 \n",
      "x2: subject3 subject7 subject8 subject13 subject17 subject24 subject28 subject30 subject32 subject38 subject39 subject45 subject63 subject67 subject71 subject72 subject77 subject79 subject93 subject94 \n",
      "I: 0 \n",
      "S: 0 \n",
      "row: 0 0 \n",
      "x2: subject4 subject9 subject15 subject33 subject34 subject43 subject44 subject48 subject50 subject52 subject54 subject59 subject60 subject65 subject66 subject74 subject76 subject78 subject80 subject81 \n",
      "I: 0 \n",
      "S: 0 \n",
      "row: 0 0 0 \n",
      "x2: subject1 subject11 subject12 subject21 subject22 subject31 subject37 subject40 subject49 subject56 subject58 subject61 subject62 subject75 subject82 subject85 subject89 subject91 subject92 subject95 \n",
      "I: 20 \n",
      "S: 1 \n",
      "row: 0 0 0 1 \n",
      "x2: subject23 subject27 subject29 subject41 subject51 subject53 subject55 subject64 subject69 subject70 subject86 subject96 subject97 subject98 subject100 \n",
      "I: 0 \n",
      "S: 0 \n",
      "row: 0 0 0 1 0 \n",
      "JI_mat: 1 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 \n",
      "     S S S S S\n",
      "[1,] 1 0 0 0 0\n",
      "[2,] 0 0 0 0 1\n",
      "[3,] 0 1 0 0 0\n",
      "[4,] 0 0 1 0 0\n",
      "[5,] 0 0 0 1 0\n",
      "JI_good: 1 1 1 1 1 \n"
     ]
    }
   ],
   "source": [
    "clusters_comparison(out2$factorizations, out2$method, \"../data/simulations_20210329212141/equal/5/\", \"./\", 5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  RGCCA\n",
      "1  0.00\n",
      "2  0.35\n",
      "3  0.50\n",
      "4  0.00\n",
      "5  1.00\n",
      "  RGCCA_EQ\n",
      "1     0.00\n",
      "2     0.35\n",
      "3     0.50\n",
      "4     0.00\n",
      "5     1.00\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAA0gAAANICAMAAADKOT/pAAACylBMVEUAAAABAQECAgIDAwME\nBAQFBQUGBgYHBwcICAgJCQkKCgoLCwsMDAwNDQ0ODg4PDw8QEBARERESEhITExMUFBQVFRUW\nFhYXFxcYGBgZGRkaGhobGxscHBwdHR0eHh4fHx8gICAhISEjIyMkJCQlJSUmJiYnJycoKCgp\nKSkqKiorKyssLCwtLS0uLi4vLy8wMDAxMTEzMzM0NDQ1NTU2NjY3Nzc4ODg5OTk6Ojo7Ozs8\nPDw9PT0+Pj4/Pz9BQUFCQkJDQ0NERERFRUVGRkZHR0dISEhJSUlKSkpLS0tMTExNTU1OTk5P\nT09RUVFSUlJTU1NUVFRVVVVWVlZXV1dZWVlaWlpbW1tdXV1eXl5gYGBhYWFiYmJjY2NkZGRm\nZmZnZ2doaGhqampra2tsbGxtbW1ubm5vb29xcXFycnJzc3N0dHR2dnZ3d3d4eHh5eX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7Obk36WAjIu6i9C86lw69c8Y/XqBLinyvnabLk6TUdWV20x+tUAXFXOn1VdHJGY0bqu5rxTo\nwmLv/b3lznPL72JXUjNq7gemvkqgi0v6NIpPl0wZ2ditrKEeA0ZPXx5/hyHAKak+H2nf5mcf\nW3jf7dOnzJj1wCNPrHwn1adQAA7R/8Q+wAGEBAggJEAAIQECCAkQQEiAAEICBBASIICQAAGE\nBAggJEAAIQECCAkQQEiAAEICBBASIICQAAGEBAggJEAAIQECCAkQQEiAAEICBBASIICQAAGE\nBAggJEAAIQECCAkQQEiAAEICBBASIICQAAGEBAggJEAAIQECCAkQQEiAAEICBBASIICQAAGE\nBAggJEAAIQECCAkQQEiAAEICBBASIICQAAGEBAggJEAAIQECCAkQQEiAAEICBBASIICQAAGE\nBAggJEAAIQECCAkQQEiAAEICBBASIICQAAGEBAggJEAAIQECCAkQQEiAAEICBBASIICQAAGE\nBAggJEAAIQECCAkQQEiAAEICBBASIICQAAGEBAggJEAAIQECCAkQQEiAAEICBBASIICQAAGE\nBAggJEAAIQECCAkQQEiAAEICBBASIICQAAGEBAggJEAAIQEC/h+QoUGfHaLVRQAAAABJRU5E\nrkJggg==",
      "text/plain": [
       "plot without title"
      ]
     },
     "metadata": {
      "image/png": {
       "height": 420,
       "width": 420
      },
      "text/plain": {
       "height": 420,
       "width": 420
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "eq_file <- paste0(\"JI.txt\")\n",
    "if(exists(\"JI.final\")) rm(JI.final)\n",
    "    \n",
    "    # Load clusters (equal distribution)\n",
    "if(file.exists(eq_file)) {\n",
    "    JI.final  <- read.table(eq_file, sep=\"\\t\", header=TRUE)\n",
    "    print(JI.final)\n",
    "    names(JI.final) <- paste0(names(JI.final), \"_EQ\")\n",
    "    print(JI.final)\n",
    "}\n",
    "#par(mar=c(25,4,2,2)+.1)\n",
    "boxplot(JI.final, xaxt=\"none\", cex.axis=3.5, \n",
    "                 col=c('gray','gray','red','red','blue','blue','blueviolet','blueviolet','deeppink','deeppink','chocolate1','chocolate1','darkgoldenrod','darkgoldenrod','green','green','darkturquoise','darkturquoise'), \n",
    "                 ann=FALSE, outline=FALSE)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {},
   "outputs": [
    {
     "ename": "ERROR",
     "evalue": "Error in parse(text = x, srcfile = src): <text>:16:3: unexpected string constant\n30:         }\n31:     }'\n      ^\n",
     "output_type": "error",
     "traceback": [
      "Error in parse(text = x, srcfile = src): <text>:16:3: unexpected string constant\n30:         }\n31:     }'\n      ^\nTraceback:\n"
     ]
    }
   ],
   "source": [
    "# Save all boxplots in a single PDF output file\n",
    "pdf(file=paste0(results_folder, \"simulated_boxplots.pdf\"), width = 15, height = 15, onefile = TRUE)\n",
    "\n",
    "# Output files for each distribution\n",
    "    eq_file <- paste0(\"JI.txt\")\n",
    "    if(exists(\"JI.final\")) rm(JI.final)\n",
    "    \n",
    "    # Load clusters (equal distribution)\n",
    "    if(file.exists(eq_file)) {\n",
    "        JI.final  <- read.table(eq_file, sep=\"\\t\", header=TRUE)\n",
    "        print(JI.final)\n",
    "        names(JI.final) <- paste0(names(JI.final), \"_EQ\")        \n",
    "    }\n",
    "    \n",
    "    # Load clusters (heterogeneous distribution)\n",
    "'''\n",
    "    if(file.exists(het_file)) {\n",
    "        JI.het <- read.table(het_file, sep=\"\\t\", header=TRUE)\n",
    "        names_methods <- names(JI.het)\n",
    "        names(JI.het) <- paste0(names(JI.het), \"_HET\")\n",
    "\n",
    "        # Aggregate results\n",
    "        if(exists(\"JI.final\")) {\n",
    "            JI.final <- data.frame(JI.het, JI.final)\n",
    "            new_order <- apply(expand.grid(c(\"_HET\", \"_EQ\"), names_methods)[, c(2,1)], 1, paste, collapse=\"\")\n",
    "            JI.final <- JI.final[, new_order]\n",
    "        }\n",
    "        else {\n",
    "            JI.final <- JI.het\n",
    "        }\n",
    "    }'''\n",
    "    \n",
    "    # Plot results\n",
    "    par(mar=c(25,4,2,2)+.1)\n",
    "    boxplot(JI.final, xaxt=\"none\", cex.axis=3.5, \n",
    "                 col=c('gray','gray','red','red','blue','blue','blueviolet','blueviolet','deeppink','deeppink','chocolate1','chocolate1','darkgoldenrod','darkgoldenrod','green','green','darkturquoise','darkturquoise'), \n",
    "                 ann=FALSE, outline=FALSE)\n",
    "    matplot(1:ncol(JI.final), t(JI.final), col=\"black\", pch=16, xaxt=\"none\", cex=0.8, add=TRUE)\n",
    "    axis(1, at=1:ncol(JI.final), labels=names(JI.final), \n",
    "         las=2, srt=45, cex=0.8, cex.lab=3.5, cex.axis=3.5, cex.main=1.5, cex.sub=1.5) \n",
    "    title(main=paste(i,\"clusters\",sep=\" \"), \n",
    "          cex.lab=0.75, line = -2.5, adj=0, cex.main=3.5)\n",
    "dev.off()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "R",
   "language": "R",
   "name": "ir"
  },
  "language_info": {
   "codemirror_mode": "r",
   "file_extension": ".r",
   "mimetype": "text/x-r-source",
   "name": "R",
   "pygments_lexer": "r",
   "version": "3.5.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}