Skip to content

Instantly share code, notes, and snippets.

View lcolladotor's full-sized avatar

Leonardo Collado-Torres lcolladotor

View GitHub Profile
Hola RLadies-Aguascalientes,
Les escribo por si quieren unirse al Slack de la CDSB donde tenemos a gente de todos los demás grupos de RLadies del país. Tenemos un canal llamado #rladies y andamos jugando con un par de ideas. En https://www.r-consortium.org/blog/2020/03/18/cdsb-diversity-and-outreach-hotspot-in-mexico vienen más detalles de nuestra historia y nuestra relación con grupos de RLadies en México.
Si sí, solo necesitaría su(s) correo(s) y nombre(s).
Saludos,
Leo
Leonardo Collado Torres, Ph. D., Research Scientist

Some of my own notes prior to answering live on the community call

Question: What does it mean to “maintain an R package”?

  • deal with questions, you approve/dissapprove changes you receive from others, you end up learning about community guidelines (Bioconductor in my case) as well as R-devel

Question: How do you encourage user feedback and/or manage a firehose of user feedback or requests for help?

  • emails: no one really benefits, sure, I can write a blog post about your question but that's a ton of extra work
  • private data (unpublished) but the packages we make are open-source and we believe in community building
## From https://stackoverflow.com/questions/5812493/how-to-add-leading-zeros
x <- 10 ^ (0:5)
library('stringr')
getOption('scipen')
x
str_pad(x, 8, pad = '0')
options(scipen = 999)
getOption('scipen')
x
@lcolladotor
lcolladotor / makeGencodeGFF.R
Last active October 2, 2019 17:33
Extracted from
## Contains edits related to https://github.com/Bioconductor/Contributions/issues/1191
# Helper to retrieve GTF & GFF3 file urls from Gencode
.gencodeSourceUrls <- function(species, release, filetype, justRunUnitTest)
{
speciesUrl <- ifelse(species=="Human", "Gencode_human/", "Gencode_mouse/")
dirurl = paste0(AnnotationHubData:::.gencodeBaseUrl, speciesUrl, "release_", release, "/")
names(dirurl) <- paste0(species,"_", release)
fileurls <-AnnotationHubData:::.gencodeFileFromUrl(dirurl)
@lcolladotor
lcolladotor / explore_lcg_alumni.R
Created September 4, 2019 13:09
LCG alumni google scholar IDs via gcite
> table(!is.na(lcg_alumni$candidate_gscholar_id))
FALSE TRUE
226 47
>
> plot(y = !is.na(lcg_alumni$candidate_gscholar_id), x = lcg_alumni$date_finished)
vals <- c("a","a","a","b","a","b","b")
## If needed:
# install.packages('BiocManager')
# BiocManager::install('S4Vectors')
vals_ir <- S4Vectors::Rle(vals)
for(x in unique(vals_ir)) {
index <- S4Vectors::runValue(vals_ir) == x
S4Vectors::runValue(vals_ir)[index] <- paste0(x, seq_len(sum(index)))
@lcolladotor
lcolladotor / recount_scaling.R
Created April 11, 2019 14:30
Check why some samples have scale_counts > 40 million as reported by Princy Parsana on 09/10/2018
## Check why some samples have scale_counts > 40 million as reported by Princy Parsana on 09/10/2018
library('recount')
library('devtools')
load('/dcl01/leek/data/recount-website/rse/rse_tcga/TCGA/rse_gene.Rdata', verbose = TRUE)
rse_gene_tcga <- rse_gene
rse_scaled_tcga <- scale_counts(rse_gene_tcga, round = FALSE)
nread_tcga <- colSums(assays(rse_scaled_tcga)$counts) / 1e6
table(nread_tcga > 40)
summary(nread_tcga)
@lcolladotor
lcolladotor / fixing_recount_workflow.R
Created February 27, 2019 21:16
My rabbit hole path towards fixing recountWorkflow 1.7.1 and realizing that I had to use an argument in bumphunter::annotateTranscripts() that I introduced myself...
## Define expressed regions for study SRP045638, only for chromosome 21
library('recount')
regions <- expressed_regions("SRP045638", "chr21", cutoff = 5L,
maxClusterGap = 3000L)
## Import the Gencode v25 hg38 gene annotation
library("rtracklayer")
gencode_v25_hg38 <- import(paste0(
"ftp://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human",
"/release_25/gencode.v25.annotation.gff3.gz"))
@lcolladotor
lcolladotor / test_rsync.sh
Created February 14, 2019 18:16
Testing Rsync at JHPCE
mkdir test_1
echo "ja" > test_1/hola
mkdir test_2
echo "jo" > test_2/hola
touch test_2/adios
tail test_2/*
rsync -av /users/lcollado/test_1/ /users/lcollado/test_2/
tail test_2/*
rm -fr test_1 test_2
library(repurrrsive)
library(purrr)
head(got_chars[[1]])
names(got_chars[[1]])
lapply(got_chars[1:3], length)
lapply(got_chars[1:3], '[', 'name')
lapply(got_chars[1:3], '[[', 3)