Commit 34bd6ead authored by Brandi Cantarel's avatar Brandi Cantarel

Merge branch 'master' into 'shiny_update'

# Conflicts:
#   workflow/scripts/dea.R
parents d80812e4 568d7183
Pipeline #2615 failed with stage
in 157 minutes and 33 seconds
## RNASeq Analysis Worklow
```
module load nextflow/0.24.1-SNAPSHOT
module load nextflow
nextflow run workflow/main.nf
```
process.executor='slurm'
process.queue='128GB,256GB,256GBv1'
process.clusterOptions = '--hold'
trace.enabled = true
trace.enabled = false
trace.file = 'pipeline_trace.txt'
trace.field = 'task_id,native_id,process,name,status,exit,submit,start,complete,duration,realtime'
......@@ -200,8 +200,8 @@ process statanal {
output:
file "*.txt" into txtfiles
file "*.png" into psfiles
file "*"
file("bg.rda") into rdafiles
file("geneset.shiny.gmt") into gmtfile
when:
script:
if (params.dea == 'skip')
......@@ -209,6 +209,8 @@ process statanal {
perl $baseDir/scripts/concat_cts.pl -o ./ *.cts
perl $baseDir/scripts/concat_fpkm.pl -o ./ *.fpkm.txt
touch empty.png
touch bg.rda
cp geneset.gmt geneset.shiny.gmt
"""
else
"""
......
Subproject commit 1edf4c95eedead3752115f49a941100fd02aa270
Subproject commit 75a4aa688f82c607794e109e4ee0ec8e12418a2d
......@@ -38,6 +38,7 @@ while (my $line = <DFILE>) {
my %hash;
foreach my $i (0..$#row) {
next unless ($newcols{$colnames[$i]});
$row[$i] =~ s/-//g unless ($colnames[$i] =~ m/Fq/);
$hash{$colnames[$i]} = $row[$i];
}
if ($hash{SampleID} =~ m/^\d/) {
......@@ -51,7 +52,7 @@ while (my $line = <DFILE>) {
$j = $lnct %% 2;
$hash{SampleGroup} = $grp[$j];
}
$hash{SampleGroup} =~ s/_/./g;
$hash{SampleGroup} =~ s/_//g;
my @line;
foreach $f (@cols) {
push @line, $hash{$f};
......
......@@ -94,23 +94,24 @@ for (i in 1:a) {
write.table(output,file=paste(cond[i],'_',cond[j],'.deseq2.txt',sep=""),quote=FALSE,row.names=FALSE,sep='\t')
filt.out <- na.omit(output[output$fdr < 0.05,])
if (nrow(filt.out) > 2) {
subset <- logcpm[row.names(logcpm) %in% filt.out$symbol,]
gnames <- filt.out[c('ensembl','symbol')]
s <- merge(gnames,subset,by.x="ensembl",by.y="row.names",all.x=FALSE,all.y=TRUE,sort=FALSE)
STREE <- hclust(dist(t(subset)))
zscores <- scale(t(subset))
ngenes <- length(colnames(zscores))
textscale <- (1/(ngenes/30))
if (textscale > 1) {
textscale <-1
}
if (textscale < 0.1) {
textscale <- 0.1
}
png(file=paste(cond[i],'_',cond[j],'.heatmap.deseq2.png',sep=""),height=768,width=1024)
heatmap.2(zscores, col = bluered(100),Rowv = as.dendrogram(STREE), RowSideColors = col.blocks,dendrogram='row', cexCol=textscale,labCol=s$symbol,srtRow=45,srtCol=45,trace="none", margins=c(5, 5))
legend("topright",legend=grpnames,col=rainbow(length(grpnames)),pch=20,cex=0.5)
dev.off()
subset <- logcpm[row.names(logcpm) %in% filt.out$symbol,]
subset <- subset[!apply(subset, 1, function(x) {any(x == 0)}),]
gnames <- filt.out[c('ensembl','symbol')]
s <- merge(gnames,subset,by.x="ensembl",by.y="row.names",all.x=FALSE,all.y=TRUE,sort=FALSE)
STREE <- hclust(dist(t(subset)))
zscores <- scale(t(subset))
ngenes <- length(colnames(zscores))
textscale <- (1/(ngenes/30))
if (textscale > 1) {
textscale <-1
}
if (textscale < 0.1) {
textscale <- 0.1
}
png(file=paste(cond[i],'_',cond[j],'.heatmap.deseq2.png',sep=""),height=768,width=1024)
heatmap.2(zscores, col = bluered(100),Rowv = as.dendrogram(STREE), RowSideColors = col.blocks,dendrogram='row', cexCol=textscale,labCol=s$symbol,srtRow=45,srtCol=45,trace="none", margins=c(5, 5))
legend("topright",legend=grpnames,col=rainbow(length(grpnames)),pch=20,cex=0.5)
dev.off()
}
}
}
......@@ -149,26 +150,28 @@ for (i in 1:a) {
write.table(output,file=paste(cond[i],'_',cond[j],'.edgeR.txt',sep=""),quote=FALSE,row.names=FALSE,sep='\t')
filt.out <- na.omit(output[output$fdr < 0.05,])
if (nrow(filt.out) > 2) {
subset <- logcpm[row.names(logcpm) %in% filt.out$symbol,]
gnames <- filt.out[c('ensembl','symbol')]
s <- merge(gnames,subset,by.x="ensembl",by.y="row.names",all.x=FALSE,all.y=TRUE,sort=FALSE)
STREE <- hclust(dist(t(subset)))
zscores <- scale(t(subset))
ngenes <- length(colnames(zscores))
textscale <- (1/(ngenes/30))
if (textscale > 1) {
textscale <-1
}
if (textscale < 0.1) {
textscale <- 0.1
}
png(file=paste(cond[i],'_',cond[j],'.heatmap.edgeR.png',sep=""),height=768,width=1024)
heatmap.2(zscores, col = bluered(100),Rowv = as.dendrogram(STREE), RowSideColors = col.blocks,dendrogram='row', cexCol=textscale,labCol=s$symbol,srtRow=45,srtCol=45,trace="none", margins=c(5, 8))
legend("topright",legend=grpnames,col=rainbow(length(grpnames)),pch=20,cex=1.5)
dev.off()
gcont <- paste(cond[j],cond[i],sep='-')
qs.results = qusage(logcpm, grps,gcont,MSIG.geneSets)
save(qs.results,file=paste(cond[i],'_',cond[j],'.qusage.rda',sep=""))
subset <- logcpm[row.names(logcpm) %in% filt.out$symbol,]
subset <- subset[!apply(subset, 1, function(x) {any(x == 0)}),]
gnames <- filt.out[c('ensembl','symbol')]
s <- merge(gnames,subset,by.x="ensembl",by.y="row.names",all.x=FALSE,all.y=TRUE,sort=FALSE)
STREE <- hclust(dist(t(subset)))
zscores <- scale(t(subset))
ngenes <- length(colnames(zscores))
textscale <- (1/(ngenes/30))
if (textscale > 1) {
textscale <-1
}
if (textscale < 0.1) {
textscale <- 0.1
}
png(file=paste(cond[i],'_',cond[j],'.heatmap.edgeR.png',sep=""),height=768,width=1024)
heatmap.2(zscores, col = bluered(100),Rowv = as.dendrogram(STREE), RowSideColors = col.blocks,dendrogram='row', cexCol=textscale,labCol=s$symbol,srtRow=45,srtCol=45,trace="none", margins=c(5, 5))
legend("topright",legend=grpnames,col=rainbow(length(grpnames)),pch=20,cex=0.5)
dev.off()
gcont <- paste(cond[j],cond[i],sep='-')
qs.results = qusage(logcpm, grps,gcont,MSIG.geneSets)
save(qs.results,file=paste(cond[i],'_',cond[j],'.qusage.rda',sep=""))
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment