prepareBamFiles:
Prepare bam files before parsing.
Description
Sort and index bam files, if necessary. Return the number of
aligned reads for each bam file.
Usage
prepareBamFiles( bamFiles, cores=1)
Arguments
bamFiles
Vector containing the list of every bam
filename to be included in the analysis.
cores
Number of cores used by the function.
Value
prepareBamFiles returns a data.frame with three
columns and as many rows as there are bam files in the
bamFiles argument. The data.frame has the
following columns:
* oldBam
* bam
* alignedCount
Details
This function will take a list of bam files and first check if
they are indexed. If this is not the case, it will call the
Rsamtools package to sort and index the files.
The names of the orginal bam files will be stored in the
oldBam column of the results and the sorted bam file
name will be stored in the bam column. If the files
already indexed, the names in both columns will be the same.
The aligned read counts are then calculated for each files and
added to the alignedCount column of the result.