You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Say, @jeromekelleher - is this currently do-able? Recall that SLiM includes the reference sequence in the kastore, which we then read in afterwards using kastore. But looking at the kastore documentation, I'm not seeing a non-ugly way to add something to the store? It looks like I could (a) dump the tree seequence (b) load it back with kastore (c) convert the store to a dictionary (d) add the reference sequence, and (e) dump it again with kastore, but this seems not so good.
Ah, so the issue is that there's some extra stuff in the kastore output by SLiM that isn't preserved when we load/modify/dump through pyslim? I think it's probably best to resolve that generally by looking at any keys in the loaded store and add them to the output one. The load/convert/add/dump stuff isn't very elegant, but should be pretty efficient as the arrays won't be copied. A kastore file can't be updated in place by design, so that's what you'd end up doing anyway.
You could use the same temporary file, if you like, I've just got used to doing things with temporary directories because it makes life easier on windows.
I think this does what I want here - I know exactly what the extra key is, so don't need to be so general about it. Could you let me know if this looks reasonable?
Activity
petrelharp commentedon May 31, 2020
Say, @jeromekelleher - is this currently do-able? Recall that SLiM includes the reference sequence in the kastore, which we then read in afterwards using kastore. But looking at the kastore documentation, I'm not seeing a non-ugly way to add something to the store? It looks like I could (a) dump the tree seequence (b) load it back with kastore (c) convert the store to a dictionary (d) add the reference sequence, and (e) dump it again with kastore, but this seems not so good.
jeromekelleher commentedon Jun 1, 2020
Ah, so the issue is that there's some extra stuff in the kastore output by SLiM that isn't preserved when we load/modify/dump through pyslim? I think it's probably best to resolve that generally by looking at any keys in the loaded store and add them to the output one. The load/convert/add/dump stuff isn't very elegant, but should be pretty efficient as the arrays won't be copied. A kastore file can't be updated in place by design, so that's what you'd end up doing anyway.
petrelharp commentedon Jun 1, 2020
yes - the reference sequence.
How do you do this?
jeromekelleher commentedon Jun 1, 2020
the conversion to dict will be very cheap.
petrelharp commentedon Jun 1, 2020
Great, thanks. And, how should
new_storebe initialized?new_store = {}? (Perhaps I should write up an example for the kastore docs.)jeromekelleher commentedon Jun 1, 2020
Here's what I'm imagining:
It's a bit awkward because we have to use the temp files, but it'll work.
jeromekelleher commentedon Jun 1, 2020
You could use the same temporary file, if you like, I've just got used to doing things with temporary directories because it makes life easier on windows.
dump reference sequence; closes tskit-dev#84
petrelharp commentedon Jun 1, 2020
I think this does what I want here - I know exactly what the extra key is, so don't need to be so general about it. Could you let me know if this looks reasonable?
jeromekelleher commentedon Jun 1, 2020
Yep, that'll do the trick.
dump reference sequence; closes tskit-dev#84
switched over to new methods