align_target: Align microbiome reads to a set of reference libraries

Description Usage Arguments Value Examples

Description

This is the main animalcules target library mapping function, using Rsubread and multiple libraries. Aligns to each library separately, filters unmapped reads from each file, and then merges and sorts the .bam files from each library into one output file.

Usage

1
2
align_target(reads, libs,
  project_name = tools::file_path_sans_ext(reads), threads = 8)

Arguments

reads

Location to the .fastq file to align

libs

A list of Subread index headers for alignment

project_name

A name for the project, which names the output .bam file (e.g. project_name.bam). Defaults to the basename of the reads file.

threads

The number of threads for the Subread alignment. Defaults to 8

Value

This function writes to file a merged and sorted .bam file after aligning to all reference libraries given. The function also outputs the new .bam filename.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Get a reference genome library
download_refseq('viral', compress = FALSE)

## Make and align to a single a reference genome library
mk_subread_index('viral.fasta')
readPath <- system.file("extdata", "virus_example.fastq", package = "animalcules.preprocess")
viral_map <- align_target( readPath, "viral", "virus_example")
viral_map_sam <- Rsamtools::asSam(viral_map, overwrite=T)

## Make and align to a multiple reference genome libraries
mk_subread_index('viral.fasta', split=0.005)
targLibs <- c("viral_1", "viral_2")
readPath <- system.file("extdata", "virus_example.fastq", package = "animalcules.preprocess")
viral_map <- align_target( readPath, targLibs, "virus_example")

wevanjohnson/animalcules.preprocess documentation built on May 11, 2019, 8:26 p.m.