Mercurial > repos > tomnl > create_sqlite_db
diff create_sqlite_db.R @ 21:7f57d501badb draft
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 04023134d8f28e85927ca293373c506484149ead-dirty
author | tomnl |
---|---|
date | Fri, 01 Jun 2018 13:44:38 -0400 |
parents | 74917d0e89cc |
children | 5d47dd174435 |
line wrap: on
line diff
--- a/create_sqlite_db.R Thu May 31 11:29:47 2018 -0400 +++ b/create_sqlite_db.R Fri Jun 01 13:44:38 2018 -0400 @@ -138,10 +138,12 @@ con <- DBI::dbConnect(RSQLite::SQLite(), db_pth) -add_extra_table_elucidation <- function(name, pth, db_con, filter_Score=NA, filter_Rank=NA){ +add_extra_table_elucidation <- function(name, pth, db_con){ if (is.null(pth)){ return(0) - } + } + + DBI::dbWriteTable(conn=db_con, name=name, value=pth, sep='\t', header=T) @@ -162,11 +164,11 @@ DBI::dbWriteTable(db_con, name=name, value=df, row.names=FALSE, append=append) } -add_probmetab <- function(pth, con){ +add_probmetab <- function(pth, xset, con){ if (!is.null(pth)){ df <- read.table(pth, header = TRUE, sep='\t', stringsAsFactors = FALSE, comment.char = "") - df$grp_id <- 1:nrow(df) + df$grp_id <- match(df$name, xcms::groupnames(xset)) start <- T for (i in 1:nrow(df)){ @@ -207,13 +209,15 @@ add_extra_table_elucidation('metfrag_results', opt$metfrag_result, con, filter_Score=0.6, filter_Rank=NA) add_extra_table_elucidation('sirius_csifingerid_results', opt$sirius_csifingerid_result, con, filter_Score=NA, filter_Rank=5) -add_probmetab(opt$probmetab_result, con) + if (is.null(xset)){ DBI::dbWriteTable(con, name='xset_classes', value=xa@xcmsSet@phenoData, row.names=TRUE) + add_probmetab(opt$probmetab_result, xset, con) }else{ DBI::dbWriteTable(con, name='xset_classes', value=xset@phenoData, row.names=TRUE) + add_probmetab(opt$probmetab_result, xset, con) }