Skip to content

Instantly share code, notes, and snippets.

@mtmorgan
mtmorgan / hca2021bioc.R
Last active Oct 6, 2021
Script used during Human Cell Atlas presentation, 2021-10-06
View hca2021bioc.R
##
## Preliminiaries: install infrasctructure and required packages
##
## We've got to be using a least R version 4.1
my_R_version <-
numeric_version(paste(R.Version()[c("major", "minor")], collapse = "."))
stopifnot(my_R_version >= "4.1")
View hca-demo-sept-7-2021.R
options(width=160)
library(dplyr)
## BiocManager::install("Bioconductor/hca")
library(hca)
## projects available in the HCA
projects <- projects()
projects
## a specific project
@mtmorgan
mtmorgan / week-2-demo.R
Last active May 3, 2021
AnVIL PopUp Workshop week 2 script
View week-2-demo.R
if (!"AnVIL" %in% rownames(installed.packages()))
BiocManager::install("AnVIL")
library(AnVIL)
this_workspace = avworkspace()
hca = "featured-workspaces-hca/HCA_Optimus_Pipeline"
thousand_genomes = "anvil-datastorage/1000G-high-coverage-2019"
## AnVIL 'namespace' / 'name' == workspace
@mtmorgan
mtmorgan / AWS_ECS_REST.Rmd
Created Jan 28, 2021
AWS ECS REST access
View AWS_ECS_REST.Rmd
# AWS ECS access via REST
Resources
- [Getting Started with ECS][ECS]
- [REST API][API]
[ECS]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/getting-started-ecs-ec2.html
[API]: https://docs.aws.amazon.com/AmazonECS/latest/APIReference/Welcome.html
View dep-graph.R
package_dependencies <- tools::package_dependencies
trim <- function(deps, drop) {
lvls = names(deps)
df = data.frame(
pkg = factor(rep(names(deps), lengths(deps)), levels = lvls),
dep = unlist(deps, use.names = FALSE)
)
df = df[!df$dep %in% drop,, drop = FALSE]
split(df$dep, df$pkg)
@mtmorgan
mtmorgan / deps_broken.R
Created Jun 9, 2020
Query Bioconductor build report for package dependencies that fail to install, build, or check
View deps_broken.R
library(BiocPkgTools)
library(dplyr)
deps_broken <-
function(
pkg,
repos = BiocManager::repositories(),
version = BiocManager::version()
)
{
@mtmorgan
mtmorgan / obo_graph.R
Last active Apr 12, 2020
construct distance between GO nodes from OBO file
View obo_graph.R
obo = readLines("go.obo")
##
## Clean data
##
## blank lines separate different 'groups' in the obo
group <- cumsum(!nzchar(obo))
## keep groups that have the [Term] label
@mtmorgan
mtmorgan / bioc_first_appearance.R
Last active Feb 1, 2020
bioc_first_appearance
View bioc_first_appearance.R
library(yaml)
library(dplyr)
library(tibble)
library(lubridate)
library(readr)
library(memoise)
get_releases <-
function()
{
@mtmorgan
mtmorgan / BiocManager_test.sh
Last active Oct 21, 2019
BiocManager test scripts
View BiocManager_test.sh
export BIOCVERSION_REPOS=~/b/git/BiocVersion
export BIOCMANAGER_REPOS=~/b/git/BiocManager
export BIOCMANAGER_SANDBOX=/Users/ma38727/tmp/BiocManagerSandbox
#
# R-4.0
#
echo "R-4.0"
export R_LIBS_USER=$BIOCMANAGER_SANDBOX/R-4.0-Bioc-3.10