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
{{ message }}
Repository navigation
Default missing data character should not be "-" #1893
In #436 we update the haplotypes method to include support for missing data, and added the missing_data_char parameter. This defaults to a '"-"'. In retrospect I think this is an error and we should change it for 0.4.0.
The "-" character in an alignment is nearly always interpreted as a gap (see these FASTA format page or these nexus examples, i.e., indicating that there are some indels. This is not what we are indicating in the haplotypes. We are indicating the presence of missing data, i.e., that we don't know what the state of a particular site for a particular sample is. The most common convention for this seems to be using the "N" character.
The DNA alphabet in dendropy follows this convention, so unless there's a compelling reason not to I think we should change the default missing data character to "N".
@hyanwong, do you remember the original thinking for using "-" here rather than "N"? Any objections to us changing this?
@hyanwong, do you remember the original thinking for using "-" here rather than "N"? Any objections to us changing this?
The discussion is at #353 (comment) and my reply, which quotes the A2M version of FASTA. However, this was when positions were continuous, so "-" for a "special gap character", used for alignment, seemed like a reasonable choice. If we are enforcing integer positions, then I agree that N is also fine: I have no objections to changing it.
I presume that this distinction between "-" and "N" is highlighted by looking at flanking regions: there, it could be that a genome actually starts at position X, relative to the reference, so that the first X-1 characters are not applicable (and "-" should be inserted), or it could be that they are present by not known (in which case "N" should be inserted). I don't think we make this distinction in tskit.
There, gap literally means gap and not missing. Gaps are needed to align high quality indel events, whereas missing means you know a base is there but cannot confidently call it. The difference between the two is quite obvious when looking at Sanger traces, but less so in the "align to reference" world.
I see, thanks. So we were motivated mostly by trying to accommodate tree sequences with continuous coordinates, which makes sense when thinking about what was between sites. However, at a given site the gap character still wasn't the right choice to indicate missing data, so I think a full switch to "N" is the best thing to do now.
I see, thanks. So we were motivated mostly by trying to accommodate tree sequences with continuous coordinates, which makes sense when thinking about what was between sites. However, at a given site the gap character still wasn't the right choice to indicate missing data, so I think a full switch to "N" is the best thing to do now.
I think we can reasonable default to N but we should be aware that, especially in flanking regions, this may not be appropriate, and - might be more appropriate (e.g. coronavirus genomes). In other words, we shouldn't build in a dependency on N too heavily, as I could imagine it changing in certain circumstances in the future (also, of course, when we incorporate indels). I don't think that setting N as the default for the time being commits us to this indefinitely though, so I agree that a switch to N is reasonable, at least if ts.discrete_genome == True. There's an argument for retaining the character as - if ts.discrete_genome == False. I guess if the default is None, we can change the behaviour easily in the future anyway.
Activity
hyanwong commentedon Nov 6, 2021
The discussion is at #353 (comment) and my reply, which quotes the A2M version of FASTA. However, this was when positions were continuous, so "-" for a "special gap character", used for alignment, seemed like a reasonable choice. If we are enforcing integer positions, then I agree that
Nis also fine: I have no objections to changing it.I presume that this distinction between "-" and "N" is highlighted by looking at flanking regions: there, it could be that a genome actually starts at position X, relative to the reference, so that the first X-1 characters are not applicable (and "-" should be inserted), or it could be that they are present by not known (in which case "N" should be inserted). I don't think we make this distinction in tskit.
molpopgen commentedon Nov 6, 2021
There, gap literally means gap and not missing. Gaps are needed to align high quality indel events, whereas missing means you know a base is there but cannot confidently call it. The difference between the two is quite obvious when looking at Sanger traces, but less so in the "align to reference" world.
jeromekelleher commentedon Nov 7, 2021
I see, thanks. So we were motivated mostly by trying to accommodate tree sequences with continuous coordinates, which makes sense when thinking about what was between sites. However, at a given site the gap character still wasn't the right choice to indicate missing data, so I think a full switch to "N" is the best thing to do now.
Change default missing data char to "N"
hyanwong commentedon Nov 7, 2021
I think we can reasonable default to
Nbut we should be aware that, especially in flanking regions, this may not be appropriate, and-might be more appropriate (e.g. coronavirus genomes). In other words, we shouldn't build in a dependency onNtoo heavily, as I could imagine it changing in certain circumstances in the future (also, of course, when we incorporate indels). I don't think that settingNas the default for the time being commits us to this indefinitely though, so I agree that a switch toNis reasonable, at least ifts.discrete_genome == True. There's an argument for retaining the character as-ifts.discrete_genome == False. I guess if the default is None, we can change the behaviour easily in the future anyway.jeromekelleher commentedon Nov 8, 2021
Hmm, ok, I had actually just put "N" into the signature. I'll change it to None so these sort of are open to change in the future.
benjeffery commentedon Nov 8, 2021
FWIW I agree with changing this.
Change default missing data char to "N"
Refactor LD calculator
Change default missing data char to "N"