% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/txdbHelpers.R
\name{filterTranscripts}
\alias{filterTranscripts}
\title{Filter transcripts by lengths}
\usage{
filterTranscripts(txdb, minFiveUTR = 30L, minCDS = 150L,
  minThreeUTR = 30L, longestPerGene = TRUE, stopOnEmpty = TRUE)
}
\arguments{
\item{txdb}{a TxDb file, a path to one of:
(.gtf ,.gff, .gff2, .gff2, .db or .sqlite)
or an ORFik experiment}

\item{minFiveUTR}{(integer) minimum bp for 5' UTR during filtering for the
transcripts. Set to NULL if no 5' UTRs exists for annotation.}

\item{minCDS}{(integer) minimum bp for CDS during filtering for the
transcripts}

\item{minThreeUTR}{(integer) minimum bp for 3' UTR during filtering for the
transcripts. Set to NULL if no 3' UTRs exists for annotation.}

\item{longestPerGene}{logical (TRUE), return only longest valid transcript
per gene.}

\item{stopOnEmpty}{logical TRUE, stop if no valid transcripts are found ?}
}
\value{
a character vector of valid transcript names
}
\description{
Filter transcripts to those who have leaders, CDS, trailers of some lengths,
you can also pick the longest per gene.
}
\details{
If a transcript does not have a trailer, then the length is 0,
so they will be filtered out if you set minThreeUTR to 1.
So only transcripts with leaders, cds and trailers will be returned.
You can set the integer to 0, that will return all within that group.

If your annotation does not have leaders or trailers, set them to NULL.
}
\examples{
gtf_file <- system.file("extdata", "annotations.gtf", package = "ORFik")
txdb <- GenomicFeatures::makeTxDbFromGFF(gtf_file)
txNames <- filterTranscripts(txdb, minFiveUTR = 1, minCDS = 30,
                             minThreeUTR = 1)
loadRegion(txdb, "mrna")[txNames]
loadRegion(txdb, "5utr")[txNames]

}
