{"id":18189928,"url":"https://github.com/kullrich/literal-dists","last_synced_at":"2025-10-29T12:01:46.855Z","repository":{"id":86806795,"uuid":"332048682","full_name":"kullrich/literal-dists","owner":"kullrich","description":"Convert a FASTA alignment with ambiguous nucleotides to literal distance matrix","archived":false,"fork":false,"pushed_at":"2024-06-05T15:41:21.000Z","size":162,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-13T17:29:04.241Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kullrich.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-22T19:56:04.000Z","updated_at":"2024-06-12T10:25:39.000Z","dependencies_parsed_at":"2024-02-05T09:32:21.365Z","dependency_job_id":"3e552b7a-a214-41e6-8984-353553d414b6","html_url":"https://github.com/kullrich/literal-dists","commit_stats":{"total_commits":27,"total_committers":1,"mean_commits":27.0,"dds":0.0,"last_synced_commit":"936a8d21f3c1817a6e2c835219ec8ab2f08ba0ce"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kullrich%2Fliteral-dists","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kullrich%2Fliteral-dists/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kullrich%2Fliteral-dists/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kullrich%2Fliteral-dists/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kullrich","download_url":"https://codeload.github.com/kullrich/literal-dists/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247675627,"owners_count":20977376,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-03T04:04:34.283Z","updated_at":"2025-10-29T12:01:46.842Z","avatar_url":"https://github.com/kullrich.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![License: GPLv3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n[![Language: C99](https://img.shields.io/badge/Language-C99-orangered.svg)](https://en.wikipedia.org/wiki/C99)\n\n# literal-dists\n\nConvert a FASTA alignment with ambiguous nucleotides to literal distance matrix\n\nAccepts `A, C, G, T, R, Y, S, W, K, M, B, D, H, V, -, X, ., N`\n\nForked and adapted from [snp-dists](https://github.com/tseemann/snp-dists)\n\nAlmost all source code is taken from [snp-dists](https://github.com/tseemann/snp-dists),\ndespite the literal-distance calculation\n\nLiteral distances are implemented as mentioned by [Chang et al., 2017](https://pubmed.ncbi.nlm.nih.gov/28819774/)\n\n## Quick Start\n\n```\n% cat test/good.aln\n\n\u003eseq1\nAGTCAGTC\n\u003eseq2\nAGGCAGTC\n\u003eseq3\nAGTGAGTA\n\u003eseq4\nTGTTAGAC\n\u003eseq5\nTGTCAYGR\n\n% literal-dists test/good.aln \u003e distances.tab\n\nRead 4 sequences of length 8\n\n% cat distances.tab\n\nliteral-dists 0.0.1\tseq1\tseq2\tseq3\tseq4\tseq5\nseq1\t0.000000\t0.125000\t0.250000\t0.375000\t0.500000\nseq2\t0.125000\t0.000000\t0.375000\t0.500000\t0.625000\nseq3\t0.250000\t0.375000\t0.000000\t0.500000\t0.562500\nseq4\t0.375000\t0.500000\t0.500000\t0.000000\t0.500000\nseq5    0.500000\t0.625000\t0.562500\t0.500000\t0.000000\n```\n\n## Installation\n\nAs `literal-dists` source code is almost completely taken from [snp-dists](https://github.com/tseemann/snp-dists)\n\n`literal-dists` is written in C to the C99 standard and only depends on `zlib`.\n\n### Source\n\n```\ngit clone https://github.com/kullrich/literal-dists.git\ncd literal-dists\nmake\n\n# run tests\nmake check\n\n# optionally install to a specific location (default: /usr/local)\nmake PREFIX=/usr/local install\n```\n\n## Options\n\n### `literal-dists -h` (help)\n\n```\nSYNOPSIS\n  Pairwise literal distance matrix from a FASTA alignment\nUSAGE\n  literal-dists [options] alignment.fasta[.gz] \u003e matrix.tsv\nOPTIONS\n  -h    Show this help\n  -v    Print version and exit\n  -t    Use original snp-dists distance\n  -q    Quiet mode; do not print progress information\n  -a    Count all differences not just [AGTC]\n  -k    Keep case, don't uppercase all letters\n  -m    Output MOLTEN instead of TSV\n  -c    Use comma instead of tab in output\n  -b    Blank top left corner cell\n  -g\tSkip gap sites if gap frequency is met, gap sites [.-NX]\n  -z\tGap frequency [default: 0.5]\nURL\n  https://github.com/kullrich/literal-dists\n```\n\n### `literal-dists -v` (version)\n\nPrints the name and version separated by a space in standard Unix fashion.\n\n```\nliteral-dists 0.0.2\n```\n\n### `literal-dists -q` (quiet mode)\n\nDon't print informational messages, only errors.\n\n### `literal-dists -c` (CSV instead of TSV)\n\n```\nliteral-dists 0.0.1,seq1,seq2,seq3,seq4,seq5\nseq1,0.000000,0.125000,0.250000,0.375000,0.500000\nseq2,0.125000,0.000000,0.375000,0.500000,0.625000\nseq3,0.250000,0.375000,0.000000,0.500000,0.562500\nseq4,0.375000,0.500000,0.500000,0.000000,0.500000\nseq5,0.500000,0.625000,0.562500,0.500000,0.000000\n```\n\n### `literal-dists -b` (omit the toolname/version)\n\n```\n\tseq1\tseq2\tseq3\tseq4\tseq5\nseq1\t0.000000\t0.125000\t0.250000\t0.375000\t0.500000\nseq2\t0.125000\t0.000000\t0.375000\t0.500000\t0.625000\nseq3\t0.250000\t0.375000\t0.000000\t0.500000\t0.562500\nseq4\t0.375000\t0.500000\t0.500000\t0.000000\t0.500000\nseq5\t0.500000\t0.625000\t0.562500\t0.500000\t0.000000\n```\n\n### `literal-dists -t` (original snp-dists v0.7.0 distance calculation)\n\n```\n\tseq1\tseq2\tseq3\tseq4\tseq5\nseq1\t0\t1\t2\t3\t2\nseq2\t1\t0\t3\t4\t3\nseq3\t2\t3\t0\t4\t3\nseq4\t3\t4\t4\t0\t2\nseq5\t2\t3\t3\t2\t0\n```\n\n## Advanced options (for original snp-dists implementation only)\n\nBy default, all letters are (1) uppercased and (2) ignored if not A, C, G, T.\n\n### `literal-dists -a` (don't just count AGTC)\n\nNormally one would not want to count ambiguous letters and gaps as a \"difference\"\nbut if you desire, you can enable this option.\n\n```\n\u003eseq1\nNGTCAGTC\n\u003eseq2\nAG-CAGTC\n\u003eseq3\nAGTGNGTA\n```\n\n### `literal-dists -k` (don't uppercase any letters)\n\nYou may wish to preserve case, as you may wish lower-case characters\nto be masked in the comparison.\n```\n\u003eseq1\nAgTCAgTC\n\u003eseq2\nAggCAgTC\n\u003eseq3\nAgTgAgTA\n```\n\n### `literal-dists -m` (\"molten\" output format)\n\n`literal-dists -m test/good.aln`\n\n```\n#seq1\tseq2\tdist\tscore\tnsites\nseq1\tseq1\t0.000000\t0.000000\t8.000000\nseq1\tseq2\t0.125000\t1.000000\t8.000000\nseq1\tseq3\t0.250000\t2.000000\t8.000000\nseq1\tseq4\t0.375000\t3.000000\t8.000000\nseq1\tseq5\t0.500000\t4.000000\t8.000000\nseq2\tseq1\t0.125000\t1.000000\t8.000000\nseq2\tseq2\t0.000000\t0.000000\t8.000000\nseq2\tseq3\t0.375000\t3.000000\t8.000000\nseq2\tseq4\t0.500000\t4.000000\t8.000000\nseq2\tseq5\t0.625000\t5.000000\t8.000000\nseq3\tseq1\t0.250000\t2.000000\t8.000000\nseq3\tseq2\t0.375000\t3.000000\t8.000000\nseq3\tseq3\t0.000000\t0.000000\t8.000000\nseq3\tseq4\t0.500000\t4.000000\t8.000000\nseq3\tseq5\t0.562500\t4.500000\t8.000000\nseq4\tseq1\t0.375000\t3.000000\t8.000000\nseq4\tseq2\t0.500000\t4.000000\t8.000000\nseq4\tseq3\t0.500000\t4.000000\t8.000000\nseq4\tseq4\t0.000000\t0.000000\t8.000000\nseq4\tseq5\t0.500000\t4.000000\t8.000000\nseq5\tseq1\t0.500000\t4.000000\t8.000000\nseq5\tseq2\t0.625000\t5.000000\t8.000000\nseq5\tseq3\t0.562500\t4.500000\t8.000000\nseq5\tseq4\t0.500000\t4.000000\t8.000000\nseq5\tseq5\t0.000000\t0.000000\t8.000000\n```\n\n`literal-dists -m test/ambig.aln`\n\n```\n#seq1\tseq2\tdist\tscore\tnsites\nseq1\tseq1\t0.000000\t0.000000\t7.000000\nseq1\tseq2\t0.000000\t0.000000\t6.000000\nseq1\tseq3\t0.333333\t2.000000\t6.000000\nseq1\tseq4\t0.166667\t1.000000\t6.000000\nseq1\tseq5\t0.166667\t1.000000\t6.000000\nseq2\tseq1\t0.000000\t0.000000\t6.000000\nseq2\tseq2\t0.000000\t0.000000\t7.000000\nseq2\tseq3\t0.333333\t2.000000\t6.000000\nseq2\tseq4\t0.333333\t2.000000\t6.000000\nseq2\tseq5\t0.333333\t2.000000\t6.000000\nseq3\tseq1\t0.333333\t2.000000\t6.000000\nseq3\tseq2\t0.333333\t2.000000\t6.000000\nseq3\tseq3\t0.000000\t0.000000\t7.000000\nseq3\tseq4\t0.500000\t3.000000\t6.000000\nseq3\tseq5\t0.500000\t3.000000\t6.000000\nseq4\tseq1\t0.166667\t1.000000\t6.000000\nseq4\tseq2\t0.333333\t2.000000\t6.000000\nseq4\tseq3\t0.500000\t3.000000\t6.000000\nseq4\tseq4\t0.000000\t0.000000\t7.000000\nseq4\tseq5\t0.000000\t0.000000\t7.000000\nseq5\tseq1\t0.166667\t1.000000\t6.000000\nseq5\tseq2\t0.333333\t2.000000\t6.000000\nseq5\tseq3\t0.500000\t3.000000\t6.000000\nseq5\tseq4\t0.000000\t0.000000\t7.000000\nseq5\tseq5\t0.000000\t0.000000\t7.000000\n```\n\n### `literal-dists -g` (skip gap sites [.-NX] if gap frequency is met)\n\n`literal-dists -m -g test/ambig.aln`\n\n```\n#seq1\tseq2\tdist\tscore\tnsites\tgapsites\nseq1\tseq1\t0.000000\t0.000000\t7.000000\t0\nseq1\tseq2\t0.000000\t0.000000\t6.000000\t0\nseq1\tseq3\t0.333333\t2.000000\t6.000000\t0\nseq1\tseq4\t0.166667\t1.000000\t6.000000\t0\nseq1\tseq5\t0.166667\t1.000000\t6.000000\t0\nseq2\tseq1\t0.000000\t0.000000\t6.000000\t0\nseq2\tseq2\t0.000000\t0.000000\t7.000000\t0\nseq2\tseq3\t0.333333\t2.000000\t6.000000\t0\nseq2\tseq4\t0.333333\t2.000000\t6.000000\t0\nseq2\tseq5\t0.333333\t2.000000\t6.000000\t0\nseq3\tseq1\t0.333333\t2.000000\t6.000000\t0\nseq3\tseq2\t0.333333\t2.000000\t6.000000\t0\nseq3\tseq3\t0.000000\t0.000000\t7.000000\t0\nseq3\tseq4\t0.500000\t3.000000\t6.000000\t0\nseq3\tseq5\t0.500000\t3.000000\t6.000000\t0\nseq4\tseq1\t0.166667\t1.000000\t6.000000\t0\nseq4\tseq2\t0.333333\t2.000000\t6.000000\t0\nseq4\tseq3\t0.500000\t3.000000\t6.000000\t0\nseq4\tseq4\t0.000000\t0.000000\t7.000000\t0\nseq4\tseq5\t0.000000\t0.000000\t7.000000\t0\nseq5\tseq1\t0.166667\t1.000000\t6.000000\t0\nseq5\tseq2\t0.333333\t2.000000\t6.000000\t0\nseq5\tseq3\t0.500000\t3.000000\t6.000000\t0\nseq5\tseq4\t0.000000\t0.000000\t7.000000\t0\nseq5\tseq5\t0.000000\t0.000000\t7.000000\t0\n```\n\n### `literal-dists -g -z 0.2` (skip gap sites [.-NX] using gap frequency of 0.2)\n\n`literal-dists -m -g -z 0.2 test/ambig.aln`\n\n```\n#seq1\tseq2\tdist\tscore\tnsites\tgapsites\nseq1\tseq1\t0.000000\t0.000000\t4.000000\t4\nseq1\tseq2\t0.000000\t0.000000\t4.000000\t4\nseq1\tseq3\t0.500000\t2.000000\t4.000000\t4\nseq1\tseq4\t0.250000\t1.000000\t4.000000\t4\nseq1\tseq5\t0.250000\t1.000000\t4.000000\t4\nseq2\tseq1\t0.000000\t0.000000\t4.000000\t4\nseq2\tseq2\t0.000000\t0.000000\t4.000000\t4\nseq2\tseq3\t0.500000\t2.000000\t4.000000\t4\nseq2\tseq4\t0.250000\t1.000000\t4.000000\t4\nseq2\tseq5\t0.250000\t1.000000\t4.000000\t4\nseq3\tseq1\t0.500000\t2.000000\t4.000000\t4\nseq3\tseq2\t0.500000\t2.000000\t4.000000\t4\nseq3\tseq3\t0.000000\t0.000000\t4.000000\t4\nseq3\tseq4\t0.500000\t2.000000\t4.000000\t4\nseq3\tseq5\t0.500000\t2.000000\t4.000000\t4\nseq4\tseq1\t0.250000\t1.000000\t4.000000\t4\nseq4\tseq2\t0.250000\t1.000000\t4.000000\t4\nseq4\tseq3\t0.500000\t2.000000\t4.000000\t4\nseq4\tseq4\t0.000000\t0.000000\t4.000000\t4\nseq4\tseq5\t0.000000\t0.000000\t4.000000\t4\nseq5\tseq1\t0.250000\t1.000000\t4.000000\t4\nseq5\tseq2\t0.250000\t1.000000\t4.000000\t4\nseq5\tseq3\t0.500000\t2.000000\t4.000000\t4\nseq5\tseq4\t0.000000\t0.000000\t4.000000\t4\nseq5\tseq5\t0.000000\t0.000000\t4.000000\t4\n```\n\n## Issues\n\nReport bugs and give suggesions on the\n[Issues page](https://github.com/kullrich/literal-dists/issues)\n\n## Related software\n\n* [snp-dists](https://github.com/tseemann/snp-dists)\n* [Disty](https://github.com/c2-d2/disty)\n* [Panito](https://github.com/sanger-pathogens/panito)\n* [pairwise_snp_differences](https://github.com/MDU-PHL/pairwise_snp_differences/blob/master/pairwise_snp_differences.Rmd)\n\n## Licence\n\n[GPL Version 3](https://raw.githubusercontent.com/kullrich/literal-dists/master/LICENSE)\n\n## Authors\n\n* [Kristian Ullrich](https://github.com/kullrich)\n\n## References\n\n[https://github.com/tseemann/snp-dists](https://github.com/tseemann/snp-dists)\n\nChang PL., Kopania E., Keeble S., Sarver BAJ., Larson E., Orth A., Belkhir K., Boursot P., Bonhomme F., Good JM., and Dean MW. (2017). **Whole exome sequencing of wild-derived inbred strains of mice improves power to link phenotype and genotype.** *Mammalian Genome*, **28**, 416-425. [https://dx.doi.org/10.1007%2Fs00335-017-9704-9](https://dx.doi.org/10.1007%2Fs00335-017-9704-9)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkullrich%2Fliteral-dists","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkullrich%2Fliteral-dists","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkullrich%2Fliteral-dists/lists"}