Learn R Programming

micropan (version 1.2)

readGFF: Reading and writing GFF-tables

Description

Reading or writing a gff.table from/to file.

Usage

readGFF(in.file)
writeGFF(gff.table, out.file)

Arguments

in.file

Name of file with a GFF-table.

gff.table

A gff.table (data.frame) with genomic features information.

out.file

Name of file.

Value

readGFF returns a gff.table with the columns described above.

writeGFF writes the supplied gff.table to a text-file.

Details

A gff.table is simply a data.frame with columns adhering to the format specified by the GFF3 format, see https://github.com/The-Sequence-Ontology/Specifications/blob/master/gff3.md for details. There is one row for each feature.

The following columns should always be in a full gff.table of the GFF3 format:

  • Seqid. A unique identifier of the genomic sequence on which the feature resides.

  • Source. A description of the procedure that generated the feature, e.g. "R-package micropan::findOrfs".

  • Type The type of feature, e.g. "ORF", "16S" etc.

  • Start. The leftmost coordinate. This is the start if the feature is on the Sense strand, but the end if it is on the Antisense strand.

  • End. The rightmost coordinate. This is the end if the feature is on the Sense strand, but the start if it is on the Antisense strand.

  • Score. A numeric score (E-value, P-value) from the Source.

  • Strand. A "+" indicates Sense strand, a "-" Antisense.

  • Phase. Only relevant for coding genes. the values 0, 1 or 2 indicates the reading frame, i.e. the number of bases to offset the Start in order to be in the reading frame.

  • Attributes. A single string with semicolon-separated tokens prociding additional information.

Missing values are described by "." in the GFF3 format. This is also done here, except for the numerical columns Start, End, Score and Phase. Here NA is used, but this is replaced by "." when writing to file.

See Also

findOrfs, lorfs.

Examples

Run this code
# NOT RUN {
# Using a GFF file in this package
xpth <- file.path(path.package("micropan"),"extdata")
gff.file <- file.path(xpth,"Example.gff.xz")

# We need to uncompress it first...
tf <- tempfile(fileext=".xz")
s <- file.copy(gff.file,tf)
tf <- xzuncompress(tf)

# Reading, finding signature, and writing...
gff.table <- readGFF(tf)
print(gffSignature(gff.table))
out.tf <- tempfile(fileext=".gff")
writeGFF(gff.table[1:3,], out.tf)

# ...and cleaning...
s <- file.remove(tf,out.tf)

# }

Run the code above in your browser using DataLab