Skip to content

Instantly share code, notes, and snippets.

View Puriney's full-sized avatar

Yun YAN Puriney

View GitHub Profile
@Puriney
Puriney / Bioconductor_DEG.R
Created August 9, 2013 15:31
R: DEG Bioconductor
#### 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)
@Puriney
Puriney / pROC.R
Created August 13, 2013 03:14
R: ROC
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)
@Puriney
Puriney / Smith_Warterman.py
Created August 20, 2013 19:49
Python: Smith Waterman
#!/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 = []
@Puriney
Puriney / FM-index.py
Created August 23, 2013 21:29
Python: Lazy FM-index.py
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):
'''
@Puriney
Puriney / spliceAnal.py
Last active December 22, 2015 22:29
Python: Splicing Analysis
# 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
@Puriney
Puriney / unionGeneModelforTAIR10.pl
Created September 21, 2013 23:10
PERL: Union Gene Model
#!/usr/bin/perl -w
use strict;
# Notice:
# BED annotation should be sorted by the GeneID or GeneName ahead
# otherwise duplication in output
my $inBed = shift || die $!;
my $outUnion = shift || die $!;
open OUT, "> $outUnion";
@Puriney
Puriney / Coverage.R
Created October 19, 2013 01:35 — forked from CnrLwlss/Coverage.R
R: Bioconductor: converage per base
library(ShortRead)
# Root of .bam filename
sname <- "HG00100.unmapped.ILLUMINA.bwa.GBR.low_coverage.20130415"
# Construct path to file
fname <- file.path("alignments",paste(sname,".bam",sep=""))
# Read alignments
bm <- readGappedAlignments(fname)
@Puriney
Puriney / HMM.R
Created November 3, 2013 00:37
R: HMM
## Demo for HMM
## Reproduce "What is HMM", Sean R Eddy, Nature Biotechnology 2004
S <- c(0,1,rep(0,3))
E <- c(0, 0.9, 0.1, 0, 0)
SS5 <- c(rep(0,3), 1, 0)
I <- c(rep(0,3), 0.9, 0.1)
N <- c(rep(0,4), 1)
myTransMtx <- rbind(S,E, SS5, I, N)
colnames(myTransMtx) <- rownames(myTransMtx)
@Puriney
Puriney / gist:7441781
Created November 13, 2013 01:03
HTML: accordian bootstrap3
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
Accordian1
</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse in">
%!TEX TS-program = xelatex
\documentclass[12pt]{scrartcl}
% The declaration of the document class:
% The second line here, i.e.
% \documentclass[12pt]{scrartcl}
% is a standard LaTeX document class declaration:
% we say what kind of document we are making in curly brackets,
% and specify any options in square brackets.