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.
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 |
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 sys; from PIL import Image; import numpy as np | |
chars = np.asarray(list(' .,:;irsXA253hMHGS#9B&@')) | |
if len(sys.argv) != 4: print( 'Usage: ./asciinator.py image scale factor' ); sys.exit() | |
f, SC, GCF, WCF = sys.argv[1], float(sys.argv[2]), float(sys.argv[3]), 7/4 | |
img = Image.open(f) | |
S = ( round(img.size[0]*SC*WCF), round(img.size[1]*SC) ) | |
img = np.sum( np.asarray( img.resize(S) ), axis=2) |
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
a = "bla" | |
b = "so on" | |
class(a) = append("my_class", class(a)) | |
'+.my_class' = function(x,y) paste(x,y,sep=" and ") | |
print(a+b) |
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
# This line imports the modules we will need. The first is the sys module used | |
# to read the command line arguments. Second the Python Imaging Library to read | |
# the image and third numpy, a linear algebra/vector/matrix module. | |
import sys; from PIL import Image; import numpy as np | |
# This is a list of characters from low to high "blackness" in order to map the | |
# intensities of the image to ascii characters | |
chars = np.asarray(list(' .,:;irsXA253hMHGS#9B&@')) | |
# Check whether all necessary command line arguments were given, if not exit and show a |
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"]: |
NewerOlder