#PUNTO EPECIAL, GENÓMICA EN BIOMARCADORES#
#2.11. UNA BASE DE DATOS DE EXPRESIÓN GENÓMICA EN CÁNCER DE PULMÓN DE CÉLULAS NO PEQUÑAS, DE ACEURDO CON DOS TRATAMIENTOS: UNO RESISTENTE Y UNO SENSIBLE. MOSTRANDO QUE CON EL TRATMIENTO PARA EL CUAL EL CÁNCER DE PULMÓN EN MENCIÓN ES SENSIBLE, HAY EXPRESIÓN EN BAJA DE ALGUNOS GENES Y EXPRESIÓN EN BAJA DE OTROS GENES RELACIONADOS CON LA APOPTOSIS TUMORAL. ES UNA BREVE EXPLICACIÓN AL RESPECTO DE UNA DE LAS BASES DE DATOS.

# Version info: R 4.2.2, Biobase 2.58.0, GEOquery 2.66.0, limma 3.54.0
################################################################

# load series and platform data from GEO
library(GEOquery)
## Loading required package: Biobase
## Loading required package: BiocGenerics
## 
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:stats':
## 
##     IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
## 
##     anyDuplicated, aperm, append, as.data.frame, basename, cbind,
##     colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find,
##     get, grep, grepl, intersect, is.unsorted, lapply, Map, mapply,
##     match, mget, order, paste, pmax, pmax.int, pmin, pmin.int,
##     Position, rank, rbind, Reduce, rownames, sapply, setdiff, sort,
##     table, tapply, union, unique, unsplit, which.max, which.min
## Welcome to Bioconductor
## 
##     Vignettes contain introductory material; view with
##     'browseVignettes()'. To cite Bioconductor, see
##     'citation("Biobase")', and for packages 'citation("pkgname")'.
## Setting options('download.file.method.GEOquery'='auto')
## Setting options('GEOquery.inmemory.gpl'=FALSE)
library(limma)
## 
## Attaching package: 'limma'
## The following object is masked from 'package:BiocGenerics':
## 
##     plotMA
library(umap)
gset <- getGEO("GSE221334", GSEMatrix =TRUE, AnnotGPL=FALSE)
## Found 1 file(s)
## GSE221334_series_matrix.txt.gz
if (length(gset) > 1) idx <- grep("GPL19956", attr(gset, "names")) else idx <- 1
gset <- gset[[idx]]

# make proper column names to match toptable 
fvarLabels(gset) <- make.names(fvarLabels(gset))

# group membership for all samples
gsms <- "00X11XXXXXXX"
sml <- strsplit(gsms, split="")[[1]]

# filter out excluded samples (marked as "X")
sel <- which(sml != "X")
sml <- sml[sel]
gset <- gset[ ,sel]

# log2 transformation
ex <- exprs(gset)
qx <- as.numeric(quantile(ex, c(0., 0.25, 0.5, 0.75, 0.99, 1.0), na.rm=T))
LogC <- (qx[5] > 100) ||
          (qx[6]-qx[1] > 50 && qx[2] > 0)
if (LogC) { ex[which(ex <= 0)] <- NaN
  exprs(gset) <- log2(ex) }

# assign samples to groups and set up design matrix
gs <- factor(sml)
groups <- make.names(c("tto1","tto2"))
levels(gs) <- groups
gset$group <- gs
design <- model.matrix(~group + 0, gset)
colnames(design) <- levels(gs)

gset <- gset[complete.cases(exprs(gset)), ] # skip missing values

fit <- lmFit(gset, design)  # fit linear model

# set up contrasts of interest and recalculate model coefficients
cts <- paste(groups[1], groups[2], sep="-")
cont.matrix <- makeContrasts(contrasts=cts, levels=design)
fit2 <- contrasts.fit(fit, cont.matrix)

# compute statistics and table of top significant genes
fit2 <- eBayes(fit2, 0.01)
## Warning: Zero sample variances detected, have been offset away from zero
tT <- topTable(fit2, adjust="fdr", sort.by="B", number=250)

