Skip to content

Instantly share code, notes, and snippets.

View malcook's full-sized avatar

Malcolm Cook malcook

View GitHub Profile
@malcook
malcook / htmlwidgets.org
Last active August 1, 2022 21:11
This emacs org-mode document demonstrates an approach to embedding R's htmlwidgets in the exported html resulting from org-html-export-html.
# -*- org-export-babel-evaluate: nil; org-export-allow-bind-keywords: t; -*-
#+AUTHOR: Malcolm Cook;
#+EMAIL: malcolm_cook@stowers.org
#+OPTIONS: ':nil H:3 toc:3 num:t \n:nil @:t ::t |:t ^:nil -:nil f:t *:t <:t _:nil
#+OPTIONS: email:T author:T creator:T timestamp:T
#+STARTUP: showall
#+STARTUP: showall
#+PROPERTY: header-args:R :session *R:htmlwidgets**
@malcook
malcook / imputeIR.R
Last active August 27, 2019 22:08
In service of analyzing intron retention of introns not otherwise annotated as retained, augment GTF formatted transcriptome with imputed transcripts, one for each such intronic region.
imputeIR<-function(inPath
,outPath
,source='imputeIR'
,txNameFmt='ITR%07d'
,IGVHideGene=FALSE
,index=FALSE
,...
) {
## PURPOSE: Write GTF file to <outPath> as a version of GTF file
## <inPath> containing additional transcripts, one for every region
#!/usr/bin/env Rscript
'
USAGE: cuffdiff_gtf_attributes --input=<inputGTF> [--output=outputGTF] | --help
OPTIONS:
-i --input=<inputGTF> the inputGTF
-o --output=[outputGTF] the outputGTF
EXAMPLE:
> wget ftp://ftp.ensembl.org/pub/release-82/gtf/saccharomyces_cerevisiae/Saccharomyces_cerevisiae.R64-1-1.82.gtf.gz
@malcook
malcook / protocol.md
Last active August 29, 2015 14:17 — forked from scientificprotocols/protocol.md
Processing of Microdissected Tissue for Molecular Analysis
Author: National Cancer Institute

These methods were successful in our lab using prostate tissue and for our specific objectives. Investigators must be aware that they will need to tailor the following protocol for their own research objectives and tissue under study.

More than 10,000 Cells

If the amount of microdissected material is substantial (>10,000 cells) then any of the standard procedures for isolating DNA are acceptable.

Less than 10,000 Cells

== 2015-03-13 21:48:51,169 main INFO This is EasyBuild 2.1.0dev (framework: 2.1.0dev, easyblocks: 2.1.0dev) on host mango.sgc.loc.
== 2015-03-13 21:48:51,170 main INFO Command line: --modules-tool=Lmod --robot=/n/local/sce/EasyBuild-dev/easybuild-easyconfigs/easybuild/easyconfigs --try-toolchain="['goolf', '1.7.20']" biodeps-1.6-goolf-1.4.10-extended.eb
== 2015-03-13 21:48:51,171 main INFO Using /tmp/eb-dqaqb2 as temporary directory
== 2015-03-13 21:48:51,172 main.tools.robot INFO Using robot path(s): ['/n/local/sce/EasyBuild-dev/easybuild-easyconfigs/easybuild/easyconfigs']
== 2015-03-13 21:48:51,172 main.tools.robot INFO Prepended list of robot search paths with /tmp/eb-dqaqb2/tweaked_easyconfigs: ['/tmp/eb-dqaqb2/tweaked_easyconfigs', '/n/local/sce/EasyBuild-dev/easybuild-easyconfigs/easybuild/easyconfigs']
== 2015-03-13 21:48:51,177 main.filetools INFO Command /n/local/sce/apps/lmod/lmod/libexec/lmod found at /n/local/sce/apps/lmod/lmod/libexec/lmod
== 2015-03-13 21:48:51,177 main.Lmod INFO Full path for
[[DEBUG]] Going to use /tmp/tmp3P1tRE as temporary directory
[[DEBUG]] Output from modulecmd python help: sh: modulecmd: command not found
[[DEBUG]] Output from lmod python help: Usage: module [options] sub-command [args ...]
Options:
-h -? -H --help This help message
-s availStyle --style=availStyle Site controlled avail style: system
(default: system)
-D Program tracing written to stderr
@malcook
malcook / xSummarizedExperiment.R
Created February 6, 2014 01:29
eXtensions to BioConductor's SummarizedExperiment framework, as proposed http://thread.gmane.org/gmane.science.biology.informatics.conductor/52971
subset.SummarizedExperiment<-function(x
,rowSubset=TRUE
,colSubset=TRUE
,assaySubset=TRUE
,drop=FALSE
,provenanceTrack=FALSE
,...) {
## PURPOSE: implement subsetting of SummarizedExperiments by
## rowSubset : expression in terms of the GRanges attributes (and
## its mcols meta-data) held in rowData
@malcook
malcook / pvec.R
Created September 20, 2012 19:32
a retake on parallel:pvec
pvec2<-function(v, FUN, ..., mc.set.seed = TRUE, mc.silent = FALSE,
mc.cores = getOption("mc.cores", 2L), mc.cleanup = TRUE
,combineFUN = `c`
) {
### AUTHOR: malcolm_cook@stowers.org
### PURPOSE: an improvement(?) on parallel:pvec which
### (1) does not require v to be a vector, rather, v must
### implement `[`, `length`. Thus, i.e. BioConductor List (including
### GRangesList) is supported.
### (2) uses `parallel:splitIndices` to compute indices into v
@malcook
malcook / dired-do-flagged-delete.el
Created June 26, 2012 20:18
Allows more aggressive control over recursive deletion policy
(defadvice dired-do-flagged-delete
(around dired-do-flagged-delete activate)
"Allows more aggressive control over recursive deletion policy:
`dired-recursive-deletes` is set based on the current-prefix-arg:
4=>top (with confirmation)
16=>always (with confirmation)
64=>always (without confirmation)"
(interactive "p")
(let ((dired-recursive-deletes (case (car current-prefix-arg)
(4 'top)
@malcook
malcook / bamTabulateGaps.R
Created June 9, 2011 15:20
bamTabulateGaps : For a bam file containing gapped alignments tabulate the (unstranded) coverage of all gaps therein.
library(IRanges) # for: coverage, psetdiff, etc
library(GenomicRanges) # for: readGappedAlignments,
library(Rsamtools) # for: reading bam files scanBam, countBam etc
library(rtracklayer) # for: track file IO (bed, wig, etc)
library(sqldf) # for: querying dataframes using SQL\
bamTabulateGaps <- function(bamPath,
bedPath=paste(gsub('.bam$','',bamPath),'.junctions.bed',sep=''),
trackName=gsub('\\..*','',basename(bamPath)),
trackLine=sprintf("track name=%s graphType=junctions",trackName),