Skip to content

Instantly share code, notes, and snippets.

View llrs's full-sized avatar

Lluís Revilla llrs

View GitHub Profile
@PeteHaitch
PeteHaitch / combining-SummarizedExperiment-objects.md
Last active July 22, 2023 11:06
Developing a method for combining SummarizedExperiment objects

Combining SummarizedExperiment objects

Peter Hickey
20 October 2015

Motivation

I often find myself with multiple SE objects (I'm using SE as a shorthand for the SummarizedExperiment0 and RangedSummarizedExeriment classes), each with potentially non-distinct samples and potentially non-overlapping features/ranges. Currently, it is difficult to combine these objects; rbind() can only combine objects with the same samples but distinct features/ranges and cbind() can only combine objects with the same features/ranges but distinct samples. I think it would be useful to have a "combine" method for SE objects that handles the most general situation where each object has potentially non-distinct samples and potentially non-overlapping features/ranges.

@jeroen
jeroen / cranscraper.R
Last active January 17, 2021 17:15
Fast scraping of package metadata using curl multi API
# Globals
repos <- 'https://cloud.r-project.org'
pkgdata <- available.packages(repos = repos)
pkgs <- row.names(pkgdata)
# On success
make_callback <- function(i, url){
function(res){
if(res$status == 200){
buf <- rawConnection(res$content)
@dpseidel
dpseidel / default_aes.md
Last active February 12, 2021 17:08
Default ggplot2 aesthetics table

Default ggplot2 aesthetics by geom.

geom alpha angle colour family fill fontface height hjust lineheight linetype shape size stroke vjust weight width xmax xmin ymax ymin
GeomAbline NA black 1 0.5
GeomAnnotationMap NA NA grey20 1 0.5
GeomArea NA NA grey20 1 0.5
GeomBar NA NA grey35 1 0.
@ajstewartlang
ajstewartlang / gist:89dcdf01c4512a213141a16e9243626d
Last active November 24, 2023 21:15
Hacked together code for animated raincloud plots for N=20 and N=500 where no difference exists in underlying populations
# Usimg @micahgallen's nice raincloud plot code
# https://wellcomeopenresearch.org/articles/4-63
# and fork of benmarwick/geom_flat_violin.R code
# gganimate by Thomas Lin Pedersen - @thomasp85
devtools::install_github('thomasp85/gganimate')
library(tidyverse)
library(gganimate)
library(RColorBrewer)
@jxtx
jxtx / bioc2018.md
Last active August 22, 2018 14:30
#bioC 2018 Conference Notes
@juliasilge
juliasilge / january_meta.R
Last active January 27, 2019 23:14
Views to answers on Stack Overflow questions
## this analysis assumes a dataframe `post_views` with columns:
## PostId
## CreationDate
## Tag
## AnswerCount
## ViewCount
library(tidyverse)
post_views %>%
@emitanaka
emitanaka / collapseoutput.js
Created July 20, 2019 04:43
Collapsible Code Output for `xaringan`
<script>
(function() {
var divHTML = document.querySelectorAll(".details-open");
divHTML.forEach(function (el) {
var preNodes = el.getElementsByTagName("pre");
var outputNode = preNodes[1];
outputNode.outerHTML = "<details open class='output'><summary>Output</summary>" + outputNode.outerHTML + "</details>";
})
})();
(function() {
``` r
library(Matrix)
alpha = 0.05
A <- rsparsematrix(1000, 1000, 0.1)
s <- as.data.frame(summary(A))
p <- abs(s$x) / sum(abs(s$x)) # probabilities proportional to abs(entry)
@rcastelo
rcastelo / depburden.R
Last active February 22, 2020 06:38
Functions to help identifying scarcely used R package dependencies representing a large installation burden
## this file contains 4 functions using several R and Bioconductor
## packages to help identifying scarcely used R package dependencies
## representing a large installation burden. it has been created
## upon the following discussion thread on the bioc-devel mailing list:
## https://stat.ethz.ch/pipermail/bioc-devel/2020-February/016146.html
##
## to use these functions you need to build a database of package
## information using the following lines:
##
## repos <- BiocManager::repositories()[c("BioCsoft", "CRAN")]
# Setup----
library(rtweet)
source("~/R/Projects/environment_vars.R") # secrets
api_key <- Sys.getenv("TWITTER_API_KEY")
api_secret_key <- Sys.getenv("TWITTER_API_SECRET")
access_token <- Sys.getenv("TWITTER_ACCESS_TOKEN")
access_token_secret <- Sys.getenv("TWITTER_ACCESS_TOKEN_SECRET")