https://github.com/alexpreynolds/kmer-collapse

Collapse a set of redundant kmers to use IUPAC degenerate bases

https://github.com/alexpreynolds/kmer-collapse

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.1%) to scientific vocabulary

Keywords

bioinformatics encoding iupac kmer
Last synced: 6 months ago · JSON representation

Repository

Collapse a set of redundant kmers to use IUPAC degenerate bases

Basic Info
  • Host: GitHub
  • Owner: alexpreynolds
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 15.6 KB
Statistics
  • Stars: 3
  • Watchers: 3
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
bioinformatics encoding iupac kmer
Created about 4 years ago · Last pushed about 4 years ago
Metadata Files
Readme License

README.md

kmer-collapse

Collapse a set of redundant kmers to use IUPAC degenerate bases

Overview

Given an input set of kmers, find the smallest set of kmers that encapsulates all diversity in the input set using IUPAC degenerate bases. This aims to solve the problem described here: https://www.biostars.org/p/9498272/

Usage

Install the marisa-trie library, if necessary.

Modify the script's input variable to specify desired sequences, and then run the script:

$ python kmer-collapse.py { "input": [ "AAAAAAAAAA", "TAAAAAAAAA", "ACAAAAAAAA", "AGAAAAAAAA" ], "encoded_output": [ "WAAAAAAAAA", "ASAAAAAAAA" ] }

In this usage example, WAAAAAAAAA can expand to AAAAAAAAAA and TAAAAAAAAA, while ASAAAAAAAA can expand to ACAAAAAAAA and AGAAAAAAAA, covering the input set. This encoding covers the original input, when using IUPAC mapping, and is one of two solutions that is also the smallest such set.

Notes

This aims for the smallest set of encoded strings. However, this does not report all possible such solutions in case there are more than one, as shown in the example above.

This has not been tested with any kmer sets but those examples provided. However, it aims to be scalable by pruning combinations of sub-kmers constructed along the way that would yield incorrect encodings. This also uses a trie for fast, space-efficient prefix testing. If further performance is needed, some easy wins would be to cache sub-kmer prefix tests, as most of these tests will be redundant.

Additionally, no error checking is done on the input kmer alphabet, the consistency of kmer lengths, or the uniqueness of kmers. It may be useful to validate input before using this script.

Examples

These examples are available from the script by uncommenting the relevant input.

A

{ "input": [ "AAAAAAAAAA", "TAAAAAAAAA" ], "encoded_output": [ "WAAAAAAAAA" ] }

B

{ "input": [ "AAAAAAAAAA", "TAAAAAAAAA", "GCGAAAAAAA" ], "encoded_output": [ "GCGAAAAAAA", "WAAAAAAAAA" ] }

C

{ "input": [ "AAAAAAAAAA" ], "encoded_output": [ "AAAAAAAAAA" ] }

D

{ "input": [ "AAAAAAAAAA", "TAAAAAAAAA", "CAAAAAAAAA", "GAAAAAAAAA" ], "encoded_output": [ "NAAAAAAAAA" ] }

E

{ "input": [ "AAAAAAAAAA", "TAAAAAAAAA", "TTAAAAAAAA", "ATAAAAAAAA" ], "encoded_output": [ "WWAAAAAAAA" ] }

F

{ "input": [ "AAAAAAAAAA", "TAAAAAAAAA", "CAAAAAAAAA", "GAAAAAAAAA", "TACAGATACA", "AACAGAAAAA" ], "encoded_output": [ "NAAAAAAAAA", "TACAGATACA", "AACAGAAAAA" ] }

G

{ "input": [ "AAAAAAAAAA", "TAAAAAAAAA", "ACAAAAAAAA", "AGAAAAAAAA" ], "encoded_output": [ "ASAAAAAAAA", "WAAAAAAAAA" ] }

Owner

  • Name: Alex Reynolds
  • Login: alexpreynolds
  • Kind: user
  • Location: Seattle, WA USA
  • Company: Altius Institute for Biomedical Sciences

Pug caregiver, curler, cyclist, gardener, beginning French scholar

GitHub Events

Total
Last Year

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 9
  • Total Committers: 1
  • Avg Commits per committer: 9.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Alex Reynolds a****s@g****m 9

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels