Replies: 3 comments
-
I don't think there's an easy answer. Basically we want a per table C level function like keep_rows that takes an array of row ids (of any length, allowing duplicates etc), and does the low level stuff to update the table in place. |
Beta Was this translation helpful? Give feedback.
-
Thanks Jerome. On a similar note, I'm not sure there's a way to get the raw bytes out of the metadata field for each row, so that we can bung them back in using packset_metadata without having to go through the validation etc step (assuming we aren;'t actually altering the metadata, so it doesn't need revalidation / encoding. That might be a useful function to have. It would help if (as is common) we want to change just one row of the metadata: we can pass the raw metadata back in to the unaltered rows, and just decode/validate/re-encode the one which we are altering. |
Beta Was this translation helpful? Give feedback.
-
I think this might work for simple reordering (untested). I'm not sure how efficient it is to call
Since many rows might have empty metadata, I wonder if it's worth omitting empty rows inside the list comprehension:
|
Beta Was this translation helpful? Give feedback.
-
I'm wanting to reorder the node table, duplicating some nodes. This is easy for non-ragged columns:
But it's less obvious how to reorder the metadata, especially if I don't want to go through the hassle of decoding it etc. Has anyone got a routine to cut up and reorder the bytes of the metadata array given a reordering of the metadata_offset values? The discussion in https://tskit.dev/tutorials/tables_and_editing.html#minor-edits parses it and repacks with packset_metadata, but there should be a more efficient bytewise way, right?
Beta Was this translation helpful? Give feedback.
All reactions