Skip to contents

Read the *.cntTable files produced by TEtranscripts, TEcount or TElocal into an edgeR::DGEList. The tool that produced the files is detected from the format of the TE feature IDs. Information encoded in the feature IDs is always added to the genes slot, and gene and TE annotations can optionally be added from the same annotation files used to run TEtranscripts/TElocal (--GTF and --TE).

Usage

TEtranscripts2DGEList(
  files,
  gene_gtf = NULL,
  te_gtf = NULL,
  type = c("auto", "TEtranscripts", "TElocal"),
  drop_zero = TRUE,
  ...
)

Arguments

files

Character vector of paths to .cntTable files. Sample names are taken from names(files) if present, otherwise from the file names with the .cntTable extension removed.

gene_gtf

NULL (default) or the path to the gene GTF used to generate the counts (the --GTF argument).

te_gtf

NULL (default) or the path to TE annotation (the --TE argument). For TEtranscripts this is the TE GTF. For TElocal this is the locations table matching the .locInd index, which gives per-locus coordinates; a TE GTF is also accepted. The file type is detected from its content.

type

One of "auto" (default), "TEtranscripts" or "TElocal". "auto" detects the type from the TE feature IDs.

drop_zero

Logical. Remove features with zero counts in all samples? Default FALSE.

...

Additional arguments passed to edgeR::DGEList(), e.g. group.

Value

A DGEList with one row per feature and one column per file. The samples slot gains a bam column with the BAM file named in each table's header.

Details

TEtranscripts/TEcount report TE counts per subfamily with IDs of the form subfamily:family:class (e.g. AluY:Alu:SINE). TElocal reports counts per TE locus with IDs of the form locus:subfamily:family:class (e.g. AluY_dup12:AluY:Alu:SINE). Gene IDs (quoted in the raw tables) are returned without quotes.

The genes slot always contains the columns feature_id, feature_type ("gene" or "TE"), te_locus (TElocal only), te_subfamily, te_family and te_class. Additional columns are added when annotation files are supplied:

  • gene_gtf: gene_name, gene_type (or gene_biotype), seqnames, start, end and strand for gene features, taken from the "gene" rows of the GTF.

  • te_gtf as a TElocal locations table (*.locInd.locations): seqnames, start, end and strand for each TE locus, reported as given in the file.

  • te_gtf as a TE GTF (e.g. GRCh38_GENCODE_rmsk_TE.gtf): te_n_loci, the number of genomic copies of the subfamily, and te_total_width, their summed width in bp. These are summarized per subfamily:family:class, so for TElocal data they describe the subfamily of each locus.

Features absent from an annotation file are left as NA and the number of unmatched features is reported with a message.

TElocal tables contain several million mostly zero-count features. Setting drop_zero = TRUE removes features with zero counts in every sample before the annotation is added, which greatly reduces memory use. Library sizes are unaffected. Reading a full GENCODE GTF can take about a minute. Annotation files may be gzip-compressed.

Examples

if (FALSE) { # \dontrun{
count_files <- list.files(
  path = "/path/to/TEtranscripts_out",
  pattern = "*.cntTable",
  recursive  = TRUE,
  full.names = TRUE
)

y <-  TEtranscripts2DGEList(
  count_files,
  gene_gtf = "gencode.v48.basic.annotation.gtf",
  te_gtf = "GRCh38_GENCODE_rmsk_TE.gtf.gz",
  type = "TEtranscripts"
)

} # }