importGTF: Import a GTF File

Description Usage Arguments Details Value Author(s) Examples

View source: R/importGTF.R

Description

This function imports a gtf file.

Usage

1
2
3
4
importGTF(file, skip = "auto", nrow = -1, use.data.table = TRUE,
  level = "gene", features = NULL, num.features = c("FPKM", "TPM"),
  print.features = FALSE, merge.feature = NULL, merge.all = TRUE,
  class.names = NULL, verbose = TRUE)

Arguments

file

file or folder

skip

numeric, lines to skip

nrow

numeric, lines to read

use.data.table

logical

level

Character, read level, default: "gene"

features

features to import

num.features

names of the numeric features

print.features

Logical, print available features

merge.feature

Character, merge multiple samples to dataset

merge.all

Logial, shall all samples be merged

class.names

Vector with class names

verbose

Logical, verbose function output

Details

This function imports a gtf file. The features names to be imported are defined in features, several features are then provided as vector. A list of available feature can beprinted, by setting print.features=TRUE.

The skip option allows to skip a given number of rows, the default is, however, auto. In that case, all rows that start with the # symbol are skipped.

In case a set of expression values given in gtf format should be imported and to be merged into a single data table, the feature that should be used for merging can be provided to the merge.feature option. In that case the function expects a folder in file and it will import all gtfs located in that folder and merges them according to the merge.feature option. With the option class.names a vector of prefixes for the merged features can be provided. If this is kept empty, then the filenames of the gtf will be used instead (without gtf extension).

By default the function imprts all features in column 9 as string character. However, for common labels (FPKM and TPM) the class type is set automatically to numeric. Additional numerical feature names can be defined with the num.feature option.

Value

A gtf object

Author(s)

Daniel Fischer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
 # Define here the location on HDD for the example file
   fpath <- system.file("extdata","example.gtf", package="GenomicTools.fileHandler")
 # Same file, but this time as gzipped version
   fpath.gz <- system.file("extdata","example2.gtf.gz", package="GenomicTools.fileHandler")
   
 # Import the example gtf file  
   importGTF(fpath, level="transcript", features=c("gene_id","FPKM"))
   
 ## Not run: 
 # For the current you need to have zcat installed (should be standard on a Linux system)
   importGTF(fpath.gz, level="transcript", features=c("gene_id","FPKM"))
   
## End(Not run)
 

GenomicTools.fileHandler documentation built on March 26, 2020, 7:23 p.m.