Mercurial > repos > artbio > ngsplot
view bin/remove.db.tables.r @ 4:9652d08d8441 draft default tip
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit 73a8ef46dddb0a1b224720bcdfe46050ee9a1b8b
author | artbio |
---|---|
date | Tue, 26 Dec 2017 08:07:56 -0500 |
parents | 3ca58369469c |
children |
line wrap: on
line source
#!/usr/bin/env Rscript # Remove the genome entries from two ngs.plot system files: # default.tbl and dbfile.tbl. args <- commandArgs(T) if(length(args)>1){ gname.to.rm <- args[1] feature.to.rm <- args[2] }else{ gname.to.rm <- args[1] } # Save to text output. progpath <- Sys.getenv('NGSPLOT') if(progpath == "") { stop("Set environment variable NGSPLOT before run the program. See README for details.\n") } default.file <- file.path(progpath, 'database', 'default.tbl') dbfile.file <- file.path(progpath, 'database', 'dbfile.tbl') default.tbl <- read.delim(default.file) dbfile.tbl <- read.delim(dbfile.file) if(exists("feature.to.rm")){ default.tbl <- subset(default.tbl, !(Genome==gname.to.rm & Region==feature.to.rm)) dbfile.tbl <- subset(dbfile.tbl, !(Genome==gname.to.rm & Region==feature.to.rm)) }else{ default.tbl <- default.tbl[default.tbl$Genome != gname.to.rm, ] dbfile.tbl <- dbfile.tbl[dbfile.tbl$Genome != gname.to.rm, ] } write.table(default.tbl, file=default.file, row.names=F, sep="\t", quote=F) write.table(dbfile.tbl, file=dbfile.file, row.names=F, sep="\t", quote=F) # getScore <- function(i, db.fi, default.fi){ # score <- 3 - length(intersect(as.matrix(default.fi[db.fi[i, "tag"], ]), as.matrix(db.fi[i, ]))) # return(score) # } # for (i in (1:dim(db.fi)[1])){ # anno.db.tbl[i, "dbScore"] <- getScore(i, db.fi, default.fi) # } # anno.version="0.01" # save(anno.tbl, anno.db.tbl, anno.version, file="database.RData")