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
# https://gist.github.com/bobthecat/5024079 | |
bigcorPar <- function(x, nblocks = 10, verbose = TRUE, ncore="all",pvalue=0.05, ...){ | |
library(ff, quietly = TRUE) | |
library(psych) | |
require(doMC) | |
if(ncore=="all"){ | |
ncore = 30 | |
registerDoMC(cores = ncore) | |
} else{ | |
registerDoMC(cores = ncore) |
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
bigcorPar <- function(x, nblocks = 10, verbose = TRUE, ncore="all", ...){ | |
library(ff, quietly = TRUE) | |
require(doMC) | |
if(ncore=="all"){ | |
ncore = multicore:::detectCores() | |
registerDoMC(cores = ncore) | |
} else{ | |
registerDoMC(cores = ncore) | |
} |
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
awk -F "\t" –v S=”Sample” -v OFS="\t" '{ | |
if($12=="-" && $25=="-" && $36=="-" && $13==0 && $26==0 && $37==0) print $4,$5,$6,"-",S,$10,$12,$13,$23,$25,$26,$34,$36,$37,$NF; | |
else if($12=="-" && $25=="-" && $13==0 && $26==0 && $37!=0) print $4,$5,$6,"-",S,$10,$12,$13,$23,$25,$26,$34,$36,$37,$NF; | |
else if($12=="-" && $36=="-" && $13==0 && $26!=0 && $37==0) print $4,$5,$6,"-",S,$10,$12,$13,$23,$25,$26,$34,$36,$37,$NF; | |
else if($12=="-" && $13==0 && $26!=0 && $37!=0) print $4,$5,$6,"-",S,$10,$12,$13,$23,$25,$26,$34,$36,$37,$NF; | |
else if( $25=="-" && $36=="-" && $13!=0 && $26==0 && $37==0) print $4,$5,$6,"-",S,$10,$12,$13,$23,$25,$26,$34,$36,$37,$NF; | |
else if( $25=="-" && $13!=0 && $26==0 && $37!=0) print $4,$5,$6,"-",S,$10,$12,$13,$23,$25,$26,$34,$36,$37,$NF; | |
else if( $36=="-" && $13!=0 && $26!=0 && $37==0) print $4,$5,$6,"-",S,$10,$12,$13,$23,$25,$26,$34,$36,$37,$NF; | |
else print $4,$5,$6,"+",S,$10,$12,$13,$23,$25,$26,$34,$36,$37,$NF; | |
}' snippet.hmr.bed.5prime.3prime.cloestKnownGFeneTSS1000 > snippet.hmr.overlap.tss.cp |
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
chr1 249250621 | |
chr1_gl000191_random 106433 | |
chr1_gl000192_random 547496 | |
chr2 243199373 | |
chr3 198022430 | |
chr4 191154276 | |
chr4_ctg9_hap1 590426 | |
chr4_gl000193_random 189789 | |
chr4_gl000194_random 191469 | |
chr5 180915260 |
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
chr1 0 249250621 | |
chr1_gl000191_random 0 106433 | |
chr1_gl000192_random 0 547496 | |
chr2 0 243199373 | |
chr3 0 198022430 | |
chr4 0 191154276 | |
chr4_ctg9_hap1 0 590426 | |
chr4_gl000193_random 0 189789 | |
chr4_gl000194_random 0 191469 | |
chr5 0 180915260 |
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
# 檢查 ggplot2 與 grid 套件是否安裝 | |
echo 'list.of.packages <- c("ggplot2","grid")' | |
echo 'new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]' | |
echo 'if(length(new.packages)) install.packages(new.packages)' | |
# 載入 ggplot2 套件 | |
echo 'library(ggplot2) ' | |
# 將多張圖繪製成同一張圖的函式 (http://stackoverflow.com/questions/11721401/r-save-multiplot-to-file) | |
echo 'multiplot <- function(..., plotlist=NULL, file, cols=1, layout=NULL) { ' | |
echo ' require(grid) ' | |
echo ' # Make a list from the ... arguments and plotlist ' |
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
import java.util.stream.*; | |
import java.util.*; | |
import java.nio.file.*; | |
import java.io.*; | |
import static java.lang.System.out; | |
class Merge { | |
public static void main (String... args)throws Exception{ | |
Map<String,String> sorted = Files.lines(Paths.get(args[0])) | |
.map(line -> line.split("\t")) |
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
import java.util.zip.*; | |
import java.io.*; | |
import java.util.*; | |
public class GenerateBinsForRegionsAndReverseByStrand{ | |
static LinkedHashMap<String, String> data = new LinkedHashMap<String, String>(); | |
public static void main(String[] args) throws Exception { | |
if(args.length!=2){ | |
System.err.println("java -Xmx14g GenerateBinsForRegionsAndReverseByStrand bed-like binsize"); | |
System.exit(1); |
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
import java.io.*; | |
import java.util.*; | |
public class ExtractIntronExonUTRFromKnownGeneAndKgXref { | |
public static void main(String[] args) throws Exception { | |
BufferedReader br = new BufferedReader(new FileReader(args[1])); | |
HashMap<String,String> xref=new HashMap<String,String>(); | |
String tmp = ""; | |
while ((tmp = br.readLine()) != null) { | |
String[] x = tmp.split("\t"); |
NewerOlder