changeset 22:c8b34df46dae draft

planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 04023134d8f28e85927ca293373c506484149ead-dirty
author tomnl
date Fri, 01 Jun 2018 13:41:15 -0400
parents e8291b9d129b
children b48824808bab
files create_sqlite_db.R
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/create_sqlite_db.R	Thu May 31 11:26:26 2018 -0400
+++ b/create_sqlite_db.R	Fri Jun 01 13:41:15 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)
 
 }