[VariantAnnotation] Preserve query metadata with locateVariants()
1
0
Entering edit mode
enricoferrero ▴ 660
@enricoferrero-6037
Last seen 3.1 years ago
Switzerland

Is there any way to preserve the metadata in the query GRanges object when using locateVariants(query, subject, AllVariants()) from VariantAnnotation?

Or is it possible to add the query metadata to the resulting GRanges?

When calculating overlaps between two GRanges object I usually use findOverlaps() so that I can easily access and combine the metadata for both objects, but I don't understand how to achieve the same goal when using locateVariants().

From the documentation:

query: A Ranges, GRanges or VCF object containing the variants. Metadata columns are allowed but ignored.
[...]
asHits: A logical indicating if the results should be returned as a Hits object. Not applicable when region is AllVariants or IntergenicVariants.

Thanks!

 

variantannotation locatevariants metadata mcols • 1.7k views
ADD COMMENT
2
Entering edit mode
@valerie-obenchain-4275
Last seen 2.9 years ago
United States

Hi,

The result of locateVariants() is a "reped out" GRanges; one row for each variant-transcript match. To add the query metadata to the result you could rep out the metadata in the query using the 'QUERYID' column from the result. From the man page,

     ‘QUERYID’ The ‘QUERYID’ column provides a map back to the row in
          the original ‘query’. If the ‘query’ was a ‘VCF’ object this
          index corresponds to the row in the ‘GRanges’ object returned
          by the ‘rowRanges’ accessor.

In other words, subset the query metadata with the 'QUERYID' column. Once you have that, add it to the result with `mcols() <-`.

Valerie

 

ADD COMMENT
0
Entering edit mode

Thanks Valerie, it works perfectly - not sure how I missed that column in the results object!

ADD REPLY

Login before adding your answer.

Traffic: 609 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6