Módulo 6B - Análisis de muchas observaciones¶
Análisis de datos en biología cuantitativa
Lo que sige es el .rmd del curso.
--- title: "\[ATR\] Taller IFIBYNE (M6B)" author: "Nicolás Méndez" date: "2019/8/7" geometry: "left=3cm,right=3cm,top=2cm,bottom=2cm" output:
pdf_document:
toc: true
toc_depth: 3
number_sections: true
---
Esta guía fue hecha en Rstudio con [Rmarkdown](http://rmarkdown.rstudio.com).
{r setup, include=FALSE} # Opciones globales knitr::opts_chunk\$set(echo = TRUE) knitr::opts_chunk\$set(out.width='90%', dpi=300) knitr::opts_chunk\$set(fig.align='center', dev = "png") options(max.print=100) library("gridExtra")
R para datos "largos"¶
La idea es hacer análisis de datos con muchas observaciones y no tantas variables:
- Un censo. * Citometría (de flujo o por microscopía).
En contraposición, las ómicas hacen típicamente pocas observaciones de muchas (muchísimas) variables.
Caso 1: Citometría de flujo¶
Variabilidad como medida de qué tan regulado está un gen.
Normalización, fold change, test. Scaling.
Hay que ver qué va a dar Nacho y cómo seguirlo.
Escalado y Normalización¶
Nuestra primera opción es escalar los datos antes de graficar.
scale
*log
* "*fold change*" *log(
*fold_change*)
```{r, echo = F, message = F, warning=F} library(tidyverse)
Grab numeric columns and scale them! # Default scaling function takes log2 of the fold change (respect to the mean of the values minus the column minimum). norm_numeric_cols <- function(tabla,¶
norm_function = function(x, ...){log2((x-min(x, na.rm = T)/max(x, na.rm = T)))},
...){
a <- sapply(tabla, is.numeric)
tabla[,a] <- lapply(tabla[,a], function(x) norm_function(x, ...))
return(tabla)
} ```
```{r, message = F, warning=F} # Not normalized starwars %>%
select(name, height, mass, birth_year) %>%
gather(key = "attribute", value = "value", -name) %>%
ggplot(aes(attribute, name, fill = value)) +
geom_tile() +
scale_fill_gradient(low = "red",
high = "yellow",
na.value = "black") +
theme_minimal() +
theme(axis.text=element_text(size=4),
axis.title=element_text(size=14, face="bold"))
Normalized by the "scale()" function, with default parameters. starwars %>%¶
select(name, height, mass, birth_year) %>%
norm_numeric_cols(norm_function = scale) %>% # Here!
gather(key = "attribute", value = "value", -name) %>%
ggplot(aes(attribute, name, fill = value)) +
geom_tile() +
scale_fill_gradient(low = "red",
high = "yellow",
na.value = "black") +
theme_minimal() +
theme(axis.text.y=element_text(size=4),
axis.title=element_text(size=14, face="bold"))
```
Caso 2: Citometría por microscopía¶
CellID + Rcell -> Time-course.
Modelos lineales.
PCA para esto.
Clustering¶
Análisis estadísticos de los datos (usar lo que ya hizo Nacho).
Jerárquico, k-means, silhouette plot (consultar con Andy).
Revisar el curso de R de la UNSAM.
Shiny¶
Se puede mostrar esto con algún fin demostrativo.