mk_bowtie_index: Make a Bowtie2 index

View source: R/mk_bowtie_index.R

mk_bowtie_indexR Documentation

Make a Bowtie2 index

Description

This function is a wrapper for the Rbowtie2::bowtie2_build function. It will create either small (.bt2) or large Bowtie2 indexes (.bt2l) depending on the combined size of the reference fasta files.

Usage

mk_bowtie_index(
  ref_dir,
  lib_dir,
  lib_name,
  bowtie2_build_options,
  threads = 8,
  overwrite = FALSE
)

Arguments

ref_dir

The path to the directory that contains the reference files either uncompressed or compressed (.gz). NOTE: This directory should contain only the reference fasta files to be indexed.

lib_dir

The path to the directory where the Bowtie2 index files should be created.

lib_name

The basename of the index file to be created (without the .bt2 or .bt2l extension)

bowtie2_build_options

Optional: Options that can be passed to the mk_bowtie_index() function. All options should be passed as one string. To see all the available options that can be passed to the function use Rbowtie2::bowtie2_build_usage(). NOTE: Do not specify threads here.

threads

The number of threads available to the function. Default is 8 threads.

overwrite

Whether existing files should be overwritten. Default is FALSE.

Value

Creates the Bowtie2 indexes of the supplied reference .fasta files. Returns the path to the directory containing these files.

Examples

#### Create a bowtie index from the example reference library

## Create a temporary directory to store the reference library
ref_temp <- tempfile()
dir.create(ref_temp)

## Create object with path to the example reference library
refPath <- system.file("extdata","target.fasta", package = "MetaScope")

## Copy the example reference library to the temporary directory
file.copy(from = refPath, to = file.path(ref_temp, "target.fasta"))

## Create the reference library index files in the current directory
mk_bowtie_index(ref_dir = ref_temp, lib_dir = ".", lib_name = "target",
threads = 4, overwrite=FALSE)

compbiomed/MetaScope documentation built on Aug. 9, 2022, 10:41 a.m.