Import TEtranscripts or TElocal Count Tables into a DGEList
Source:R/te-to-dgelist.R
TEtranscripts2DGEList.RdRead 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
.cntTablefiles. Sample names are taken fromnames(files)if present, otherwise from the file names with the.cntTableextension removed.- gene_gtf
NULL(default) or the path to the gene GTF used to generate the counts (the--GTFargument).- te_gtf
NULL(default) or the path to TE annotation (the--TEargument). For TEtranscripts this is the TE GTF. For TElocal this is the locations table matching the.locIndindex, 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(orgene_biotype),seqnames,start,endandstrandfor gene features, taken from the "gene" rows of the GTF.te_gtfas a TElocal locations table (*.locInd.locations):seqnames,start,endandstrandfor each TE locus, reported as given in the file.te_gtfas a TE GTF (e.g.GRCh38_GENCODE_rmsk_TE.gtf):te_n_loci, the number of genomic copies of the subfamily, andte_total_width, their summed width in bp. These are summarized persubfamily: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"
)
} # }