comparison R/ltr_utils.R @ 10:a004cd05177d draft

"planemo upload commit ca5a8b9bbf761419a408bce11a17e880d1b1152c"
author petr-novak
date Wed, 13 Jul 2022 10:59:58 +0000
parents 1aa578e6c8b3
children ff01d4263391
comparison
equal deleted inserted replaced
9:1aa578e6c8b3 10:a004cd05177d
1 add_coordinates_of_closest_neighbor <- function(gff) { 1 add_coordinates_of_closest_neighbor <- function(gff) {
2 gff <- gff[order(seqnames(gff), start(gff))] 2 gff <- gff[order(seqnames(gff), as.vector(start(gff)))]
3 # split to chromosomes: 3 # split to chromosomes:
4 gff_parts <- split(gff, seqnames(gff)) 4 gff_parts <- split(gff, seqnames(gff))
5 upstreams <- c(sapply(gff_parts, function(x) c(1, head(end(x), -1)))) 5 upstreams <- c(sapply(gff_parts, function(x) c(1, head(end(x), -1))))
6 downstreams <- c(sapply(gff_parts, function(x) c(start(x)[-1], seqlengths(x)[runValue(seqnames(x[1]))]))) 6 downstreams <- c(sapply(gff_parts, function(x) c(start(x)[-1], seqlengths(x)[runValue(seqnames(x[1]))])))
7 gff_updated <- unlist(gff_parts) 7 gff_updated <- unlist(gff_parts)