Para las siguientes clases vamos a usar Python como nuestro lenguaje de programación preferido. En particular, vamos a usar la versión 3 de Python y las libretas de Jupyter. Para ya tener una instalación funcional en la clase, aquí hay unas pistas para la instalación. Para la instalación en Windows y Mac vamos a usar la versión de Anaconda mientras que para Linux usamos la versión nativa de Python.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
"""Set up Qiime 2 on Google colab. | |
Do not use this on o local machine, especially not as an admin! | |
""" | |
import os | |
import sys | |
import shutil |
Lo primero que tienes que saber sobre la instalación de docker es que para Mac y windows hay dos versiones de docker:
- una versión legacy que usa maquinas virtuales (VM) para correr docker adentro de una maquina virtual.
- una versión nativa que usa una capa de compatibilidad (HyperKit + Hypervisor en Mac y Hyper-V en Windows) para correr docker directamente con el kernel nativo
La versión nativa (opción 2) tiene menos overhead y corre más rapido pero pone mas restricciones a su OS. Por el momento yo recomiendo que usan esta versión en Mac y Linux y la version legacy (opcion 1) en Windows.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(data.table) | |
library(ggplot2) | |
library(magrittr) | |
library(pbapply) | |
large <- fread("ERR260132_genes.csv") | |
#' Sample a rarefied version of a count vector. | |
#' | |
#' @param x A named vector of counts. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"workbench.colorTheme": "Sublime Material Theme - Dark", | |
"workbench.iconTheme": "material-icon-theme", | |
"editor.fontFamily": "'Fira Mono', monospace", | |
"editor.fontSize": 17, | |
"editor.rulers": [80], | |
"window.zoomLevel": 0, | |
"window.menuBarVisibility": "toggle", | |
// Settings for Python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import pandas as pd | |
from sys import argv, exit | |
def benchmark_to_df(json_file): | |
with open(json_file) as jf: | |
content = json.load(jf) | |
df = pd.DataFrame(columns=("test", "time [ms]")) | |
for b in content["benchmarks"]: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ES <- function(p, w, pws, both=FALSE) { | |
n <- length(pws) | |
nr <- sum(abs(w[pws == p])) | |
nh <- sum(pws == p) | |
scores <- vector(length=n) | |
scores[pws == p] <- abs(w[pws == p])/nr | |
scores[pws != p] <- -1/(n - nh) | |
r <- range(cumsum(scores)) | |
i <- which.max(abs(r)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/env python | |
from cobra.test import create_test_model | |
from cobra.flux_analysis import single_gene_deletion | |
cobra_model = create_test_model("textbook") | |
dels = {"b0008": 0.87, "b0114": 0.71, "b0116": 0.56, "b2276": 0.11, "b1779": 0.00} | |
rates, statuses = single_gene_deletion(cobra_model, gene_list=dels.keys(), | |
method="moma", solver="mosek") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rcpp::sourceCpp("matrix_reduce.cpp") | |
#' Reduces an ExpressionSet by an n-to-n map of features to groups. All entries | |
#' in \code{features} must exist in \code{eset}. \code{features} and | |
#' \code{groups} must have the same length. | |
#' | |
#' @param eset An ExpressionSet object. | |
#' @param features A character vector of features to be grouped. | |
#' @param groups A factor or character vector mapping the entries in | |
#' \code{features} to groups. |
NewerOlder