Skip to main content

nexusmaker - Nexus file maker for language phylogenies

Project description

NexusMaker

Simply Generate Nexus Files

from nexusmaker import NexusMaker, Record


data = [
    Record(Language="A", Parameter="eye", Item="", Cognacy="1"),
    Record(Language="A", Parameter="leg", Item="", Cognacy="1"),
    Record(Language="A", Parameter="arm", Item="", Cognacy="1"),
    
    Record(Language="B", Parameter="eye", Item="", Cognacy="1"),
    Record(Language="B", Parameter="leg", Item="", Cognacy="2"),
    Record(Language="B", Parameter="arm", Item="", Cognacy="2"),
    
    Record(Language="C", Parameter="eye", Item="", Cognacy="1"),
    # No ReCord for C 'leg'
    Record(Language="C", Parameter="arm", Item="", Cognacy="3"),

    Record(Language="D", Parameter="eye", Item="", Cognacy="1", loan=True),
    Record(Language="D", Parameter="leg", Item="", Cognacy="1"),
    Record(Language="D", Parameter="leg", Item="", Cognacy="2"),
    Record(Language="D", Parameter="arm", Item="", Cognacy="2,3"),
]

maker = NexusMaker(data)

maker = NexusMakerAscertained(data)  # adds Ascertainment bias character

maker = NexusMakerAscertainedWords(data)  # adds Ascertainment character per word

# generate
nex = maker.make()
maker.write(nex, filename="output.nex")


# remove combining cognates:
#    If a language has multiple cognates for a parameter, then this will filter
#    the cognates to a maximum of `keep`, i.e. if a language has cognate sets
#    "a, b, c" for the word `hand`, then `keep=2` will leave the top 2 cognates
#    (="a, b"), while `keep=1` will leave the top cognate set (="a").
maker = remove_combining_cognates(NexusMaker(data), keep=2)
nex = maker.make()

Version History:

  • 2.0.6: allow different ID columns in load_cldf
  • 2.0.4: add unique_ids parameter
  • 2.0.3: handle CLDF datasets
  • 2.0.2: add tool to filter combining cognates
  • 2.0.1: minor bugfixes.
  • 2.0: major refactor of testing and other components.
  • 1.5: do more validation of cognate sets to detect possibly broken combined cognate sets.
  • 1.4: normalise order of cognates (i.e. so 1,54 == 54,1).
  • 1.3: handle cognates of form '1a'.
  • 1.2: initial release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nexusmaker-2.0.7.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nexusmaker-2.0.7-py3-none-any.whl (30.1 kB view details)

Uploaded Python 3

File details

Details for the file nexusmaker-2.0.7.tar.gz.

File metadata

  • Download URL: nexusmaker-2.0.7.tar.gz
  • Upload date:
  • Size: 21.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for nexusmaker-2.0.7.tar.gz
Algorithm Hash digest
SHA256 197dd5489ba606919da0aecf02b4807eea79c9b1eb307b33c494f44326842e9b
MD5 5c55ff61e28a8482a497f8c3c54779d4
BLAKE2b-256 0505a669ffcbffb6dc89e9053e728c283be3c5733d5b4b21e03da400990c4edc

See more details on using hashes here.

File details

Details for the file nexusmaker-2.0.7-py3-none-any.whl.

File metadata

  • Download URL: nexusmaker-2.0.7-py3-none-any.whl
  • Upload date:
  • Size: 30.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for nexusmaker-2.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 a8f1cb04a4f42b58e8b7d6fe3102ebd2a7d50c495d72632184e9e1b0da2b90a0
MD5 29ac4bb615aaf9baff84d0e9ab5253f7
BLAKE2b-256 0d3f5cb3f6cfa7c17eb9175043c4c213148be0f61696655929fb729c1db3902c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page