tT <- subset(tT, select=c("ID","adj.P.Val","P.Value","t","B","logFC","GB_ACC","SPOT_ID"))
write.table(tT, file=stdout(), row.names=F, sep="\t")
## "ID" "adj.P.Val" "P.Value"   "t" "B" "logFC" "GB_ACC"    "SPOT_ID"
## "IBSP"   0.0284378147311482  7.2545445742725e-05 -34.5748634150912   2.30837537265909    -3.0797478806074    "NM_004967.3"   ""
## "RAC2"   0.0284378147311482  7.2545445742725e-05 -34.5748634150912   2.30837537265909    -3.0797478806074    "NM_002872.3"   ""
## "EYA1"   0.156315759646222   0.000766245113955456    15.2025519950692    0.638467742438322   0.80971766426229    "NM_172059.2"   ""
## "NEG_F"  0.156315759646222   0.000797529385950111    -14.9908959267622   0.599778316595135   -0.58595642709711   ""  "ERCC_00126.1"
## "CALML6" 0.209664130751946   0.00140657879153786 -12.282372664845    0.021259937231239   -3.65198548220662   "NM_138705.2"   ""
## "GRB2"   0.209664130751946   0.00222480178490143 -10.4465824757983   -0.481766181100058  -0.392411013862249  "NM_002086.4"   ""
## "COL4A3" 0.209664130751946   0.00255060730904196 -9.95254060237299   -0.636831047526385  -1.22557626840689   "NM_000091.3"   ""
## "CDC25A" 0.209664130751946   0.00288532469300679 9.5260082434113 -0.778521864845107  0.387245842202834   "NM_001789.2"   ""
## "NKD1"   0.209664130751946   0.00375659105729381 8.67081221499593    -1.08688493219524   0.353443749334671   "NM_033119.3"   ""
## "RET"    0.209664130751946   0.00413831438804682 -8.37573636411537   -1.20157219621158   -0.78134590471281   "NM_020630.4"   ""
## "PIK3R3" 0.209664130751946   0.00419133300073679 -8.33763038160584   -1.21671727156375   -0.346216569376747  "NM_003629.3"   ""
## "IGF1"   0.209664130751946   0.00469531002158976 -8.00485229097626   -1.35237657911683   -0.362554812155599  "NM_000618.3"   ""
## "FGF9"   0.209664130751946   0.00537116735767449 7.62672834806593    -1.51431073362851   0.339856413911059   "NM_002010.2"   ""
## "FOS"    0.209664130751946   0.00544472294336558 7.58942128541171    -1.53076055284833   0.717511561726223   "NM_005252.2"   ""
## "LAMC3"  0.209664130751946   0.00558037220352611 7.52235208859716    -1.56055430020963   0.392993979437164   "NM_006059.3"   ""
## "BMP8A"  0.209664130751946   0.00607566420976675 -7.29477701835583   -1.66381545159089   -0.514536983677777  "NM_181809.3"   ""
## "SOCS1"  0.209664130751946   0.00639760207758428 -7.15970432874724   -1.72673693363771   -0.410208302721639  "NM_003745.1"   ""
## "PLA1A"  0.209664130751946   0.00649110997675789 7.12215914175555    -1.74444918696743   1.19373379126119    "NM_015900.2"   ""
## "MYB"    0.209664130751946   0.00669313623572217 -7.0434464274722    -1.78190248202152   -0.288096431832184  "NM_005375.2"   ""
## "FGF21"  0.209664130751946   0.00683002871869916 -6.99188651363361   -1.80667362418531   -1.13437680738159   "NM_019113.2"   ""
## "PLCG2"  0.209664130751946   0.00740900045639499 -6.78812313407085   -1.90645684402353   -0.638664102985267  "NM_002661.2"   ""
## "WNT10B" 0.209664130751946   0.00760193562885115 -6.72487527440933   -1.93805729964667   -0.539806967105371  "NM_003394.2"   ""
## "APH1B"  0.209664130751946   0.00774607553935676 -6.67900023645843   -1.96116838372613   -0.414092594795889  "NM_001145646.1"    ""
## "SPP1"   0.209664130751946   0.0080620067964814  6.5823057715532 -2.01041466731431   0.316611528356276   "NM_000582.2"   ""
## "NTRK2"  0.209664130751946   0.00808410007400517 -6.57573272675333   -2.01378886270794   -0.474078639365731  "NM_001007097.1"    ""
## "TIAM1"  0.209664130751946   0.00826681682828336 6.52227167662832    -2.04135956959525   0.415780276730921   "NM_003253.2"   ""
## "FGF13"  0.209664130751946   0.00828319933522009 -6.51755509760402   -2.043802905536 -0.236792730766778  "NM_033642.1"   ""
## "ABL1"   0.209664130751946   0.00873578461255265 6.39195669762856    -2.10952769073832   0.241767119089825   "NM_005157.3"   ""
## "NOTCH2" 0.209664130751946   0.00900007515786481 6.32254077783988    -2.14640779510234   0.438855594484702   "NM_024408.3"   ""
## "THBS1"  0.209664130751946   0.00908521411734356 6.30075307871879    -2.15806632154826   0.241876365631319   "NM_003246.2"   ""
## "HSPA2"  0.209664130751946   0.00928498490390841 6.25067754561821    -2.18501339475947   0.53484737445056    "NM_021979.3"   ""
## "TGFB2"  0.209664130751946   0.00928568822374753 6.25050378008517    -2.18510727343565   0.40087217691341    "NM_003238.2"   ""
## "CCND3"  0.209664130751946   0.00930948534952681 6.24463462301547    -2.18827965951766   0.254993425378244   "NM_001760.2"   ""
## "E2F5"   0.209664130751946   0.00961575883880462 6.17083076796024    -2.22842419860223   0.281461214024381   "NM_001951.3"   ""
## "JUN"    0.209664130751946   0.00993020295731684 6.09823377982331    -2.26837373784726   0.299459706476872   "NM_002228.3"   ""
## "IFNG"   0.209664130751946   0.0104126987889864  -5.99257131306891   -2.32735346855391   -2.99986143518683   "NM_000619.2"   ""
## "PPP2CB" 0.209664130751946   0.0104211457350577  5.9907795870004 -2.3283622469577    0.280177682472237   "NM_001009552.1"    ""
## "PRL"    0.209664130751946   0.0107073996106906  -5.93117503383608   -2.3620875763561    -1.64664247821621   "NM_000948.3"   ""
## "DKK4"   0.209664130751946   0.0109270643332908  -5.88684957976975   -2.38737943994024   -0.272240812981186  "NM_014420.2"   ""
## "ETS2"   0.209664130751946   0.0112018938312688  5.83302682789381    -2.41833633904696   0.223715410422413   "NM_005239.4"   ""
## "WNT10A" 0.209664130751946   0.012183025441512   -5.65427731974922   -2.52312653159868   -0.431009075748783  "NM_025216.2"   ""
## "LAMA5"  0.209664130751946   0.0132079243602394  5.48682808940298    -2.62414594033513   0.349786014741899   "NM_005560.3"   ""
## "CREB5"  0.209664130751946   0.013342089355477   -5.46618103900977   -2.63679905960324   -0.436996346240472  "NM_182898.2"   ""
## "PITX2"  0.209664130751946   0.0133529396477425  -5.46452325220951   -2.63781690644146   -0.304682233994035  "NM_000325.5"   ""
## "CHUK"   0.209664130751946   0.0133999672046415  5.45735856022952    -2.64221914617768   0.20263858040072    "NM_001278.3"   ""
## "IRAK2"  0.209664130751946   0.0134776478532142  -5.44559630616313   -2.64945781615457   -0.255794422640509  "NM_001570.3"   ""
## "LEFTY1" 0.209664130751946   0.0136576175905745  5.41868645107395    -2.66607263498487   1.49770467014306    "NM_020997.2"   ""
## "DLL3"   0.209664130751946   0.0138045730707478  -5.39705806726938   -2.67948137775564   -0.579069526886043  "NM_203486.2"   ""
## "TBL1XR1"    0.209664130751946   0.0140705999775044  5.35866818462127    -2.70340282330875   0.240775108221039   "NM_024665.4"   ""
## "MAP3K5" 0.209664130751946   0.0140777651808985  5.35764746455451    -2.70404098039293   0.304861468551572   "NM_005923.3"   ""
## "ITGA9"  0.209664130751946   0.0142032352196819  -5.33988402506303   -2.71516446545794   -0.288143217065699  "NM_002207.2"   ""
## "FGF3"   0.209664130751946   0.0147036734121572  -5.27104248299813   -2.75859230181443   -0.201657972776001  "NM_005247.2"   ""
## "MAP2K2" 0.209664130751946   0.0150104100712554  -5.2303569466169    -2.78449941360306   -0.223133210488076  "NM_030662.2"   ""
## "CDC7"   0.209664130751946   0.0153625277011403  5.18498315990424    -2.81360592561083   0.203232000130827   "NM_003503.2"   ""
## "JAK1"   0.209664130751946   0.0155033961966599  5.16721325827381    -2.82506707533966   0.20659919612155    "NM_002227.1"   ""
## "RUNX1T1"    0.209664130751946   0.0155292049818096  -5.16398066927002   -2.8271557919878    -0.573199950950682  "NM_004349.2"   ""
## "TSC1"   0.209664130751946   0.0155990553406174  -5.15526721583098   -2.83279173820481   -0.200044202514219  "NM_000368.3"   ""
## "VHL"    0.209664130751946   0.0161822153689267  5.08447287558   -2.87889827239415   0.245452934229492   "NM_000551.2"   ""
## "DKK2"   0.209664130751946   0.0163148988696443  -5.0688338428417    -2.88916009056349   -0.628051401685004  "NM_014421.2"   ""
## "MET"    0.209664130751946   0.0163931862374308  5.05968470880096    -2.89517639323621   0.444075330671934   "NM_000245.2"   ""
## "BMP4"   0.209664130751946   0.0167083759779296  5.0234237990194 -2.91911535726414   0.324963381631637   "NM_001202.2"   ""
## "GHR"    0.209664130751946   0.0167417346151057  -5.01963881401942   -2.92162288444762   -0.522987907983277  "NM_000163.2"   ""
## "SFN"    0.209664130751946   0.0168480105068528  5.00764629588771    -2.92957879468839   0.187670421319776   "NM_006142.3"   ""
## "IL2RB"  0.21329856479031    0.0174552789021012  -4.94098014904721   -2.97411105719638   -0.730249943012394  "NM_000878.2"   ""
## "OSM"    0.21329856479031    0.0176841922338905  4.91663732987981    -2.9905020091668    0.675130922574021   "NM_020530.3"   ""
## "MAP2K1" 0.21744945847674    0.0184981747176826  -4.83332487630258   -3.04713449209709   -0.235855561411267  "NM_002755.2"   ""
## "CACNA1E"    0.21744945847674    0.0196633905972771  4.72210213061536    -3.12405416667442   0.310721494405255   "NM_000721.2"   ""
## "NTF3"   0.21744945847674    0.0196772329187974  -4.72083321717505   -3.12494054405341   -0.379380293602625  "NM_002527.4"   ""
## "SRSF2"  0.21744945847674    0.019817787306712   4.70801473367268    -3.13390594819382   0.197435648863836   "NM_003016.3"   ""
## "PGF"    0.21744945847674    0.0199149980206114  4.69921878745686    -3.14006983504426   0.587822136155656   "NM_002632.5"   ""
## "RASGRP1"    0.21744945847674    0.0199929094135984  4.69220969844661    -3.1449885032613    0.301711593874854   "NM_005739.3"   ""
## "COL1A1" 0.21744945847674    0.0202190819329231  4.67206413863159    -3.15916017693444   0.546057140544487   "NM_000088.3"   ""
## "ATR"    0.21744945847674    0.0202472072306148  4.66957965309413    -3.16091146841827   0.179643620227848   "NM_001184.2"   ""
## "HELLS"  0.217525797225053   0.0205317716768545  4.64469430457647    -3.17849605160511   0.397076925322438   "NM_018063.3"   ""
## "SIRT4"  0.218767119492959   0.0209279769923111  -4.6107896553446    -3.20258074742269   -0.473531006858755  "NM_012240.1"   ""
## "MAPK3"  0.221371717855219   0.0218411997590252  -4.53575061592563   -3.25641208524954   -0.221332083979123  "NM_001040056.1"    ""
## "POS_A"  0.221371717855219   0.0219505169351756  4.52704397434326    -3.26270543310217   0.189140342088736   ""  "ERCC_00117.1"
## "GDF6"   0.221371717855219   0.0222798867780555  -4.50115080954152   -3.28148034257684   -0.592244076075132  "NM_001001557.2"    ""
## "POS_D"  0.221371717855219   0.0224758815270561  4.48597959747909    -3.29252189717887   0.210162363787665   ""  "ERCC_00092.1"
## "POLR2J" 0.221371717855219   0.022588950801553   4.47730591883782    -3.29884825106338   0.281102350017772   "NM_006234.4"   ""
## "SFRP1"  0.223176534253174   0.0230577796868713  -4.44193884790286   -3.32474760867241   -0.505037211109986  "NM_003012.3"   ""
## "SOCS3"  0.223244008496892   0.0233937720477714  4.41716654167331    -3.34298800853026   0.989419205251536   "NM_003955.3"   ""
## "FGF8"   0.223244008496892   0.0236342508995434  -4.39972042520006   -3.3558835335009    -0.943249137213076  "NM_033163.3"   ""
## "IL12RB2"    0.230822477280229   0.0249210693620473  -4.31015636397035   -3.42273795779083   -0.933209146671777  "NM_001559.2"   ""
## "BMP5"   0.230822477280229   0.0250253961336982  4.30316079481413    -3.42800613140478   0.549447307276783   "NM_021073.2"   ""
## "PIK3R2" 0.232960477568158   0.0255543381005888  -4.26827010157306   -3.45438280235149   -0.190118959284007  "NM_005027.2"   ""
## "CCNA1"  0.240040763599186   0.0270175381167741  -4.17646949466228   -3.52459828751231   -0.354841710793854  "NM_003914.3"   ""
## "CDKN2B" 0.240040763599186   0.027054845113837   4.17421413624147    -3.52633838212887   0.177431660928812   "NM_004936.3"   ""
## "TGFB1"  0.240040763599186   0.0277476896019409  -4.13305182954035   -3.5582247492014    -0.310609259519218  "NM_000660.3"   ""
## "COL4A4" 0.240040763599186   0.0280808739253248  -4.11373125822283   -3.57327559186622   -0.4950971211902    "NM_000092.4"   ""
## "PRDM1"  0.240040763599186   0.0280879337405053  4.11332511222105    -3.5735925619375    0.335328204060634   "NM_182907.1"   ""
## "NASP"   0.240040763599186   0.02857951628717    4.08536746799718    -3.59546926099437   0.211947634571342   "NM_172164.1"   ""
## "FGFR3"  0.240040763599186   0.0287675741023077  4.07483726145094    -3.60373862121226   0.163593947967241   "NM_022965.2"   ""
## "GPC4"   0.240040763599186   0.0289722607227368  -4.06347734379081   -3.61267774396754   -0.269885352346654  "NM_001448.2"   ""
## "IL1RAP" 0.240040763599186   0.0290865721197993  -4.05717854445561   -3.61764242588736   -0.227445683755557  "NM_002182.2"   ""
## "PLA2G4A"    0.241352985956389   0.0301209230885996  4.0016102439869 -3.66169456376134   0.185657207336563   "NM_024420.2"   ""
## "MDC1"   0.241352985956389   0.0303754894359431  3.98831399432868    -3.67230315902695   0.147850420264026   "NM_014641.2"   ""
## "MEN1"   0.241352985956389   0.0305281101937883  -3.98041174977475   -3.67862056976554   -0.199436875917687  "NM_130802.2"   ""
## "TMPRSS2"    0.241352985956389   0.0307253608599138  -3.9702744696397    -3.68673844336211   -0.39123967233141   "NM_005656.2"   ""
## "ETV1"   0.241352985956389   0.0309991587193592  -3.95634258925934   -3.69792014603181   -0.16365345127444   "NM_004956.4"   ""
## "FANCB"  0.241352985956389   0.0311463735959048  3.94891768228156    -3.70389127800254   0.212652684889202   "NM_152633.2"   ""
## "KIT"    0.241352985956389   0.0319098372399871  3.91113013317787    -3.73440907816314   0.219379279680497   "NM_000222.1"   ""
## "SYK"    0.241352985956389   0.032084017954161   -3.90267338585744   -3.741268510278 -0.17386900416162   "NM_003177.3"   ""
## "ERBB2"  0.241352985956389   0.0325502573439119  -3.88032703754925   -3.75944649336129   -0.378890816212376  "NM_004448.2"   ""
## "ARID1B" 0.241352985956389   0.0331110558111069  -3.85399273432555   -3.78096659025376   -0.203726110296966  "NM_020732.3"   ""
## "POS_F"  0.241352985956389   0.0332880482453295  3.8458013210105 -3.787682242111 0.493245326138562   ""  "ERCC_00034.1"
## "WHSC1"  0.241352985956389   0.0333663999869417  3.84219313337973    -3.7906436591838    0.148874298540052   "NM_007331.1"   ""
## "POS_C"  0.241352985956389   0.0338852168898293  3.81857513374315    -3.81007776333164   0.145362438545584   ""  "ERCC_00002.1"
## "GADD45B"    0.241352985956389   0.0345313408926316  3.78980902765753    -3.83386481355907   0.19993059397191    "NM_015675.2"   ""
## "HIST1H3G"   0.241352985956389   0.0345519550204487  3.78890276930175    -3.83461630244746   0.139092513371914   "NM_003534.2"   ""
## "RFC3"   0.241352985956389   0.0347408881931993  3.78062920838741    -3.84148284299026   0.208858508677713   "NM_002915.3"   ""
## "RXRG"   0.241352985956389   0.0347654694443416  -3.77955705872983   -3.84237344286715   -0.556435960910893  "NM_006917.3"   ""
## "ID1"    0.241352985956389   0.0349074926330606  3.77338166729458    -3.84750663840666   0.227381444843585   "NM_002165.2"   ""
## "HDAC3"  0.241352985956389   0.0350946943865157  3.76529138671552    -3.85424058642806   0.14511977418031    "NM_003883.2"   ""
## "SUV39H2"    0.242054420715085   0.0355054316099933  3.74773483290389    -3.86888910383245   0.193448606955611   "NM_024670.3"   ""
## "UBB"    0.244149729279537   0.0365913603485429  -3.70255715462581   -3.90680699927346   -0.168274604730428  "NM_018955.2"   ""
## "BNIP3"  0.244149729279537   0.0366722017035514  -3.69926344126438   -3.90958407188155   -0.142521068073934  "NM_004052.2"   ""
## "DTX1"   0.244149729279537   0.0370465908069721  -3.68413127510223   -3.92236482659102   -0.788275835953515  "NM_004416.2"   ""
## "MPL"    0.244149729279537   0.0370584410513582  -3.68365554064031   -3.9227672270357    -1.31625259895407   "NM_005373.2"   ""
## "CCNA2"  0.244345095363325   0.0373997594943864  -3.67003696442163   -3.93430182304848   -0.141878639673349  "NM_001237.2"   ""
## "COL4A5" 0.246319163879689   0.0382731768194 3.63590718068486    -3.9633393050803    0.196071198292918   "NM_033381.1"   ""
## "CCNB1"  0.246319163879689   0.0383678325965806  -3.63226889008484   -3.96644578052601   -0.139471767487482  "NM_031966.2"   ""
## "MTMR14" 0.246319163879689   0.0386444606596962  -3.62170222498511   -3.97547998704467   -0.135718637397513  "NM_022485.3"   ""
## "RBX1"   0.250036410741664   0.0395465751683244  -3.58791044126167   -4.00449212287804   -0.140032784088332  "NM_014248.2"   ""
## "COL5A1" 0.250076514821066   0.0398718933069302  -3.57596775582262   -4.01478986795294   -0.529677922646707  "NM_000093.3"   ""
## "POLB"   0.25131037742871    0.040566058810441   -3.5508995559135    -4.03648081967222   -0.15282667509795   "NM_002690.1"   ""
## "CACNA1D"    0.25131037742871    0.0407097167518446  -3.54578071977501   -4.04092264915683   -1.51331867055198   "NM_000720.2"   ""
## "NODAL"  0.255366286861041   0.041692454997721   -3.51137707635702   -4.07088757736453   -0.543050088596672  "NM_018055.3"   ""
## "SOS2"   0.25704611601616    0.0422945777628631  -3.49080997678892   -4.0888941245061    -0.138908829293946  "NM_006939.2"   ""
## "LEP"    0.260520907480238   0.0431986198627946  3.4606277592278 -4.11544533330241   2.6791337298931 "NM_000230.2"   ""
## "CDKN2C" 0.264398600165106   0.0446930246630611  -3.41247616135799   -4.15811763289728   -0.349885036132145  "NM_001262.2"   ""
## "B2M"    0.264398600165106   0.0449139560620683  -3.40553313632492   -4.16430253045625   -0.207216851929335  "NM_004048.2"   ""
## "FANCL"  0.264398600165106   0.0449616169478584  3.4040410910108 -4.16563270927327   0.223569253293366   "NM_001114636.1"    ""
## "POS_B"  0.264398600165106   0.045190577069036   3.39690161363171    -4.17200281569842   0.125519348323571   ""  "ERCC_00112.1"
## "GNG4"   0.270989209532448   0.0467236127601977  3.35026554381801    -4.21382401311788   0.28725845625341    "NM_004485.2"   ""
## "AKT1"   0.270989209532448   0.0475248654733721  -3.32666517531577   -4.23512763313356   -0.125480628297085  "NM_005163.2"   ""
## "ITGA2"  0.270989209532448   0.0476865826601098  3.32196375272319    -4.23938278597105   0.22713656284491    "NM_002203.2"   ""
## "MSH6"   0.270989209532448   0.047921642452624   3.31516644715914    -4.24554150355089   0.133335436622227   "NM_000179.1"   ""
## "MAP3K8" 0.270989209532448   0.0480452807716967  3.31160828268012    -4.24876851494522   0.273719793063231   "NM_005204.2"   ""
## "GTF2H3" 0.27099910047087    0.0487343651632143  -3.29198993023031   -4.26659964984949   -0.133104129897955  "NM_001516.3"   ""
## "BMP7"   0.27099910047087    0.0487383586306029  -3.29187727297851   -4.26670223316943   -0.17335662989084   "NM_001719.1"   ""
## "HRAS"   0.272039510397191   0.0493819369416519  -3.2738746185965    -4.28312285391931   -0.136049601364624  "NM_005343.2"   ""
## "GNAQ"   0.272039510397191   0.0496194515137734  3.26730641718066    -4.2891276192225    0.221938786273654   "NM_002072.2"   ""
## "PPP2R1A"    0.27216509169044    0.0499895066370196  -3.25715274144212   -4.29842478843389   -0.119594799082467  "NM_014225.3"   ""
## "IL23A"  0.272220902562825   0.0503469781525633  -3.24743525883985   -4.30733906762977   -0.234812877404071  "NM_016584.2"   ""
## "DUSP6"  0.273128241544899   0.0516017218753406  3.21401248408629    -4.33812278954051   0.123572765867534   "NM_001946.2"   ""
## "CAPN2"  0.273128241544899   0.0524394329792245  -3.19227117502527   -4.35825040422077   -0.153170047750853  "NM_001748.4"   ""
## "IRS1"   0.273128241544899   0.0527120705986721  3.18529084547855    -4.36472989075262   0.141040598382578   "NM_005544.2"   ""
## "CCNE1"  0.273128241544899   0.0528370933528116  3.18210529287174    -4.36768966802353   0.162067358643254   "NM_001238.1"   ""
## "SHC1"   0.273128241544899   0.052910298901288   -3.18024449538091   -4.36941939124382   -0.175362124399184  "NM_183001.4"   ""
## "CASP3"  0.273128241544899   0.0533572804896479  -3.1689536140489    -4.37992775009354   -0.119546856711214  "NM_032991.2"   ""
## "NRAS"   0.273128241544899   0.0534885879416229  3.16565967250194    -4.38299754770894   0.21904296108678    "NM_002524.3"   ""
## "CDKN1C" 0.273128241544899   0.0536735620113717  -3.16103693142071   -4.38730888303637   -0.289248728894513  "NM_000076.2"   ""
## "DUSP5"  0.273128241544899   0.0537089411360923  3.16015507701142    -4.38813175150063   0.482035339410174   "NM_004419.3"   ""
## "ITGB4"  0.273128241544899   0.0539985681625756  -3.152963635689 -4.39484718341213   -0.148980495101906  "NM_001005731.1"    ""
## "MAPK9"  0.274330785281636   0.0547749862558254  3.13392542239452    -4.41266840945741   0.132386070997338   "NM_139068.2"   ""
## "SMC1A"  0.274330785281636   0.0549361393995113  -3.1300169542243    -4.416334795596 -0.161790259529338  "NM_006306.2"   ""
## "SF3A3"  0.274367682340185   0.0552934870022312  -3.12140204975882   -4.42442545509444   -0.120786077330628  "NM_006802.2"   ""
## "BDNF"   0.277347849229743   0.0562478418718484  -3.09873803221368   -4.44577174307551   -0.16726262244082   "NM_170732.4"   ""
## "TP53"   0.284485954526933   0.0580583580667211  3.05705794142634    -4.48526134063087   0.131347486242959   "NM_000546.2"   ""
## "RNF43"  0.286256314124107   0.0591595112357102  3.03250821625673    -4.50866229196508   0.112343533398668   "NM_017763.4"   ""
## "MLLT4"  0.286256314124107   0.0595361284984459  3.02424462427654    -4.51656281670156   0.131756275860422   "NM_005936.2"   ""
## "DLL1"   0.286256314124107   0.0597833621175861  -3.01885593305059   -4.52172116284141   -0.145525239715317  "NM_005618.3"   ""
## "STAT4"  0.286256314124107   0.0598801473422876  -3.01675410956239   -4.52373451404138   -0.377925773188469  "NM_003151.2"   ""
## "EPHA2"  0.289230735399832   0.0608712644655259  2.99547583562862    -4.54416049711333   0.238753555451014   "NM_004431.2"   ""
## "MMP9"   0.295994735285708   0.0626723546650862  -2.95791088039739   -4.58041365208223   -2.12677055995356   "NM_004994.2"   ""
## "CACNA2D3"   0.296842032264739   0.0632303818727186  2.94654898622947    -4.59142729986615   0.177397020681711   "NM_018398.2"   ""
## "ARNT2"  0.304817079282919   0.0653179455606255  -2.90514404793885   -4.63175389229615   -0.164298379861402  "NM_014862.3"   ""
## "MYC"    0.305810680404897   0.0659209247301372  2.8934951514841 -4.64315335068818   0.151971306859576   "NM_002467.3"   ""
## "HES1"   0.31074984089349    0.0673819808059863  -2.86581896828789   -4.67033185446393   -0.155085331069367  "NM_005524.2"   ""
## "RPS6KA5"    0.31830859759031    0.0696560780562699  -2.82421528997527   -4.71143861826612   -0.202771844620491  "NM_004755.2"   ""
## "KDM6A"  0.31830859759031    0.0701609816568837  -2.81521029188279   -4.72037572956439   -1.80130107623833   "NM_021140.2"   ""
## "KAT2B"  0.31830859759031    0.0702390145192904  -2.81382585407998   -4.72175098105122   -0.145268864944422  "NM_003884.3"   ""
## "FANCA"  0.318463142115857   0.0706793198063254  2.80605021899628    -4.72948121207697   0.167478512728502   "NM_000135.2"   ""
## "MYD88"  0.319092321806306   0.0712259646889076  -2.79648111304517   -4.73900886002545   -0.122112149780094  "NM_002468.3"   ""
## "IL1R2"  0.322330762869423   0.0731667397702457  2.76323973124286    -4.77222967497051   0.310654763776713   "NM_173343.1"   ""
## "FZD9"   0.322330762869423   0.0731835703135113  -2.76295632445815   -4.77251372951918   -0.320041786481363  "NM_003508.2"   ""
## "CREB3L1"    0.322330762869423   0.0732952086214968  -2.76107853664061   -4.77439616042918   -0.189816449230393  "NM_052854.1"   ""
## "PIK3CD" 0.322330762869423   0.0735933757061566  2.75608085208652    -4.77940917495184   0.407975648842557   "NM_005026.3"   ""
## "ITGB8"  0.327357935749995   0.07529695444871    2.7280062540623 -4.80765010235999   0.23205209885954    "NM_002214.2"   ""
## "CAMK2B" 0.327357935749995   0.0755762581259555  -2.72347947806545   -4.81221642732859   -0.258839513606121  "NM_001220.3"   ""
## "CDKN2A" 0.33059921286513    0.076746245843691   2.70474260978524    -4.83115450631978   0.140584657822322   "NM_000077.3"   ""
## "RELA"   0.331440355552358   0.0773642666659203  -2.69498921090113   -4.84103652046387   -0.192944264460563  "NM_021975.2"   ""
## "SMO"    0.333541641096025   0.0786907551565172  -2.67438072319334   -4.86197039094997   -0.241710460473184  "NM_005631.3"   ""
## "MPO"    0.333541641096025   0.078705616840261   -2.674152299132 -4.86220282876012   -1.94926904769438   "NM_000250.1"   ""
## "IL20RB" 0.337353074239962   0.0800352956742767  2.65393083939335    -4.88281490222753   0.215095397251281   "NM_144717.2"   ""
## "SOX9"   0.33830679173022    0.0806930740478969  2.64408219657434    -4.89287901577781   0.106030771565603   "NM_000346.2"   ""
## "FUT8"   0.340806305543689   0.0821349896463365  -2.62283969261823   -4.91464233174184   -0.122667129086224  "NM_004480.4"   ""
## "MMP7"   0.340806305543689   0.0824593620351191  -2.61812511186202   -4.91948286341075   -1.568514033951 "NM_002423.3"   ""
## "PRKACA" 0.340806305543689   0.0825933648639042  -2.61618420387401   -4.92147671454582   -0.107546037881546  "NM_002730.3"   ""
## "RAD51"  0.347740963511887   0.0849111943604936  2.58322147019335    -4.9554354888716    0.0941824322924081  "NM_133487.2"   ""
## "WNT16"  0.347740963511887   0.0854167787574484  -2.57618021502196   -4.96271315044533   -0.254731490468133  "NM_057168.1"   ""
## "TSPAN7" 0.347740963511887   0.0856045994359619  -2.5735776552345    -4.96540518823027   -0.684893718904391  "NM_004615.3"   ""
## "MAP2K4" 0.352867939722101   0.0880904308817731  -2.53978783201556   -5.00045911644893   -0.185279638813666  "NM_003010.2"   ""
## "CYLD"   0.352867939722101   0.0883121540413146  -2.53683165635035   -5.00353489383485   -0.118342101161021  "NM_015247.1"   ""
## "RAD21"  0.352867939722101   0.0890435568932155  -2.52714506203797   -5.01362349767447   -0.169530575909187  "NM_006265.2"   ""
## "WNT2B"  0.352867939722101   0.0895325423386578  -2.52072396349685   -5.02031960007028   -0.583465952716907  "NM_024494.1"   ""
## "DDIT4"  0.352867939722101   0.0902977609803138  -2.51076239898492   -5.0307212000696    -0.368195397951322  "NM_019058.2"   ""
## "FGF19"  0.352867939722101   0.0903483253393135  2.51010784822519    -5.03140523394122   0.169627079454346   "NM_005117.2"   ""
## "BRCA2"  0.352867939722101   0.0905134471137302  2.50797352433871    -5.03363618180386   0.14728502211519    "NM_000059.3"   ""
## "XPA"    0.352867939722101   0.0908954867677315  2.50305383551005    -5.03878142902298   0.133952718030036   "NM_000380.3"   ""
## "HDAC5"  0.352867939722101   0.090917504877378   -2.5027710808343    -5.03907726760482   -0.266213312196861  "NM_005474.4"   ""
## "H2AFX"  0.357470558878961   0.0925593411383024  2.48192277903302    -5.06092614619777   0.0899365975049307  "NM_002105.2"   ""
## "TNFRSF10B"  0.358423948437777   0.0932880094070909  2.47281631261387    -5.07049178076265   0.188905284007495   "NM_003842.3"   ""
## "NR4A1"  0.358423948437777   0.0937205477420208  -2.46745225764901   -5.07613256777766   -0.178085289832791  "NM_173157.1"   ""
## "BAMBI"  0.360695383676607   0.0955352270591373  2.4452770686013 -5.09950081033298   0.0931585953964316  "NM_012342.2"   ""
## "AXIN2"  0.360695383676607   0.0969711687102877  2.42809583051717    -5.11766035692922   0.113266207807033   "NM_004655.3"   ""
## "FZD8"   0.360695383676607   0.0970012895008564  2.42773880168823    -5.11803821157858   0.156466517592866   "NM_031866.1"   ""
## "COL4A6" 0.360695383676607   0.0972846863846191  2.42438631942655    -5.12158722984831   0.308481034823918   "NM_001847.2"   ""
## "PHF6"   0.360695383676607   0.0974077311798849  2.42293449550621    -5.12312471619633   0.119398111972378   "NM_032335.3"   ""
## "MLF1"   0.360695383676607   0.0974706238573144  -2.42219328934787   -5.12390978418986   -0.109659689708689  "NM_022443.3"   ""
## "ACVR1C" 0.360695383676607   0.0975436390331576  -2.42133352706611   -5.12482053253444   -0.142305489327188  "NM_145259.2"   ""
## "FN1"    0.360695383676607   0.0979950468407107  2.41603572097317    -5.13043508068705   0.0920451183704838  "NM_212482.1"   ""
## "PIM1"   0.362154068594926   0.0992215411007209  -2.4017920516235    -5.14555218532069   -0.165599378109736  "NM_002648.2"   ""
## "WT1"    0.362154068594926   0.0993152101376392  -2.40071317385923   -5.14669851360351   -0.156506865939487  "NM_000378.3"   ""
## "POLD4"  0.362334740654369   0.100330816185932   -2.38909534977009   -5.15905415425232   -0.401764100723732  "NM_021173.2"   ""
## "CACNB2" 0.362334740654369   0.100832147870488   -2.38341373884828   -5.16510421288854   -1.61165528269757   "NM_000724.3"   ""
## "MCM2"   0.362334740654369   0.101115746294746   2.3802150872257 -5.1685124893262    0.0954545314093185  "NM_004526.2"   ""
## "SHC3"   0.362334740654369   0.10136420337313    -2.37742184974144   -5.1714900731127    -0.152705216596225  "NM_016848.5"   ""
## "MTOR"   0.362334740654369   0.102289809660268   2.36708955072755    -5.18251470023482   0.0975772695972967  "NM_004958.2"   ""
## "AKT3"   0.362334740654369   0.103714844302876   2.35140497630854    -5.19928142429873   0.0922607150468622  "NM_181690.1"   ""
## "MAP2K6" 0.362334740654369   0.103977218854889   -2.34854602920002   -5.20234165097273   -0.195208405112414  "NM_002758.3"   ""
## "E2F1"   0.362334740654369   0.104468323718339   2.34321847580099    -5.20804757929905   0.177459398688606   "NM_005225.1"   ""
## "STAT3"  0.362334740654369   0.104550595299181   2.34232899327658    -5.20900065212986   0.193035552785449   "NM_139276.2"   ""
## "CACNB3" 0.362334740654369   0.104630409140591   2.34146690354955    -5.20992448757339   0.142680915829646   "NM_000725.2"   ""
## "WIF1"   0.362334740654369   0.104660471251783   2.34114240428355    -5.21027225754451   0.336826638818287   "NM_007191.2"   ""
## "DNMT1"  0.362334740654369   0.104966405792414   2.33784655021882    -5.21380536370483   0.0957697419436148  "NM_001379.2"   ""
## "PRKAR1B"    0.362334740654369   0.105372858251526   -2.33348600110759   -5.21848231418823   -0.213914495971274  "NM_001164759.1"    ""
## "IFNA2"  0.365827498942716   0.107090469812205   -2.31528412739305   -5.23803557781665   -0.430949174828379  "NM_000605.3"   ""
## "PTEN"   0.365827498942716   0.107397395501604   -2.31206926173561   -5.24149423997911   -0.106192405247405  "NM_000314.3"   ""
## "MNAT1"  0.365827498942716   0.107788459509907   2.3079893663437 -5.24588572633489   0.0892107890679181  "NM_002431.2"   ""
## "CDC6"   0.372231365705903   0.110150098015012   2.28373002432376    -5.27204813796363   0.100869896236816   "NM_001254.3"   ""
## "FANCE"  0.378842471292657   0.112718631492128   -2.25805705280418   -5.29982761802579   -0.221683384892081  "NM_021922.2"   ""
## "GNAS"   0.378842471292657   0.113333220049126   -2.25201991378369   -5.3063737254538    -0.102870437018584  "NM_080425.1"   ""
## "STMN1"  0.378842471292657   0.113556097900222   -2.24984043200687   -5.30873821210958   -0.0841109329270449 "NM_203401.1"   ""
## "CDC25C" 0.383793082968143   0.115529550485308   -2.23076707660329   -5.32945891784101   -0.119683232203192  "NM_001790.2"   ""
## "HES5"   0.385494236626601   0.116769040479024   -2.21898919639536   -5.34227916559354   -0.160872066392413  "NM_001010926.3"    ""
## "WHSC1L1"    0.385494236626601   0.11725939358735    2.21437169041159    -5.34731050581646   0.0870216689753729  "NM_017778.2"   ""
## "DDB2"   0.385494236626601   0.117819893162934   -2.20912231445591   -5.35303386140753   -0.145911916555502  "NM_000107.1"   ""
## "EPO"    0.385494236626601   0.118113576613487   2.2063839203189 -5.35602099047704   1.77489742649003    "NM_000799.2"   ""
## "PLCB1"  0.385494236626601   0.118801940742975   2.19999770338448    -5.36299120171835   0.280403054646552   "NM_182734.1"   ""
## "CEBPA"  0.385494236626601   0.119070208954034   -2.1975210400146    -5.36569581641512   -0.277474206648345  "NM_004364.2"   ""
## "RPS27A" 0.385494236626601   0.119732081671673   -2.19143947835243   -5.37234059093559   -0.0845823206559295 "NM_002954.5"   ""
## "FGF2"   0.385494236626601   0.119975247113381   2.18921541770246    -5.37477184765469   0.10575927914477    "NM_002006.4"   ""
## "ETV7"   0.38676670047711    0.121198334452897   2.17811106455469    -5.38692044899202   0.156127414696555   "NM_016135.2"   ""
## "FGF7"   0.38676670047711    0.1217463711017 -2.17317947116773   -5.39232098348163   -2.68700506611572   "NM_002009.3"   ""
## "HNF1A"  0.38676670047711    0.121865612479255   -2.172110023331 -5.39349254157769   -1.7009556314488    "NM_000545.4"   ""
## "RAD50"  0.38676670047711    0.12234456851827    2.16782712164283    -5.39818585706378   0.127825342753498   "NM_005732.2"   ""
## "POLR2H" 0.388810560148377   0.123487027394063   2.15769256153004    -5.40930097941575   0.0946621929260232  "NM_001278698.1"    ""
## "MAML2"  0.390827321140849   0.124626059037261   -2.14770077562034   -5.42027233357469   -0.0820968901619139 "NM_032427.1"   ""
# Visualize and quality control test results.
# Build histogram of P-values for all genes. Normal test
# assumption is that most genes are not differentially expressed.
tT2 <- topTable(fit2, adjust="fdr", sort.by="B", number=Inf)
hist(tT2$adj.P.Val, col = "grey", border = "white", xlab = "P-adj",
  ylab = "Number of genes", main = "P-adj value distribution")

# summarize test results as "up", "down" or "not expressed"
dT <- decideTests(fit2, adjust.method="fdr", p.value=0.05, lfc=0)

# Venn diagram of results
vennDiagram(dT, circle.col=palette())

# create Q-Q plot for t-statistic
t.good <- which(!is.na(fit2$F)) # filter out bad probes
qqt(fit2$t[t.good], fit2$df.total[t.good], main="Moderated t statistic")

# volcano plot (log P-value vs log fold change)  ###mUESTRA A LA IZQUIERDA LOS GENES DOWN REGULATION Y A LA DERECHA LOS UP REGULATION
colnames(fit2) # list contrast names
## [1] "tto1-tto2"
ct <- 1        # choose contrast of interest
volcanoplot(fit2, coef=ct, main=colnames(fit2)[ct], pch=20,
  highlight=length(which(dT[,ct]!=0)), names=rep('+', nrow(fit2)))