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
cat hg18.fa | awk '{ | |
if (substr($0, 1, 1)==">") {filename=(substr($0,2) ".fa")} | |
print $0 > filename | |
}' |
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="|"), "|")) | |
} |
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
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
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
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
#!/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
plotRNAcoverage <- function(rs, tx, what=c("transcripts", "exons", "introns"), | |
nsamples=100, main="RNA-seq bias plot", verbose="TRUE") { | |
what <- match.arg(what) | |
if (what=="transcripts") { | |
genes <- exonsBy(txdb, "tx") | |
values(genes) <- NULL | |
} else if (what=="exons") { | |
genes <- exons(txdb) | |
values(genes) <- NULL | |
genes <- split(genes, 1:length(genes)) |
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
#!/usr/bin/env python | |
""" | |
getimg.py | |
##oh hai dere | |
Gets the current image of the day from NASA and sets it as the | |
background in Gnome. The summary / description text is written | |
to the image. |
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
library(Repitools) | |
library(chipseq) | |
library(BSgenome.Hsapiens.UCSC.hg18) | |
library(rtracklayer) | |
rootdir <- "/home/data/NGS_New" | |
NGS <- read.csv(paste(rootdir, "NGS_Log14.csv", sep="/"), stringsAsFactors=FALSE, header=T) | |
load(paste(NGS$Path[1], NGS$RdataGR[1], sep="/")) |
NewerOlder