Resize 5' and 3' ends of a transcript GenomicRanges

trimTranscripts(x, start = 0, end = 0)

Arguments

x

GRanges or GRangesList object containing exon coordinates for each transcript

start

Number of bases to trim from the start of transcript. Providing a negative value will extend the transcript instead. If `x` is a GRanges object, `start` is a single integer. If `x` is a GRangesList, `start` can be a single integer or a list of integers of the same length as `x`

end

Number of bases to trim from the end of transcript. Providing a negative value will extend the transcript instead. If `x` is a GRanges object, `end` is a single integer. If `x` is a GRangesList, `end` can be a single integer or a list of integers of the same length as `x`

Value

Trimmed GenomicRanges object

Author

Fursham Hamid

Examples

library(GenomicRanges)
gr1 <- GRanges(
  seqnames = "chr1", strand = c("+", "+", "+"),
  ranges = IRanges(
    start = c(1, 500, 1000),
    end = c(100, 600, 1100)
  )
)

trimTranscripts(gr1, 20, 80)
#> GRanges object with 3 ranges and 0 metadata columns:
#>       seqnames    ranges strand
#>          <Rle> <IRanges>  <Rle>
#>   [1]     chr1    21-100      +
#>   [2]     chr1   500-600      +
#>   [3]     chr1 1000-1020      +
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome; no seqlengths
trimTranscripts(gr1, 110, 150)
#> GRanges object with 1 range and 0 metadata columns:
#>       seqnames    ranges strand
#>          <Rle> <IRanges>  <Rle>
#>   [1]     chr1   510-551      +
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome; no seqlengths