Getting Started in R

Use this guide for integrating with R in R Studio, an R script, or however you run R.

Let's get started!

Configuration

First, import Toolchest and set your key:

library(toolchest)
toolchest$set_key("YOUR_TOOLCHEST_KEY")
import toolchest_client as toolchest
toolchest.set_key("YOUR_TOOLCHEST_KEY")

Demo Data

To use Toolchest, we'll need input files.

If you don't have anything on hand, you can download our example.fastq file (~50MB).

Using Tools

You probably run computational biology software on the command line like this:

$ kraken2 --db ./langmead_lab_standard/ --threads 8 --minimum-base-quality 25 --report ./kraken2_output/kraken2_report.txt example.fastq 1> ./kraken2_output/kraken2_output.txt

With Toolchest, the above translates to:

toolchest$kraken2(
    inputs = "./example.fastq",
    output_path = "./kraken2_output/",
    tool_args = "--minimum-base-quality 25"
)
toolchest.kraken2(
    inputs="./example.fastq",
    output_path="./kraken2_output/",
    tool_args="--minimum-base-quality 25",
)

Where:

  • inputs is a string or list with your input files
  • output_path is a string with the output directory (or file)
  • tool_args is a string containing all the custom arguments you'd usually pass on the command line

We take care of translating the command line arguments for input, output, and infrastructure configuration. That means you don't need to set --threads, --report, or --db.

Databases are hosted on Toolchest infrastructure. You can choose a specific database by setting database_name and database_version.

toolchest$kraken2(
    inputs = "./SRR16201572_R1.fastq",
    output_path = "./kraken2_output/",
    tool_args = "--minimum-base-quality 25",
    database_name = "standard",
    database_version = "1",
)
toolchest.kraken2(
    inputs="./example.fastq",
    output_path="./kraken2_output/",
    tool_args="--minimum-base-quality 25",
    database_name="standard",
    database_version="1",
)

Did this page help you?