filter_samples: Filter Filtered Samples by Mapping File

Description Usage Arguments Details Value Examples

Description

Based on a filter criteria defined by the elements in the mapping file, this function will filter the mapping file and the associated list of sample paths.

Usage

1
filter_samples(map_file, filter, id_col_name, samples)

Arguments

map_file

a mapping phyloseq object

filter

a character string with query to filter

id_col_name

a character string containing the ID column name in the mapping file

samples

a character vector

Details

This function filters out samples in the mapping file based on some filter or metric (e.g. certain barcode sequence or group phenotype). It then gets the subset of samples from the list of sample paths and makes the list consistent with the mapping file filter.

Value

list two attributes filtFs are paths to forward filtered sequences and filtRs are paths to reverse filtered sequences

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
example_forward <- c("lane1-s216-index-GTTTCTGCT-s216_L001_R1_001.fastq.gz",
                     "lane1-s217-index-CACGATGGA-s217_L001_R1_001.fastq.gz")
example_reverse <- c("lane1-s216-index-GTTTCTGCT-s216_L001_R2_001.fastq.gz",
                     "lane1-s217-index-CACGATGGA-s217_L001_R2_001.fastq.gz")
sample_names <- c("lane1-s216-index-CACGATGGA-s216",
                  "lane1-s217-index-CACGATGGA-s217")
samples <- list(forward = example_forward,
                reverse = example_reverse,
                samples= sample_names)
mapping <- data.frame(X.SampleID = c("s216"),
                      BarcodeSequence = c("AGTGATGC"),
                      Description = "Wanted sample")
filter_samples(map_file = mapping,
               filter = "BarcodeSequence == 'AGTGATGC'",
               id_col_name = "X.SampleID",
               samples = samples)

erictleung/dada2HPCPipe documentation built on May 10, 2019, 1:19 p.m.