Mercurial > repos > artbio > ngsplot
comparison bin/remove.db.tables.r @ 0:3ca58369469c draft
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
author | artbio |
---|---|
date | Wed, 06 Dec 2017 19:01:53 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3ca58369469c |
---|---|
1 #!/usr/bin/env Rscript | |
2 # Remove the genome entries from two ngs.plot system files: | |
3 # default.tbl and dbfile.tbl. | |
4 | |
5 args <- commandArgs(T) | |
6 if(length(args)>1){ | |
7 gname.to.rm <- args[1] | |
8 feature.to.rm <- args[2] | |
9 }else{ | |
10 gname.to.rm <- args[1] | |
11 } | |
12 | |
13 # Save to text output. | |
14 progpath <- Sys.getenv('NGSPLOT') | |
15 if(progpath == "") { | |
16 stop("Set environment variable NGSPLOT before run the program. See README for details.\n") | |
17 } | |
18 default.file <- file.path(progpath, 'database', 'default.tbl') | |
19 dbfile.file <- file.path(progpath, 'database', 'dbfile.tbl') | |
20 default.tbl <- read.delim(default.file) | |
21 dbfile.tbl <- read.delim(dbfile.file) | |
22 | |
23 if(exists("feature.to.rm")){ | |
24 default.tbl <- subset(default.tbl, !(Genome==gname.to.rm & Region==feature.to.rm)) | |
25 dbfile.tbl <- subset(dbfile.tbl, !(Genome==gname.to.rm & Region==feature.to.rm)) | |
26 }else{ | |
27 default.tbl <- default.tbl[default.tbl$Genome != gname.to.rm, ] | |
28 dbfile.tbl <- dbfile.tbl[dbfile.tbl$Genome != gname.to.rm, ] | |
29 } | |
30 | |
31 | |
32 write.table(default.tbl, file=default.file, row.names=F, sep="\t", quote=F) | |
33 write.table(dbfile.tbl, file=dbfile.file, row.names=F, sep="\t", quote=F) | |
34 | |
35 | |
36 # getScore <- function(i, db.fi, default.fi){ | |
37 # score <- 3 - length(intersect(as.matrix(default.fi[db.fi[i, "tag"], ]), as.matrix(db.fi[i, ]))) | |
38 # return(score) | |
39 # } | |
40 | |
41 # for (i in (1:dim(db.fi)[1])){ | |
42 # anno.db.tbl[i, "dbScore"] <- getScore(i, db.fi, default.fi) | |
43 # } | |
44 | |
45 # anno.version="0.01" | |
46 # save(anno.tbl, anno.db.tbl, anno.version, file="database.RData") |