run_htseq_count: Run HtSeq-Count

View source: R/run_htseq_count.R

run_htseq_countR Documentation

Run HtSeq-Count

Description

Runs the htseq-count program

Usage

run_htseq_count(
  input = NULL,
  output = NULL,
  mode = NULL,
  type = NULL,
  attribute = NULL,
  format = NULL,
  gtf = NULL,
  parallel = FALSE,
  cores = 4,
  execute = TRUE,
  htseq_count = NULL,
  version = FALSE
)

Arguments

input

List of aligned files in sam or bam format, required

output

List of file names for output,

mode

Mode to handle reads overlapping more than one feature (choices: union, intersection-strict, intersection- nonempty; default: union)

type

Feature type (3rd column in GTF file) to be used,

attribute

GTF attribute to be used as feature ID,

format

Type of <alignment_file> data, can be either sam, bam or auto

gtf

Path to the GTF file

parallel

Run in parallel, default set to FALSE

cores

Number of cores/threads to use for parallel processing, default set to 4

execute

Whether to execute the commands or not, default set to TRUE

htseq_count

Path to the htseq-count program program, required

version

Returns the version number

Value

A list with the htseq_count commands

Examples

## Not run: 
path <- "/home/gmh5n/.local/bin/htseq-count"

# Version
run_htseq_count(htseq_count = path,
                version = TRUE)

hisat2.alignments.dir <- "/path/to/hisat/alignments/directory"
bam.files <- list.files(path = hisat2.alignments.dir,
                       pattern = "sorted.bam$",
                       full.names = TRUE,
                       recursive = TRUE)
counts.dir <- "counts_dir"
htseq.counts.files <- paste(counts.dir,
                            paste(list.files(path = hisat2.alignments.dir,recursive = FALSE),
                            "counts.txt",sep = "_"),
                            sep = "/")

# Path to the gtf file
gtf.file <- "/path/to/gtffile"

htseq.counts.cmds <- run_htseq_count(input = bam.files,
                                     output = htseq.counts.files,
                                     mode = "intersection-nonempty",
                                     type = "gene",
                                     attribute = "ID",
                                     format = "bam",
                                     gtf = gtf.file,
                                     htseq_count = path)
htseq.counts.cmds

## End(Not run)

GrahamHamilton/pipelineTools documentation built on Dec. 8, 2024, 3:53 p.m.