This file contains hidden or 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
# Copied From: https://svn.transvar.org/repos/genomes/trunk/pub/src/spliceAnal.py | |
#!/usr/bin/env python | |
""" | |
This file contains code for analyzing novel splicing events from | |
FindJunctions or Tophat junction features. | |
If running this interactively, use the writeJunctions method to create | |
a file that classifies junctions according to whether they are new or | |
novel, internal or external to a known gene, and their frequency of |
This file contains hidden or 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
EOS = "$" | |
''' | |
All sort algorithm here use the Built-in `sort` function inside Python | |
''' | |
refSeq = raw_input("Your ref: ") | |
if not refSeq: | |
refSeq = "ACAACG" | |
def print_table(table): | |
''' |
This file contains hidden or 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/python | |
from math import * | |
strG = str(raw_input("Genome sequence: ")) | |
strR = str(raw_input("Read sequence: ")) | |
strG = strG.upper() | |
strR = strR.upper() | |
print "Your genome ref input : " +strG | |
print "Your read ref input : " +strR | |
matrix = [] |
This file contains hidden or 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
require(pROC) | |
set.seed(1026) | |
obs<-rep(0:1, each=50) | |
pred<-c(runif(50,min=0,max=0.8),runif(50,min=0.3,max=0.6)) | |
plot(roc(obs,pred),print.auc=TRUE, auc.polygon=TRUE,max.auc.polygon=TRUE,auc.polygon.col="#DEEBE8",grid=c(0.1,0.2),grid.col=c("blue","red"),print.thres=TRUE) |
This file contains hidden or 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
#### Author: http://web1.sph.emory.edu/users/hwu30/ | |
#### example scripts to play with BAM files. | |
library(GenomicRanges) | |
library(GenomicFeatures) | |
library(Rsamtools) | |
## first get gene information from UCSC. This will take 2 minutes or so. | |
## Or if you have these saved you can load them in using: refGene.hg18=loadFeatures("refGene.hg18.GR.sqlite") | |
refGene.hg18=makeTranscriptDbFromUCSC(genom="hg18",tablename="refGene") | |
tx=transcripts(refGene.hg18) |
This file contains hidden or 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
set.seed(1026) | |
# dummy 2-D data: yi~xi(x1,x2) | |
x = rbind(cbind(rnorm(50, 1, 0.3), rnorm(50, 2, 0.3)), cbind(rnorm(50, 2, 0.3), rnorm(50, 1, 0.3))) | |
# [,1] [,2] | |
# [1,] 1.6565944 1.696906 | |
# [2,] 0.9467358 1.458583 | |
# [3,] 0.9444174 1.513886 | |
# [4,] 0.2480391 2.273355 | |
# [5,] 0.8328066 2.078371 | |
# [6,] 0.9569322 2.174178 |
This file contains hidden or 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
qsort <- function(v) { | |
if ( length(v) > 1 ) | |
{ | |
pivot <- median(v) # median value as pivot value | |
c(qsort(v[v < pivot]), v[v == pivot], qsort(v[v > pivot])) | |
} else v | |
} |
This file contains hidden or 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
#http://rosettacode.org/wiki/Sorting_algorithms/Quicksort#Perl | |
sub quick_sort { | |
my @a = @_; | |
return @a if @a < 2; | |
my $p = pop @a; | |
quick_sort(grep $_ < $p, @a), $p, quick_sort(grep $_ >= $p, @a); | |
} | |
my @array = (1,4,2,3,6,5,8,7); | |
@array = quick_sort @array; | |
print "@array\n"; |
This file contains hidden or 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
# OS X termial theme | |
# tell ls to be colourful | |
export CLICOLOR=1 | |
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx | |
# tell grep to highlight matches | |
export GREP_OPTIONS='--color=auto' | |
# alias | |
alias ls='ls -FGal' | |
# set custom bash prompt | |
#export PS1="\[\033[1;34m\]\!\[\033[0m\] \[\033[1;35m\]\u\[\033[0m\]:\[\033[1;35m\]\W\[\033[0m\]$ " |
This file contains hidden or 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
<snippet> | |
<content><![CDATA[ | |
{% highlight ${1:LanguageType} %} | |
${2:CodesHere} | |
{% endhighlight %} | |
$0]]></content> | |
<tabTrigger>mdcd</tabTrigger> | |
<scope>text.html.markdown.multimarkdown, text.html.markdown</scope> | |
</snippet> |