Giter Club home page Giter Club logo

Comments (2)

ivan-aksamentov avatar ivan-aksamentov commented on September 25, 2024

@corneliusroemer It seems that these values are undefined, not empty strings.

Nextclade Web uses stable sort (order of equivalent entries is preserved) and empty (undefined) values are not sorted, because we don't know how (JS might have some weird behavior from when it was slapped together hastily in 1992, but the correct computer-sciency way to say is that empty values are not comparable to strings). I tried to model the behavior for the well-known tabular software, such as Excel.

Consider this:

  • you have fresh results from the Lapis link (perhaps fewer sequences, because 1000 is a bit too much to wait)
  • you can sort by "Clade" column and all "outgroup" items will go to the top or bottom
  • note that numbers in "i" column for "outgroup" entries have consecutive values - stable sort ensures that the order of values that all have equal "outgroup" clade is preserved the way it was before sort
  • then if you subsequently sort by "Unaliased", the empty cells will stay at the bottom (or top), because we don't sort undefined values

Stable sort tries to preserve the existing order as much as possible and this allows you to sort/group by multiple criteria, for example by "outgoup" or not "outgroup" and then by lineage. Or you can first sort by lineage and then sort by clade - each clade group will then have lineages sorted within the clade. You can also try more than 2 criteria.

The fact that all "outgroup" entries have no lineage helps in this particular case, but technically it is a random coincidence. So if you think that we need to sort empty values, then we need to specify how. For example, we may consider them empty strings and if we sort lexicographically, they will be considered "less than" any other non-empty string.

I can also try and write another algorithm, but you'd need to specify it a little better than "sort misbehaves".

from nextclade.

ivan-aksamentov avatar ivan-aksamentov commented on September 25, 2024

I implemented sorting of empty values as empty strings in
#1152

@corneliusroemer please give it a try and tell me if this is the behavior you expected initially.

from nextclade.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.