inst/doc/RcwlPipelines.R

## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ---- eval=FALSE--------------------------------------------------------------
#  if (!requireNamespace("BiocManager", quietly = TRUE))
#      install.packages("BiocManager")
#  BiocManager::install("RcwlPipelines")

## ----getDevel, eval=FALSE-----------------------------------------------------
#  BiocManager::install("hubentu/RcwlPipelines")

## ----Load, message=FALSE------------------------------------------------------
library(RcwlPipelines)
library(dplyr)

## -----------------------------------------------------------------------------
tools <- cwlUpdate(cachePath = tempfile())
tools

## -----------------------------------------------------------------------------
tl <- cwlSearch(c("bwa", "mem"), tools)
data.frame(tl)

## -----------------------------------------------------------------------------
bwa <- cwlLoad(tl$rpath)
bwa

## -----------------------------------------------------------------------------
bwa <- cwlLoad(rname = 'tl_bwa', bfc = tools)

## -----------------------------------------------------------------------------
tls <- cwlSearch("bwa|sam2bam|sortBam|samtools_index|markdup", tools) %>%
    filter(Type == "tool") %>%
    select(rname, rpath, Command, Container)
tls

## -----------------------------------------------------------------------------
invisible(sapply(tls$rpath, cwlLoad))

## -----------------------------------------------------------------------------
p1 <- InputParam(id = "threads", type = "int")
p2 <- InputParam(id = "RG", type = "string")
p3 <- InputParam(id = "Ref", type = "string")
p4 <- InputParam(id = "FQ1", type = "File")
p5 <- InputParam(id = "FQ2", type = "File?")

## -----------------------------------------------------------------------------
## bwa
s1 <- Step(id = "bwa", run = bwa,
           In = list(threads = "threads",
                     RG = "RG",
                     Ref = "Ref",
                     FQ1 = "FQ1",
                     FQ2 = "FQ2"))
## sam to bam
s2 <- Step(id = "sam2bam", run = sam2bam,
           In = list(sam = "bwa/sam"))
## sort bam
s3 <- Step(id = "sortBam", run = sortBam,
           In = list(bam = "sam2bam/bam"))
## mark duplicates
s4 <- Step(id = "markdup", run = markdup,
           In = list(ibam = "sortBam/sbam",
                     obam = list(
                         valueFrom="$(inputs.ibam.nameroot).mdup.bam"),
                     matrix = list(
                         valueFrom="$(inputs.ibam.nameroot).markdup.txt")))
## index bam
s5 <- Step(id = "idxBam", run = samtools_index,
           In = list(bam = "markdup/mBam"))

## -----------------------------------------------------------------------------
req1 <- list(class = "StepInputExpressionRequirement")
req2 <- list(class = "InlineJavascriptRequirement")
## outputs
o1 <- OutputParam(id = "Bam", type = "File", outputSource = "markdup/mBam")
o2 <- OutputParam(id = "Idx", type = "File", outputSource = "idxBam/idx")
## stepParam
Align <- cwlStepParam(requirements = list(req1, req2),
                      inputs = InputParamList(p1, p2, p3, p4, p5),
                      outputs = OutputParamList(o1, o2))
## build pipeline
Align <- Align + s1 + s2 + s3 + s4 + s5

## -----------------------------------------------------------------------------
plotCWL(Align)

## -----------------------------------------------------------------------------
alignMerge <- cwlLoad(rname = "pl_alignMerge", bfc = tools)
inputs(alignMerge)

## -----------------------------------------------------------------------------
runs(runs(alignMerge)[[1]])

## -----------------------------------------------------------------------------
runs(runs(alignMerge)[[2]])

## -----------------------------------------------------------------------------
outputs(alignMerge)

## -----------------------------------------------------------------------------
ranseq_Sf <- cwlLoad(rname = "pl_rnaseq_Sf", bfc = tools)
inputs(rnaseq_Sf)

## -----------------------------------------------------------------------------
GPoN <- cwlLoad(rname = "pl_GPoN", bfc = tools)
Mutect2PL <- cwlLoad(rname = "pl_Mutect2PL", bfc = tools)

## -----------------------------------------------------------------------------
arguments(Mutect2) <- list("--max-mnp-distance", "0")
Mutect2

## -----------------------------------------------------------------------------
runs(GPoN)

## -----------------------------------------------------------------------------
plotCWL(Mutect2PL)

## -----------------------------------------------------------------------------
sessionInfo()

Try the RcwlPipelines package in your browser

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

RcwlPipelines documentation built on March 7, 2021, 2 a.m.