R/exportFct_addPlotLinks_1DTPP.R

Defines functions exportFct_addPlotLinks_1DTPP

exportFct_addPlotLinks_1DTPP <- function(wb, sheet, dat){
  ## Add column with links to fitted curve plots
  ## to do: combine this function with 'exportFct_addPlotLinks_2DTPP'
  allCols <- colnames(dat)
  
  for (plotCol in c("splinefit_plot", "meltcurve_plot")){
    linkCol <- grepl(plotCol, allCols)
    if (any(linkCol)){
      relPaths <- as.character(dat[,linkCol])
      plotPaths <- relPaths
      plotPaths <- ifelse(is.na(plotPaths), "none", file.path(".", plotPaths))
      names(plotPaths) <- ifelse(plotPaths=="none", "", 
                                 gsub("([^[:alnum:]])", "_", dat$Protein_ID))
      class(plotPaths) <- "hyperlink"
      #plotPaths[plotPaths=="_"] <- NA
      suppressWarnings(writeData(wb, sheet=sheet, x=plotPaths, startCol=which(linkCol), 
                                 startRow = 2, keepNA = TRUE))
    }    
  }

  return(wb)
}

Try the TPP package in your browser

Any scripts or data that you put into this service are public.

TPP documentation built on Nov. 8, 2020, 5:55 p.m.