Hello everyone,
I am using the GenomicRanges module in R to output the maximum and minimum of my genomic range object.
First, the GRanges object has been designed with a file columns. Note that metadata have been added to the object using "gc=".
> gr <- GRanges(seqnames=file$V1, > ranges=IRanges(start=as.numeric(file$V7), end=as.numeric(file$V8)), > gc=file$V2)
Unfortunately, using the range() function, the metadata column are lost.
gr_ran <- range(gr, ignore.strand = TRUE)
#> gr_ran
#GRanges object with 1024 ranges and 0 metadata columns:
# seqnames ranges strand
# <Rle> <IRanges> <Rle>
# [1] Scaffolds_0_pilon 327519-354933 *
# [2] Scaffolds_7_pilon 228693-230062 *
Would anyone know how to keep these metadata column?
Thank you very much for your answer benformatics. You have well understood my problem, and in my case the gc column is not numbers, so there is indeed no way to make a mean of it.