importGTF {GenomicTools.fileHandler}R Documentation

Import a GTF File

Description

This function imports a gtf file.

Usage

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


 # 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)
 

[Package GenomicTools.fileHandler version 0.1.5.9 Index]