I have two Granges objects and I would like them to be merge in order to combine both GRanges even if the metadata are not existing in both objects.
> t
GRanges object with 2 ranges and 5 metadata columns:
seqnames ranges strand | pvalue qvalue meth.diff gc.X gc.score
<Rle> <IRanges> <Rle> | <numeric> <numeric> <numeric> <GRanges> <numeric>
[1] MT [ 708, 708] + | 2.898639e-04 0.007018699 0.2231039 MT:706-710 80
[2] MT [1147, 1147] - | 6.043240e-05 0.003882324 0.2243177 MT:1146-1150 80
-------
seqinfo: 1 sequence from an unspecified genome; no seqlengths
> s
GRanges object with 1 range and 6 metadata columns:
seqnames ranges strand | pvalue qvalue meth.diff gc.X gc.name gc.score
<Rle> <IRanges> <Rle> | <numeric> <numeric> <numeric> <GRanges> <character> <numeric>
[1] MT [708, 708] + | 0.0002898639 0.007018699 0.2231039 MT:708:+ rs28412942 0
-------
seqinfo: 1 sequence from an unspecified genome; no seqlengths
I would like to have at the end :
> combined
GRanges object with 2 ranges and 5 metadata columns:
seqnames ranges strand | pvalue qvalue meth.diff gc.X gc.score gc.name
<Rle> <IRanges> <Rle> | <numeric> <numeric> <numeric> <GRanges> <numeric>
[1] MT [ 708, 708] + | 2.898639e-04 0.007018699 0.2231039 MT:706-710 80 rs28412942
[2] MT [1147, 1147] - | 6.043240e-05 0.003882324 0.2243177 MT:1146-1150 80 NA
-------
seqinfo: 1 sequence from an unspecified genome; no seqlengths
All the methods I tried ask to have the same number of columns. I can try to create the needed columns and fill with NA, but it seems to me a bit of an overkill, I'm sure a method exists, but I can't find it :/
Thanks !
This is easy to do using
findOverlapsSample data