Skip to content

Instantly share code, notes, and snippets.

pval_computing <- function(tab, output) {
t <- read.table(tab);
cat("reading", tab, "Done\n")
p.val <- rep(NA, times = nrow(t));
ind_1 <- seq(1:nrow(t));
#chr1 3101 3200 4 0 68 4 0 53
#chr stt end #ofSites c_num t_num #ofSites c_num t_num
p.val[ind_1] <- lapply(ind_1, function(x) fisher.test(matrix(c(t[x, 5], t[x, 8], t[x, 6], t[x, 9]), nrow = 2))$p.val);
#!/usr/bin/perl -w
use strict;
##################################################
#This script is to convert tab-delimited file to #
#Exel sheets. #
##################################################
use Excel::Writer::XLSX;
my ($tab, $out) = @ARGV;
die usage() unless @ARGV == 2;
@readbio
readbio / multi-threading with perl example
Created July 6, 2016 13:45 — forked from jclosure/multi-threading with perl example
multi-threading with perl example
#!/opt/local/bin/perl -w
use threads;
use strict;
use warnings;
# SOURCE REF: http://chicken.genouest.org/perl/multi-threading-with-perl/
my @a = ();
my @b = ();
@readbio
readbio / DESeq.R
Last active February 20, 2018 13:43
DESeq to identify DEG without biological replicates
library(DESeq);
data_pnas<-read.table("readCount.res",header=T,row.names=1);
head(data_pnas);
data_pnas_desi<-data.frame(row.names=colnames(data_pnas),condition = c("Sample_g1","Sample_g2","Sample_g3","Sample_g4"),libType = c("single-end","single-end","single-end","single-end"));
condition = data_pnas_desi$condition;condition;
cds = newCountDataSet(data_pnas, condition);
#!/usr/bin/python
import sys
import re
gene_list = sys.argv[1]
motif = sys.argv[2]
#print(gene_list)
#print(motif)
library(ggplot2)
cc<-read.csv("density_plot.csv",header=T)
diff<-cc[,3]-cc[,2]
p<-ggplot()+geom_density(aes(diff),colour="royalblue", fill="royalblue",alpha=.3)+geom_vline(xintercept=0, linetype="dashed")+xlab("mutant minus WT");ggsave("density_plot.pdf", p)
library(ggplot2)
cc<-read.csv("density_plot.csv",header=T)
diff<-cc[,3]-cc[,2]
p<-ggplot()+geom_density(aes(diff),colour="royalblue", fill="royalblue",alpha=.3)+geom_vline(xintercept=0, linetype="dashed")+xlab("mutant minus WT");ggsave("density_plot.pdf", p)
@readbio
readbio / deseq-vs-edger.R
Created October 6, 2015 19:51 — forked from stephenturner/deseq-vs-edger.R
DESeq vs edgeR comparison
# Note: using the devel versions of both packages!
library(DESeq) # version 1.9.11
library(edgeR) # version 2.99.8
library(VennDiagram)
# Read in data ------------------------------------------------------------
## Use pasilla data
datafile = system.file( "extdata/pasilla_gene_counts.tsv", package="pasilla" )
datafile