MaveDB: only keep the columns and records that can be used - #853
Conversation
parse_data built a hash keyed on every column in the data file for every record in a variant's span, regardless of what cols asked for, and kept records whose ref is a ga4gh:VA identifier rather than sequence - which get_matched_variant_alleles can never match. Both are unbounded by variant size but bounded by reference span, so a long deletion over a deep mutational scanning locus pays for them hundreds of thousands of times over: a 229 bp deletion in UBC peaks at 9.7 GB and produces no annotation. Keep only the columns parse_data needs - those in cols, plus MaveDB_hgvs and MaveDB_refseq where the option that reads them is enabled - and skip records that cannot match. Same deletion now peaks at 0.08 GB, matching a run with the plugin not loaded, with output unchanged. Ensembl#852
|
One clarification on the table in the description, since it invites the wrong conclusion: on that 229 bp Measured on VEP's own shipped test data ( Full numbers and a reproduction recipe: #852 (comment) |
ainefairbrother
left a comment
There was a problem hiding this comment.
Hi @davmlaw,
Thank you for this fix. I have tested it and see that, indeed, it does speed up the plugin.
|
Cool. It was mostly the RAM use for me (I'm running a few VEPs in parallel on a VM) but faster is good too. I think the Mave plugin was fine for the initial version of the data, but MAVE has grown a huge amount over the last few years (which is great!) just need a few adjustments to keep up |
Fixes the memory usage reported in #852, where a single 229 bp deletion makes the plugin allocate
9.7 GB
Two independent changes, both bounded by the variant's reference span rather than by anything the user
controls:
Keep only the columns
parse_dataneeds. It built%reskeyed on every column in the data file(259 in the current distribution) for every record in the span, and
_join_resultsnarrowed tocolsafterwards — so
colsnever reduced the memory._set_parsed_columns()works the wanted indexes outonce in
new(). It keepsMaveDB_hgvsandMaveDB_refseqbeyondcols, sincerun()reads thosedirectly, and only when the option that consults them is enabled.
Skip records that cannot match. Score sets mapped through VRS carry a
ga4gh:VA.<digest>inrefinstead of sequence — 77% of records in the current file.
get_matched_variant_allelescompares allelesas strings, so those can never match; they were parsed, hashed and held anyway.
On the 229 bp deletion from #852, against the current
MaveDB_variants.tsv.gz:0.08 GB is what the same run costs with the plugin not loaded at all.
Output is unchanged
Compared line by line against the current plugin, identical in every case:
t/testdata/cache(chr21, GRCh38) with the chr21 slice of the MaveDB file, over 352 variants fromt/testdata/input/test.vcfplus records inside the cache window — 2,112 MaveDB values from both,0.20 GB → 0.10 GB.
0.52 GB → 0.35 GB.
single_aminoacid_changes/transcript_match(0/0, 0/1, 1/0, 1/1), andcols=all.cols=allis the useful case: it makes the projection a no-op and exercises the recordskip on its own.
Targeting
mainper CONTRIBUTING.md.