prepare_samples: Prepare samples

View source: R/prepare_samples.R

prepare_samplesR Documentation

Prepare samples

Description

Reads in the sample file names for the directory or directories. Ensures the files are in order, returns a dataframe with the paths to the raw reads files, the trimmed reads files and the sample names. Can take paired end or single end data. If there are duplicated sample names the files will be merged into a temporary directory. For scRNA samples, require paired end reads and do not require the trimmed reads directory. Call the function prepare_solo_samples.

Usage

prepare_samples(path = NULL, patt = NULL, trimmed.reads = NULL, merge = FALSE)

Arguments

path

List of full paths to directory or directories containing the raw reads data

patt

List of suffix patterns for the raw reads data for forward and (optionally) reverse reads

trimmed.reads

Name of the directory for the quality and adapter trimmed reads, optional

merge

Boolean for whether to merge samples, default set to FALSE

Value

Dataframe with sorted file paths and sample names

Examples

## Not run: 
# Paths to reads
reads.path <- c("/Path to reads 1",
                "/Path to reads 2")

# Standard suffixes for reads files for forward and reverse files
reads.patt.1 <- "_S\\d{1,2}\\_R1_001.fastq.gz|_S\\d{1,2}\\_L001_R1_001.fastq.gz"
reads.patt.2 <- "_S\\d{1,2}\\_R2_001.fastq.gz|_S\\d{1,2}\\_L001_R2_001.fastq.gz"

# Trimmed reads directory
trimmed.reads <- "trimmed_reads"

# Paired end data
sample.dataframe <- prepare_samples(reads.path, c(reads.patt.1,reads.patt.2),trimmed.reads)
mate1 <- as.character(sample.dataframe$reads.path.1)
mate1.trim <- as.character(sample.dataframe$trimmed.reads.path.1)
mate2 <- as.character(sample.dataframe$reads.path.2)
mate2.trim <- as.character(sample.dataframe$trimmed.reads.path.2)

# Single end data
sample.dataframe <- prepare_samples(reads.path, reads.patt.1,trimmed.reads)
mate1 <- as.character(sample.dataframe$reads.path.1)
mate1.trim <- as.character(sample.dataframe$trimmed.reads.path.1)

# Sample names
sample.names <- as.character(sample.dataframe$sample.names)

## End(Not run)


GrahamHamilton/pipelineTools documentation built on March 5, 2024, 12:23 p.m.