forked from smw1414/circlncRNAnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deseq2_annotation.r
executable file
·38 lines (28 loc) · 1.18 KB
/
deseq2_annotation.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env Rscript
##########################
# gene annotation module #
##########################
args=commandArgs(TRUE)
library("getopt")
spec <- matrix(c(
'input', 'i', 1, "character", "output from Deseq2 (required)",
'output','o', 2, "character", "output file (optional)"
),ncol=5,byrow=T)
opt = getopt(spec)
if ( is.null(opt$input)) {
cat(paste(getopt(spec, usage=T)))
q();
}
# define default value
if ( is.null(opt$output ) ) { opt$output = "output.txt" }
library("data.table")
# loading annotation
annotation=readRDS("dbNSFP3.2_gene_lite.rds")
deg=fread(opt$input,header=T,sep="\t")
genelist=paste(deg[abs(log2FoldChange)>=1&pvalue<=0.05,]$gene,collapse=",")
write.table(genelist,"output/genelist.txt",quote=F,col.names=F,row.names=F)
output=merge(deg,annotation,all.x=T,by.x="gene",by.y="Gene_name")
# merge gene with annotation
write.table(output,opt$output,quote=F,sep="\t",row.names=F)
#system(paste0("/share/apps/lancer2/tabulate_lncRNA_RPB_r1.R -q ",deg[abs(log2FoldChange)>=1&pvalue<=0.05,]$gene[1]))
#system(paste0("/share/apps/lancer2/correlation_20161206.r"," -n output/norm_readstable.txt -f count_matrix_conditon.txt -a gencodev25 -s symbol -m lnc -q ",genelist))