% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/riboseq_features.R
\name{orfScore}
\alias{orfScore}
\title{Get ORFscore for a GRangesList of ORFs}
\usage{
orfScore(grl, RFP, is.sorted = FALSE)
}
\arguments{
\item{grl}{a \code{\link{GRangesList}} object with ORFs}

\item{RFP}{ribosomal footprints, given as Galignment object,
Granges or GRangesList}

\item{is.sorted}{logical (F), is grl sorted.}
}
\value{
a data.table with 4 columns, the orfscore (ORFScores) and score of
each of the 3 tiles (frame_zero_RP, frame_one_RP, frame_two_RP)
}
\description{
ORFscore tries to check whether the first frame of the 3 possible frames in
an ORF has more reads than second and third frame.
}
\details{
Pseudocode:
assume rff - is reads fraction in specific frame
\preformatted{ORFScore = log(rrf1 + rrf2 + rrf3)}
For all ORFs where rrf2 or rrf3 is bigger than rff1,
negate the resulting value.
\preformatted{ORFScore[rrf1Smaller] <- ORFScore[rrf1Smaller] * -1}

As result there is one value per ORF:
Positive values say that the first frame have the most reads,
negative values say that the first frame does not have the most reads.
NOTE: If reads are not of size 1, then a read from 1-4 on range of 1-4,
will get scores frame1 = 2, frame2 = 1, frame3 = 1. What could be logical
is that only the 5' end is important, so that only frame1 = 1,
to get this, you first resize reads to 5'end only.

NOTE: p shifting is not exact, so many ORFs will get a bad ORF score.
}
\examples{
ORF <- GRanges(seqnames = "1",
               ranges = IRanges(start = c(1, 10, 20), end = c(5, 15, 25)),
               strand = "+")
names(ORF) <- c("tx1", "tx1", "tx1")
grl <- GRangesList(tx1_1 = ORF)
RFP <- GRanges("1", IRanges(25, 25), "+") # 1 width position based
score(RFP) <- 28 # original width
orfScore(grl, RFP) # negative because more hits on frames 1,2 than 0.

# example with positive result, more hits on frame 0 (in frame of ORF)
RFP <- GRanges("1", IRanges(c(1, 1, 1, 25), width = 1), "+")
score(RFP) <- c(28, 29, 31, 28) # original width
orfScore(grl, RFP)

}
\references{
doi: 10.1002/embj.201488411
}
\seealso{
Other features: \code{\link{computeFeaturesCage}},
  \code{\link{computeFeatures}},
  \code{\link{disengagementScore}},
  \code{\link{distToCds}}, \code{\link{distToTSS}},
  \code{\link{entropy}}, \code{\link{floss}},
  \code{\link{fpkm_calc}}, \code{\link{fpkm}},
  \code{\link{fractionLength}},
  \code{\link{initiationScore}},
  \code{\link{insideOutsideORF}}, \code{\link{isInFrame}},
  \code{\link{isOverlapping}},
  \code{\link{kozakSequenceScore}},
  \code{\link{rankOrder}},
  \code{\link{ribosomeReleaseScore}},
  \code{\link{ribosomeStallingScore}},
  \code{\link{startRegionCoverage}},
  \code{\link{startRegion}}, \code{\link{subsetCoverage}},
  \code{\link{translationalEff}}
}
\concept{features}
