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
I have made good progress on implementing inference for truncated samples (where sequence to the left or right of a focal region is missing). But I now realise this is subtly different from cases where one or two genotypes are missing from the middle of an otherwise intact sequence - ping @awohns who is interested in this case.
More specifically, for a truncated sample (discussed in #153), I'm simply avoiding having to match leftwards and rightwards from the known sequence. That means there are no edges attaching the sample to the rest of the tree in this region, and the changes that @jeromekelleher made in tskit-dev/tskit#272 mean that this plays nicely, and haplotypes output from the inferred TS have missing values in the correct places, and we can round-trip data correctly.
In contrast, for value missing in the middle of a sequence, we might not want to delete edges: this could end up producing far more edges than necessary, and we might also want to take advantage of the fact that a single edge could span a missing value, as this may allow us to do imputation. So as pointed out by @petrelharp (tskit-dev/tskit#272 (comment)) we could deal with missing data the other way, by adding a "mutation" to the unknown value on the branch above this particular sample (or even on a shared branch, if two siblings both have an unknown value). Does this seem like a sensible approach, @jeromekelleher? It seems a bit odd to do things differently for missing data in the middle of a sample versus data missing from the flanking regions of a sequence, but perhaps that's the right thing to do.
It might be possible to add these mutations to "missing" using parsimony, or we could use some other algorithm to allocate them onto the tree.
Although most of the work to incorporate missing data has been done already, we still need to adjust the Li & Stephens algorithm to jump over missing values when matching in the middle of a sequence.
I keep flipping on this. Removing the edge above a sample for a short segment seems fine. But, keeping that edge and marking the genotype there as "missing" would make it easier to impute: the imputation method would just ignore the "missing data" genotype. Oh, and clusters of missing data genotypes in the tree might indicate a deletion, say.
Thanks @petrelharp - I would hope that clusters of missing data would have been coded up as an explicit deletion, but I guess some non-spotted ones might be picked up like this.
I'm reasonably convinced that I should code up small lengths of missing data in the middle of a sequence by placing a mutation to "missing" on a branch. I don't know if I should also switch to doing this at the edges of a sequence, however?
Note that as the missing region gets larger and larger (even in the middle of a sequence), it seems less justified to extend the edge over the missing region. But since there's no obvious cut-off to decide a region size which is appropriate for imputation vs simply deleting the edge, I'm more inclined to use the "mutation to missing" idea for any missing data in the middle of a known sequence.
I say we shouldn't bother round tripping in this case, but impute the missing data. We take the missing data into account in the ancestor generation algorithm and the LS copying process, and just fill in whatever we get. This iseems like the behaviour we'd want from tsinfer in the majority of cases. If we really insist on remembering that "this base was missing here for this sample" then we can delete the edges.
If you want to use tree sequences as a lossless compression technique, then I guess you might want to encode missingness? But in this case I'd be inclined to add missingness onto the TS afterwards (e.g. using parsimony).
If you want to use tree sequences as a lossless compression technique, then I guess you might want to encode missingness? But in this case I'd be inclined to add missingness onto the TS afterwards (e.g. using parsimony).
I'm not so bothered about losslessly encoding short tracts (i.e., one base) of missingness. We could easily end up in the scenario where the majority of our storage is "missing" mutations if we did this by default. For the first pass of dealing with this in tsinfer anyway I think we should impute. We can figure out if we need something else when we have experience of working with this.
Well, it seems like we both want to keep edges that span tracts of missing data, so that's enough for me to go on, thanks. We can sort out whether to add missingness to the TS later.
I think it's reasonable to truncate edges that cover missing data to the extreme left or right of a haplotype, though. It's easy to partially impute these by simply extending the edge, and it costs us nothing to encode missingness in this case.
Activity
hyanwong commentedon Aug 7, 2019
Although most of the work to incorporate missing data has been done already, we still need to adjust the Li & Stephens algorithm to jump over missing values when matching in the middle of a sequence.
petrelharp commentedon Aug 7, 2019
I keep flipping on this. Removing the edge above a sample for a short segment seems fine. But, keeping that edge and marking the genotype there as "missing" would make it easier to impute: the imputation method would just ignore the "missing data" genotype. Oh, and clusters of missing data genotypes in the tree might indicate a deletion, say.
hyanwong commentedon Aug 7, 2019
Thanks @petrelharp - I would hope that clusters of missing data would have been coded up as an explicit deletion, but I guess some non-spotted ones might be picked up like this.
I'm reasonably convinced that I should code up small lengths of missing data in the middle of a sequence by placing a mutation to "missing" on a branch. I don't know if I should also switch to doing this at the edges of a sequence, however?
Note that as the missing region gets larger and larger (even in the middle of a sequence), it seems less justified to extend the edge over the missing region. But since there's no obvious cut-off to decide a region size which is appropriate for imputation vs simply deleting the edge, I'm more inclined to use the "mutation to missing" idea for any missing data in the middle of a known sequence.
jeromekelleher commentedon Aug 7, 2019
I say we shouldn't bother round tripping in this case, but impute the missing data. We take the missing data into account in the ancestor generation algorithm and the LS copying process, and just fill in whatever we get. This iseems like the behaviour we'd want from tsinfer in the majority of cases. If we really insist on remembering that "this base was missing here for this sample" then we can delete the edges.
hyanwong commentedon Aug 7, 2019
If you want to use tree sequences as a lossless compression technique, then I guess you might want to encode missingness? But in this case I'd be inclined to add missingness onto the TS afterwards (e.g. using parsimony).
jeromekelleher commentedon Aug 7, 2019
I'm not so bothered about losslessly encoding short tracts (i.e., one base) of missingness. We could easily end up in the scenario where the majority of our storage is "missing" mutations if we did this by default. For the first pass of dealing with this in tsinfer anyway I think we should impute. We can figure out if we need something else when we have experience of working with this.
hyanwong commentedon Aug 8, 2019
Well, it seems like we both want to keep edges that span tracts of missing data, so that's enough for me to go on, thanks. We can sort out whether to add missingness to the TS later.
I think it's reasonable to truncate edges that cover missing data to the extreme left or right of a haplotype, though. It's easy to partially impute these by simply extending the edge, and it costs us nothing to encode missingness in this case.
hyanwong commentedon Nov 27, 2020
Closing this as the discussion is old, and the way forward is discussed in #224