Skip to content

Commit

Permalink
fix: 4C with multiple loci in viewpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
js2264 committed Nov 16, 2023
1 parent 1e6e8cb commit 84ae4db
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions R/4C.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,19 @@ virtual4C <- function(x, viewpoint, use.scores = 'balanced') {
else {
score <- cm[, regions_in_viewpoint]
}
GenomicRanges::GRanges(
gr <- GenomicRanges::GRanges(
seqnames = as.vector(GenomicRanges::seqnames(regions)),
IRanges::IRanges(
GenomicRanges::start(regions),
GenomicRanges::end(regions)
),
score = score,
viewpoint = as.character(viewpoint),
center = GenomicRanges::start(regions) +
(GenomicRanges::end(regions) - GenomicRanges::start(regions))/2,
in_viewpoint = regions_in_viewpoint
)
if (length(as.character(viewpoint)) == 1) {
gr$viewpoint <- as.character(viewpoint)
}
return(gr)
}

0 comments on commit 84ae4db

Please sign in to comment.