Skip to content

Default missing data character should not be "-" #1893

Closed

Description

@jeromekelleher

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?

Activity

  1. added
    bug
    on Nov 6, 2021
  2. added this to the Python 0.4.0 milestone on Nov 6, 2021
  3. hyanwong commented on Nov 6, 2021

    @hyanwong
    Member

    @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.

  4. molpopgen commented on Nov 6, 2021

    @molpopgen
    Member

    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.

  5. jeromekelleher commented on Nov 7, 2021

    @jeromekelleher
    MemberAuthor

    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.

  6. added a commit that references this issue on Nov 7, 2021
    63a77f7
  7. hyanwong commented on Nov 7, 2021

    @hyanwong
    Member

    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.

  8. jeromekelleher commented on Nov 8, 2021

    @jeromekelleher
    MemberAuthor

    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.

  9. benjeffery commented on Nov 8, 2021

    @benjeffery
    Member

    FWIW I agree with changing this.

  10. added 3 commits that reference this issue on Nov 8, 2021
    752fd12
    bebff92
    791ad0c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions