Skip to content

Instantly share code, notes, and snippets.

View lcolladotor's full-sized avatar

Leonardo Collado-Torres lcolladotor

View GitHub Profile
@lcolladotor
lcolladotor / notes.R
Last active September 25, 2023 19:55
Notes from my session with Natalie
library("dplyr")
library("sessioninfo")
tuesdata <- tidytuesdayR::tt_load("2020-01-07")
rainfall <- tuesdata$rainfall
rainfall_filtered <- rainfall %>%
filter(city_name == "Cuernavaca")
rainfall_filtered
@lcolladotor
lcolladotor / migrate_hugo_shortcode_tweet.R
Last active May 1, 2022 06:31
Code for migrating hugo tweet shortcode. Related to https://github.com/rstudio/blogdown/issues/701
x <- c("/Users/leocollado/Dropbox/Code/lcolladotorsource/content/post/2018-04-19-latin-american-r-bioconductor-developers-workshop-2018.html:44:1",
"/Users/leocollado/Dropbox/Code/lcolladotorsource/content/post/2018-06-11-mindfulness.html:27:1",
"/Users/leocollado/Dropbox/Code/lcolladotorsource/content/post/2018-07-30-harrassment-diversity-in-science-and-inspiraton-from-my-grandmother.html:24:1",
"/Users/leocollado/Dropbox/Code/lcolladotorsource/content/post/2018-09-13-r-gene-regulatory-interaction-formulator-for-inquiring-networks.html:132:1",
"/Users/leocollado/Dropbox/Code/lcolladotorsource/content/post/2018-09-17-what-about-a-lawyer-like-app-as-the-mininum-help-for-defandants-in-immigration-cases.html:110:1",
"/Users/leocollado/Dropbox/Code/lcolladotorsource/content/post/2018-10-16-ashg18-tweet-summary.html:21:1",
"/Users/leocollado/Dropbox/Code/lcolladotorsource/content/post/2018-09-29-why-i-applied-to-join-sni-the-mexican-national-researchers-registry.html:21:1",
"/Users/leocollado/Dropbox/Code/lcollado
@lcolladotor
lcolladotor / gantt.R
Last active March 24, 2022 14:09
Live coding gantt
## Load required libraries
library("googlesheets4")
library("dplyr")
library("ggplot2")
library("plotly")
## For reproducibility
library("sessioninfo")
## Authenticate with Google
googlesheets4::gs4_auth()
library('SpatialExperiment')
library('ggplot2')
library('gridExtra')
library('ggspavis')
id = 'V10B01-085_A1'
spe_path = '/dcs04/lieber/lcolladotor/spatialHPC_LIBD4035/spatial_hpc/processed-data/pilot_data_checks/spe_basic.Rdata'
################################################################################
# Function Definitions
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 20 columns, instead of 12. in line 4.
"","Sample.ID","Number.of.Reads","Mean.Reads.per.Spot","Median.Genes.per.Spot","Median.UMI.Counts.per.Spot","Valid.Barcodes","Sequencing.Saturation","Q30.Bases.in.Barcode","Q30.Bases.in.RNA.Read","Q30.Bases.in.UMI","Reads.Mapped.to.Genome","Reads.Mapped.Confidently.to.Genome","Reads.Mapped.Confidently.to.Intergenic.Regions","Reads.Mapped.Confidently.to.Intronic.Regions","Reads.Mapped.Confidently.to.Exonic.Regions","Reads.Mapped.Confidently.to.Transcriptome","Reads.Mapped.Antisense.to.Gene","Total.Genes.Detected","study"
"1","V10A27004_A1_Br3874",250388898,50995.7022403259,1302,2348,96.1,91.9,96.2,93.9,95.8,95.1,79.8,8.7,2.3,68.7,66.4,1,22439,"VisiumIF"
"2","V10A27004_D1_Br3880",173548606,37646.1184381779,1155,2058,95.6,89.5,96.4,93.8,95.8,95.2,74.3,5.8,2.7,65.8,62.9,1.5,22355,"VisiumIF"
"3","V10A27106_A1_Br3874",316562059,75605.9371865297,1347,2176,96.7,93.6,96.3,94,95.7,95,78.1,10.3,4.4,63.3,61.6,0.6,22809,"VisiumIF"
"4","V10A27106_B1_Br3854",204558515,76157.3026805659,1126.5,1938,96.6,94,96.4,94.5,95.8,96.9
@lcolladotor
lcolladotor / commands.sh
Created April 19, 2021 19:26
Learning about setfacl at JHPCE
cd /dcl01/lieber/ajaffe/lab
# cd ~ # My tests didn't work in my home dir (setfacl: test_main: Operation not supported)
mkdir test_setfacl
cd test_setfacl
rm -fr test_main test_proj2
mkdir test_main
chgrp lieber_jaffe test_main
chmod g+s test_main
## Related to https://docs.google.com/document/d/1uDdq0W9eAEnyPLf_gKJRKI8TGpujXIhGhaHBuLdmmRE/edit?usp=sharing
## and Berto et al 2019 https://www.pnas.org/content/116/48/24334
library("SummarizedExperiment")
## The two data sets we'll use
datasets <- c("NeuN", "OLIG2")
## Read in data for both datasets and build a SummarizedExperiment object
rse_list <- lapply(datasets, function(dataid) {
> current
[1] "annotate"
[2] "AnnotationDbi"
[3] "AnnotationFilter"
[4] "AnnotationForge"
[5] "AnnotationHub"
[6] "AnnotationHubData"
[7] "ari"
[8] "AsioHeaders"
[9] "askpass"
---
title: "Test seed in Rmd"
author: "Leonardo Collado-Torres"
date: "10/20/2020"
output: html_document
---
_This Rmd file is in response to a question during the [R-Ladies Baltimore 2020-10-20 event](https://www.meetup.com/rladies-baltimore/events/273327907/). The code is available on this [gist](https://gist.github.com/lcolladotor/8a7165dbcdba06e09230daf3cb5ebabe) and the rendered version is available through [RPubs](https://rpubs.com/lcollado/test_seed_rmd)._
Set the seed then print a set of random 10 letters.
library("BiocFileCache")
library("SummarizedExperiment")
library("googlesheets4")
## Location for temporarely downloading the files
bfc_temp <- BiocFileCache(tempdir())
## Download the BSP1 and BSP2 data
bsp1_data <- bfcrpath(bfc_temp, "https://s3.us-east-2.amazonaws.com/jaffe-nat-neuro-2018/rse_gene_BrainSeq_Phase1_hg19_TopHat2_EnsemblV75.rda")
bsp2_data <- bfcrpath(bfc_temp, "https://s3.us-east-2.amazonaws.com/libd-brainseq2/rse_gene_unfiltered.Rdata")