Function to count reads mapping to user-provided regions.
run_featurecounts(featurecounts = "featureCounts", annotationFile = NULL, requireBothEndsMapped = TRUE, excludeChimeric = TRUE, pairedEnd = TRUE, fragmentLength = c(30, 800), countMultiMapping = FALSE, multiFeatureReads = FALSE, minQual = 0, stranded = 0, threads = NULL, ignoreDup = FALSE, outname = NULL, alignments = NULL, quiet = TRUE)
featurecounts | character string specifying path to featureCounts. [DEFAULT = "featurecounts"] |
---|---|
annotationFile | character string, specifying path to region file in SAF format. |
requireBothEndsMapped | logical, if TRUE, only fragments that have both ends successfully aligned will be considered for summarization. This option should be used together with pairedEnd = TRUE. [DEFAULT = TRUE] |
excludeChimeric | logical, if TRUE, the chimeric fragments (those fragments that have their two ends aligned to different chromosomes) will NOT be counted. This option should be used together with pairedEnd = TRUE. [DEFAULT = TRUE] |
pairedEnd | logical, if TRUE, fragments (or templates) will be counted instead of reads. This option is only applicable for paired-end reads. [DEFAULT = TRUE] |
fragmentLength | vector of two integers specifying the minimum and maximum fragment/template lengths. Must be used together with pairedEnd = TRUE. [DEFAULT = c(50, 600)]. |
countMultiMapping | logical, if TRUE then multi-mapping reads/fragments will be counted. [DEFAULT = FALSE] |
multiFeatureReads | logical, if TRUE then reads/fragments overlapping with more than one meta-feature/feature will be counted more than once. Note that when performing meta-feature level summarization, a read (or fragment) will still be counted once if it overlaps with multiple features within the same meta-feature (as long as it does not overlap with other metafeatures). [DEFAULT = FALSE] |
minQual | integer, the minimum mapping quality score a read must satisfy in order to be counted. For paired-end reads, at least one end should satisfy this criteria. [DEFAULT = 0] |
stranded | Indicate if strand-specific read counting should be performed. Acceptable values: 0 (unstranded), 1 (stranded) and 2 (reversely stranded). For paired-end reads, strand of the first read is taken as the strand of the whole fragment. [DEFAULT = 0] |
threads | an integer value indicating the number of workers to be used. If NULL then one less than the maximum number of cores will be used. [DEFAULT = NULL]. |
ignoreDup | logical, if TRUE then reads that were marked as duplicates will be ignored. In paired end data, the entire read pair will be ignored if at least one end is found to be a duplicate read. [DEFAULT = FALSE] |
outname | Character string. Name of the output file. The output file contains the number of reads assigned to each meta-feature or feature. |
alignments | character vector specifying path to alignment files. [DEFAULT = NULL] |
quiet | logical, if |
Tab-delimited file containing the number of reads assigned to each meta-feature or feature and a matrix with the same.
# NOT RUN { alignments <- list.files(path = "bam_files", pattern = "*.bam$") threads <- parallel::detectCores() - 1 counts <- count_reads(featurecounts = "featureCounts", threads = threads, alignments = alignments) # }