Skip to content

Commit

Permalink
GNCList() constructor now propagates the metadata columns
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Apr 17, 2015
1 parent 3d65cbb commit 5c95a1b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions R/GNCList-class.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ setMethod("ranges", "GNCList", function(x, use.mcols=FALSE) ranges(granges(x)))
setMethod("strand", "GNCList", function(x) strand(granges(x)))
setMethod("seqinfo", "GNCList", function(x) seqinfo(granges(x)))

setAs("GNCList", "GRanges", function(from) granges(from))
setAs("GNCList", "GRanges", function(from) granges(from, use.mcols=TRUE))


### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand All @@ -64,13 +64,17 @@ GNCList <- function(x)
stop("'x' must be a GenomicRanges object")
if (!is(x, "GRanges"))
x <- as(x, "GRanges")
ans_mcols <- mcols(x)
mcols(x) <- NULL
x_groups <- .extract_groups_from_GenomicRanges(x)
x_ranges <- IRanges:::.shift_ranges_in_groups_to_first_circle(ranges(x),
x_groups, .get_circle_length(x))
ranges(x) <- x_ranges
x_nclists <- IRanges:::.nclists(x_ranges, x_groups)
new2("GNCList", nclists=x_nclists, granges=x, check=FALSE)
new2("GNCList", nclists=x_nclists,
granges=x,
elementMetadata=ans_mcols,
check=FALSE)
}

setAs("GenomicRanges", "GNCList", function(from) GNCList(from))
Expand Down

0 comments on commit 5c95a1b

Please sign in to comment.