This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Important notes | |
#if backupdir is under homedir then backupdir must be included in the "$backupdir"/exclude file otherwise it will recurse | |
#also "$backupdir"/exclude file must not contain blank lines (match everything therefore backup nothing) | |
homedir="/home/aarsta" | |
backupdir="/home/aarsta/R_Backup" | |
find "$homedir" -name "*.R" | grep -v -f "$backupdir"/exclude | grep -o \\/.*\\/ | sort | uniq | sed -e "s%"$homedir"/%"$backupdir"/%" -e 's% %_%g'| xargs mkdir -p | |
SAVEIFS=$IFS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cufflinks2TranscriptDB <- function(filename, verbose=TRUE) { | |
require(rtracklayer) | |
require(GenomicRanges) | |
require(GenomicFeatures) | |
requiredAttribs <- c("gene_id", "transcript_id", "exon_number") | |
if (verbose) message("Importing ", filename) | |
tmp <- import.gff(filename, asRangedData=FALSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GpCplot <- function(amplicon, reads, main="", minScore=150) { | |
require(Biostrings) | |
require(GenomicRanges) | |
if (class(amplicon)=="character") amplicon <- DNAString(amplicon) | |
amplicon.conv <- DNAString(gsub("C", "T", gsub("GC", "GY", gsub("CG", "YG", amplicon)))) | |
reads <- read.DNAStringSet(reads) | |
readsHitAll <- list("plus"=pairwiseAlignment(reads, amplicon.conv, type="local-global"), "minus"=pairwiseAlignment(reverseComplement(reads), amplicon.conv, type="local-global")) | |
readsStrand <- ifelse(score(readsHitAll$plus)>score(readsHitAll$minus), "+", "-") | |
reads2 <- reads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lboxplot <- function(x, cols=2:(length(x)+1), ...) { | |
xl <- length(x) | |
if (xl<2) stop("Length of x must be >=2") | |
xn <- sapply(x, length) | |
if (!all(xn==xn[1])) stop ("Element lengths of x must all be the same") | |
xnames <- sapply(x, names) | |
if (!all(apply(xnames, 1, function(y) all(y==y[1])))) stop("Each element of x must have matching names") | |
xn <- xn[1] | |
xu <- unlist(x, recursive=FALSE)[rep(1:xn, each=xl)+rep((1:xl-1)*xn, xn)] | |
boxplot(xu, col=cols, xaxt="n", ...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plotDensities <- function(s, col=NULL, xlim=NULL, ylim=NULL, na.rm=TRUE, lty=rep(1, length(s)), ...) { | |
if (!is.list(s)) s <- list(s) | |
if (is.null(col)) col <- rainbow(length(s)) | |
sD <- lapply(s, density, na.rm=na.rm) | |
if (is.null(xlim)) xlim <- range(sapply(sD, function(x) range(x$x))) | |
if (is.null(ylim))ylim <- range(sapply(sD, function(x) range(x$y))) | |
plot(0, type="n", xlim=xlim, ylim=ylim, ...) | |
for (i in 1:length(sD)) lines(sD[[i]], col=col[i], lty=lty[i], ...) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# wolfpack modules required: hugfre/R/3.0.2 fabbus/aspera/3.1.1.70290 | |
ascpCMD <- "ascp -QT -l1000M -i /share/ClusterShare/software/contrib/fabbus/aspera/3.1.1.70290/asperaweb_id_dsa.putty" | |
library(SRAdb) | |
if (!file.exists("../SRAmetadb.sqlite")) db <- getSRAdbFile("../") else db <- "../SRAmetadb.sqlite" | |
con <- dbConnect(dbDriver("SQLite"), db) # load the SRA database | |
accession <- "SRP026604" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE log( | |
time TEXT TEXT, | |
account TEXT TEXT, | |
env_list TEXT, | |
gid TEXT, | |
grp TEXT, | |
job_name TEXT, | |
job_number TEXT, | |
jobshare TEXT, | |
mail_list TEXT, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
if [[ ! -f "${1}" ]] ; then | |
echo "File $1 does not exist, aborting." | |
exit 1 | |
fi | |
# Replace double digit chromosomes first | |
cmd="sed" | |
for i in `seq 10 22` `seq 1 9` X Y; do | |
cmd="$cmd -e 's/chr$i/$i/g'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JIRAtable <- function(x) { | |
message(paste0("||", paste(names(x), collapse="||"), "||")) | |
for (i in 1:nrow(x)) message(paste0("|", paste(sapply(x[i,], as.character), collapse="|"), "|")) | |
} |
OlderNewer