This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Any idea to efficiently trigger function call for list of S4 function with similar argument list in ChipSeq workflow?

Hi :

I've implement set of function for ChipSeq workflow (studying set of peak interval), where all functions tested with real data set efficiently. While I am brainstorming on efficiency of this pipeline with the helping of functional programming of R for the sake of easy to call each function one after another, while temp object must goes to garbage collector. However, each function has very similar argument list but behaved in different way and outputs are different as well. In this circumstances, what kind of optimizations are needed both calling functions with repeated argument list, and using the output the one function for next operation and trigger garbage collection mechanism in R ? What's the efficient strategy to easily call the functions with very similar argument list ? How can I make my workflow efficient, safer, elegant, and easy to use for users ? Can anyone motivate me how to achieve desired and efficient workflow ? Any idea is appreciated.

  • Note: This problem categorized as ChipSeq workflow, is part of Bioinformatic field, so I hope I could get help from experienced scholar among this community. Thanks in advance

Here is the workflow of my function list, I just presented skeleton of my functions with argument list and possible output:

func.1 <- function(indexList, objectList, type, ...) {
  # input param check
  if() {
    # code block
    return(indexList)
  } else {
    # code block
    return(initObj)
  }
}

#' @example
newIndexList <- func.1()
A_objectList <- func.1()

func.2 <- function(newIndexList, objectList, ...) {
  # code block
  return(val.table)
}

val.TB <- func.2()

func.3 <- function(newIndexList, objectList, val.TB, threshold, ...) {
  # input param check
  if() {
    # code block
    return(B_objectList)
  } else {
    # code block
    return(A_newObjectList)
  }
}

#' @example 
B_objectList <- func.3()
A_newObjectList <- func.3()

func.4 <- function(objList, objList, ...) {
  #merge object list
  return(mapply(c, objList, objList))
}

merged.objList <- func.4(A_objectList, A_newObjectList)

func.5 <- function(objectList, objectList, type) {
  # do anti_join
  if() {
    # code block
    return(objectList)
  } else {
    # code block
    return(anti_join(objectList, objectList))
  }
}

#' example
res.Func_5 <- func.5(B_objectList, merged.objList)

I believe I can use fancy feature of functional programming of R, to achieve better efficient workflow. How can I make this happen more efficiently with robust framework ? How to efficiently use functional call with very similar argument list ? How to trigger garbage collector of R to destroy used temp object in current session ? Any idea ?

r chip-seq next-gen functional-programming peak

0 answers

No answers yet.

Log in to answer this question.