This function re-aligns ranges (typically regulatory elements) to a set of coordinates, either the TSS column or the TSS.fwd and TSS.rev columns. If none are found, the function assumes the ranges are promoters and that the end or the ranges are the TSSs.
alignToTSS(granges, upstream = 0, downstream = 1)
A stranded GRanges object with a TSS column or TSS.rev and TSS.fwd columns
How many bases upstream of the TSS should the GRanges object by extended by? [Default: 0]
How many bases downstream of the TSS should the GRanges object by extended by? [Default: 1]
GRanges aligned to the TSS column or to TSS.rev and TSS.fwd columns, and extended by upstream/downstream bp.
data(ce11_proms)
ce11_proms
#> GRanges object with 17458 ranges and 3 metadata columns:
#> seqnames ranges strand | TSS.fwd TSS.rev which.tissues
#> <Rle> <IRanges> <Rle> | <numeric> <numeric> <factor>
#> [1] chrI 11273-11423 + | 11294 11416 Intest.
#> [2] chrI 11273-11423 - | 11294 11416 Intest.
#> [3] chrI 26903-27053 - | 27038 26901 Ubiq.
#> [4] chrI 36019-36169 - | 36112 36028 Intest.
#> [5] chrI 42127-42277 - | 42216 42119 Soma
#> ... ... ... ... . ... ... ...
#> [17454] chrX 17670496-17670646 + | 17670678 17670478 Muscle
#> [17455] chrX 17684894-17685044 - | 17684919 17684932 Hypod.
#> [17456] chrX 17686030-17686180 - | 17686189 17686064 Unclassified
#> [17457] chrX 17694789-17694939 + | 17694962 17694934 Intest.
#> [17458] chrX 17711839-17711989 - | 17711974 17711854 Germline
#> -------
#> seqinfo: 6 sequences from an unspecified genome; no seqlengths
alignToTSS(ce11_proms)
#> GRanges object with 17458 ranges and 3 metadata columns:
#> seqnames ranges strand | TSS.fwd TSS.rev which.tissues
#> <Rle> <IRanges> <Rle> | <numeric> <numeric> <factor>
#> [1] chrI 11294 + | 11294 11416 Intest.
#> [2] chrI 11416 - | 11294 11416 Intest.
#> [3] chrI 26901 - | 27038 26901 Ubiq.
#> [4] chrI 36028 - | 36112 36028 Intest.
#> [5] chrI 42119 - | 42216 42119 Soma
#> ... ... ... ... . ... ... ...
#> [17454] chrX 17670678 + | 17670678 17670478 Muscle
#> [17455] chrX 17684932 - | 17684919 17684932 Hypod.
#> [17456] chrX 17686064 - | 17686189 17686064 Unclassified
#> [17457] chrX 17694962 + | 17694962 17694934 Intest.
#> [17458] chrX 17711854 - | 17711974 17711854 Germline
#> -------
#> seqinfo: 6 sequences from an unspecified genome; no seqlengths