Skip to content

Instantly share code, notes, and snippets.

View Puriney's full-sized avatar

Yun YAN Puriney

View GitHub Profile
@Puriney
Puriney / README.md
Last active August 29, 2015 14:07 — forked from psychemedia/README.md

Minimal R shiny app demonstrating:

  1. how to upload a CSV file into an R/shiny app
  2. how to automatically populate list selectors based on column headers
  3. how to use optional list selectors
  4. how to populate a list selector with column names of numerical columns only
  5. how to use an action button to trigger an event when you're ready to do so

@Puriney
Puriney / ChemmineOB and open-babela.md
Last active August 29, 2015 14:07
ChemmineOB and open-babel.md

install open-babel

brew install open-babel

locate OPEN_BABEL_INCDIR and OPEN_BABEL_LIBDIR

OPEN_BABEL_INCDIR is /usr/local/Cellar/open-babel/2.3.2/lib/openbabel/2.3.2, where files like alias.h, descriptor.h, pointgroup.h, atom.h etc.

OPEN_BABEL_LIBDIR is /usr/local/Cellar/open-babel/2.3.2/lib/openbabel/2.3.2, where files like APIInterface.so, fastsearchformat.so, outformat.so, CSRformat.so, etc.

@Puriney
Puriney / vimrc
Created July 31, 2014 10:52
Vim: Vimrc
" don't bother with vi compatibility
set nocompatible
" Color Scheme
" enable syntax highlighting
syntax enable
set background=dark
" configure Vundle
filetype on " without this vim emits a zero exit status, later, because of :ft off
filetype off
set rtp+=~/.vim/bundle/vundle/
@Puriney
Puriney / AddColumn.R
Created July 30, 2014 17:03
R: GenomicRanges elementMetadata add column
library(GenomicRanges)
sampleChr <- paste0("Chr", 1:3)
sampleStarts <- sample(1:100, size = 3, replace = F)
sampleEnds <- sampleStarts + 10
sampleStrand <- sample(c("+", "-"), size = 3, replace = T)
sampleValue <- rnorm(3)
sampleGR1 <- GRanges(seqnames = Rle(sampleChr), ranges = IRanges(sampleStarts, sampleEnds), strand = Rle(sampleStrand), value = sampleValue)
sampleGR2 <- GRanges(seqnames = Rle(sampleChr), ranges = IRanges(sampleStarts + 10 , sampleEnds + 100), strand = Rle(sampleStrand), value = sampleValue)
@Puriney
Puriney / PrettyGitLogCommand
Created May 13, 2014 22:25
Git: pretty log
# Pretty git log
# https://github.com/tiimgreen/github-cheat-sheet/blob/master/README.zh-cn.md#%E6%9B%B4%E7%9B%B4%E8%A7%82%E7%9A%84git-log
# echo $0 >> ~/.bash_profile
alias gitlog="git log --all --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
%!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.
@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">
@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 / 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 / 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";