Learn R Programming

rphast (version 1.6.9)

fix.start.stop.feat: Fix start and stop signals

Description

Fix start and stop signals

Usage

fix.start.stop.feat(x)

Arguments

x

An object of type feat. CDS regions must be present with type "CDS", and the transcript_id must be indicated in the attribute field. Start and stop codons should have feature type "start_codon" and "stop_codon" (as produced by addSignals.feat).

Value

An object of type feat, in which CDS regions are ensured to include start codons and exclude stop codons, as required by the GTF2 standard.

Examples

Run this code
# NOT RUN {
exampleArchive <- system.file("extdata", "examples.zip", package="rphast")
featFile <- "gencode.ENr334.gp"
unzip(exampleArchive, featFile)
f <- read.feat(featFile)
f <- add.signals.feat(f)
# let's just look at one gene
geneNames <- tagval.feat(f, "transcript_id")
f <- f[geneNames==geneNames[1],]

# This features file already is correct, so let's mess it up to see
# how fix.start.stop can fix it:

#modify first CDS to not include start
startCodon <- f[f$feature=="start_codon",]
firstCds <- which(f$feature=="CDS" & f$start==startCodon$start)
f[firstCds,]$start <- startCodon$end+1
#modify last CDS to include stop
stopCodon <- f[f$feature=="stop_codon",]
lastCds <- which(f$feature=="CDS" & f$end+1==stopCodon$start)
f[lastCds,]$end <- stopCodon$end
# now call fix.start.stop to fix
f.fixed <- fix.start.stop.feat(f)

# first CDS has been fixed to include start codon
f[firstCds,]
f.fixed[firstCds,]
# last CDS has been fixed to not include stop codon
f[lastCds,]
f.fixed[lastCds,]

unlink(featFile)
# }

Run the code above in your browser using DataLab