# HG changeset patch # User tomnl # Date 1525709376 14400 # Node ID c59965822dc8a179a227b967fa88dc54350e4979 # Parent cf82f99f36382d8a4dda8fcfe5709b7d74bd19ec planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 4116082655a03d3007a49e4a4b00fc6ad4698412-dirty diff -r cf82f99f3638 -r c59965822dc8 create_sqlite_db.R --- a/create_sqlite_db.R Thu May 03 07:34:42 2018 -0400 +++ b/create_sqlite_db.R Mon May 07 12:09:36 2018 -0400 @@ -57,9 +57,12 @@ make_option("--galaxy_names", type="character"), make_option("--grp_peaklist", type="character"), make_option("--db_name", type="character", default='lcms_data.sqlite'), - make_option("--raw_rt_columns", action="store_true") + make_option("--raw_rt_columns", action="store_true"), + make_option("--metfrag_result", type="character"), + make_option("--sirius_csifingerid_result", type="character") ) + # store options opt<- parse_args(OptionParser(option_list=option_list)) @@ -75,7 +78,7 @@ # Requires pa <- loadRData(opt$pa, 'pa') -print('TESTETSTESTETE') + print(pa@fileList) @@ -126,9 +129,37 @@ rtrawColumns = rtrawColumns) } +con <- DBI::dbConnect(RSQLite::SQLite(), db_pth) + +add_extra_table_elucidation <- function(name, pth){ + + print('CHECK1') + print(name) + print(pth) + if (!is.null(pth)){ + print('CHECK2') + print(pth) + df <- read.table(pth, header = TRUE, sep='\t', stringsAsFactors = FALSE, comment.char = "") + # bug for repeating headers + df <- df[!df$UID=='UID',] + + # get peakid, an scan id + df_ids <- stringr::str_split_fixed(df$UID, '-', 3) + colnames(df_ids) <- c('grp_id', 'file_id', 'peak_id') + df <- cbind(df_ids, df) + # export to database + + + DBI::dbWriteTable(con, name=name, value=df, row.names=FALSE) + + } + +} + +add_extra_table_elucidation('metfrag_results', opt$metfrag_result) +add_extra_table_elucidation('sirius_csifingerid_results', opt$sirius_csifingerid_result) -con <- DBI::dbConnect(RSQLite::SQLite(), db_pth) cmd <- paste('SELECT cpg.grpid, cpg.mz, cpg.mzmin, cpg.mzmax, cpg.rt, cpg.rtmin, cpg.rtmax, c_peaks.cid, ', 'c_peaks.mzmin AS c_peak_mzmin, c_peaks.mzmax AS c_peak_mzmax, ', diff -r cf82f99f3638 -r c59965822dc8 create_sqlite_db.xml --- a/create_sqlite_db.xml Thu May 03 07:34:42 2018 -0400 +++ b/create_sqlite_db.xml Mon May 07 12:09:36 2018 -0400 @@ -1,4 +1,4 @@ - + Create SQLite database of an XCMS-CAMERA dataset @@ -36,6 +36,19 @@ ' #end if + + #if $metfrag_conditional.metfrag_select=="yes" + --metfrag_result=$metfrag_result + #end if + + #if $sirius_csifingerid_conditional.sirius_csifingerid_select=="yes" + --sirius_csifingerid_result=$sirius_csifingerid_result + #end if + + #if $probmetab_conditional.probmetab_select=="yes" + --probmetab_result=$probmetab_result + #end if + #if $eic --eic #end if @@ -71,7 +84,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +