fastqToBAM: Convert FASTQ file(s) into a BAM file, by calling Bowtie2.

fastqToBAMR Documentation

Convert FASTQ file(s) into a BAM file, by calling Bowtie2.

Description

Call Bowtie2 to do an alignment of a file of FASTQ read data. Builds the full Unix command line needed to spawn a call to Bowtie, using all pertinent options file settings.

Usage

fastqToBAM(inputFastqFile, outputFile = sub("(fastq|fq|gz)$", "bam", inputFastqFile[1]), k = NULL, 
	sampleID = "", optionsFile = "Options.txt", noHitsFile = NULL, 
	alignIndex = getOptionValue(optionsFile, "GenomicIndex"), index.path = NULL, 
	alignPolicy = getOptionValue(optionsFile, "GenomicAlignmentPolicy", verbose = F), 
	maxReads = NULL, skipReads = NULL, asMatePairs = FALSE, keepUnaligned = TRUE, 
	wait = TRUE, verbose = FALSE, label = sampleID)

Arguments

inputFastqFile

character vector of explicit full path qualified FASTQ filenames.

outputFile

character string of the full path qualified name to give to the result BAM file that Bowtie will create.

k

the value for Bowtie argument '-k' that finds multiple alignments.

sampleID

the SampleID for this sample. This SampleID keys for a row of annotation details in the annotation file, for getting sample-specific details. The SampleID is also used as a sample-specific prefix for all files created during the processing of this sample.

optionsFile

the file of processing options, which specifies all processing parameters that are not sample specific. See DuffyNGS_Options.

noHitsFile

character string of the full path qualified name for the created FASTQ file of reads that fail to align. Default value is to not save the reads that didn't align.

alignIndex

character string of the base filename for the Bowtie index to align against.

index.path

character string of the full pathname to a directory of Bowtie indexes, where the above index is located.

alignPolicy

character string passed to Bowtie that gives the options to be used for alignment.

maxReads

maximum number of reads to have Bowtie align. See Bowtie option '–qupto'.

skipReads

number of reads to ignore at the beginning of the FASTQ file. See Bowtie option '–skip'.

asMatePairs

logical, controls how the vector of FASTQ files are interpreted, and selects paired end or unpaired Bowtie alignment mode.

keepUnaligned

logical, should unaligned reads be written to the results BAM file. See Bowtie option '–un'.

Details

This is the mid-level wrapper function that pulls the various DuffyNGS alignment settings from the options file, and constructs the correct Unix command line to invoke an explicit Bowtie alignment step. This wrapper is used inside all 3 top level alignment steps of ribo clearing, genomic, and splice junctions.

Value

Primarily, one new BAM file of alignments.

Also a list of diagnostic information about the alignment success:

RawReads

the number of raw reads in the FASTQ file submitted to Bowtie.

UniqueReads

the number of reads that aligned to exactly one location

MultiReads

the number of reads that aligned to two or more locations

NoHitReads

the number of reads that failed to align

Time

the time usage of this Bowtie alignment step, as from proc.time

Author(s)

Bob Morrison

See Also

pipe.RiboClear Ribo clearing against an index of unwanted transcripts. pipe.GenomicAlign Genomic alignment against an index of target genome(s). pipe.SpliceAlign Splice junction alignment against an index of standard and alternative splice junctions. buildBowtie2CommandLine for constructing the command. bowtie2Par about default Bowtie settings. callBowtie2 for the low-level call to Bowtie to do the alignments.


robertdouglasmorrison/DuffyNGS documentation built on March 24, 2024, 4:16 p.m.