{"id":17220822,"url":"https://github.com/kojix2/ruby-minimap2","last_synced_at":"2025-04-13T22:32:17.235Z","repository":{"id":47880158,"uuid":"325711305","full_name":"kojix2/ruby-minimap2","owner":"kojix2","description":"Powerful long read aligner for Ruby","archived":false,"fork":false,"pushed_at":"2025-01-17T03:32:13.000Z","size":509,"stargazers_count":14,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T12:52:44.572Z","etag":null,"topics":["bioinformatics","genomics","minimap2","ruby"],"latest_commit_sha":null,"homepage":"https://kojix2.github.io/ruby-minimap2/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kojix2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","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},"funding":{"ko_fi":"kojix2"}},"created_at":"2020-12-31T04:13:33.000Z","updated_at":"2025-01-17T03:30:50.000Z","dependencies_parsed_at":"2023-02-04T02:30:37.968Z","dependency_job_id":"dec15088-cf0f-4192-b453-4b5f056e1498","html_url":"https://github.com/kojix2/ruby-minimap2","commit_stats":{"total_commits":225,"total_committers":2,"mean_commits":112.5,"dds":0.004444444444444473,"last_synced_commit":"13a9bff4a7a82e35ddbc7a9df7f82e6a90ce9d2d"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kojix2%2Fruby-minimap2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kojix2%2Fruby-minimap2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kojix2%2Fruby-minimap2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kojix2%2Fruby-minimap2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kojix2","download_url":"https://codeload.github.com/kojix2/ruby-minimap2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248790695,"owners_count":21162073,"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":["bioinformatics","genomics","minimap2","ruby"],"created_at":"2024-10-15T03:53:19.494Z","updated_at":"2025-04-13T22:32:16.726Z","avatar_url":"https://github.com/kojix2.png","language":"Ruby","funding_links":["https://ko-fi.com/kojix2"],"categories":[],"sub_categories":[],"readme":"# ruby-minimap2\n\n[![Gem Version](https://img.shields.io/gem/v/minimap2?color=brightgreen)](https://rubygems.org/gems/minimap2)\n[![test](https://github.com/kojix2/ruby-minimap2/actions/workflows/ci.yml/badge.svg)](https://github.com/kojix2/ruby-minimap2/actions/workflows/ci.yml)\n[![Docs Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://rubydoc.info/gems/minimap2)\n[![Docs Latest](https://img.shields.io/badge/docs-latest-blue.svg)](https://kojix2.github.io/ruby-minimap2/)\n[![The MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.txt)\n[![DOI](https://zenodo.org/badge/325711305.svg)](https://zenodo.org/badge/latestdoi/325711305)\n\n:dna: [minimap2](https://github.com/lh3/minimap2) - the long-read mapper - for [Ruby](https://github.com/ruby/ruby)\n\n## Installation\n\n```\ngem install minimap2\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eCompiling from source\u003c/b\u003e\u003c/summary\u003e\n\n    git clone --recursive https://github.com/kojix2/ruby-minimap2\n    cd ruby-minimap2\n    bundle install\n    bundle exec rake minimap2:build\n    bundle exec rake install\n\n\u003c/details\u003e\n\n## Quick Start\n\n```ruby\nrequire \"minimap2\"\n\naligner = Minimap2::Aligner.new(\"ext/minimap2/test/MT-human.fa\")\nseq     = aligner.seq(\"MT_human\", 100, 200)\nhits    = aligner.align(seq)\npp hits\n```\n\n```\n[#\u003cMinimap2::Alignment:0x000055bbfde2d128\n  @blen=100,\n  @cigar=[[100, 0]],\n  @cigar_str=\"100M\",\n  @cs=\"\",\n  @ctg=\"MT_human\",\n  @ctg_len=16569,\n  @mapq=60,\n  @md=\"\",\n  @mlen=100,\n  @nm=0,\n  @primary=1,\n  @q_en=100,\n  @q_st=0,\n  @r_en=200,\n  @r_st=100,\n  @read_num=1,\n  @strand=1,\n  @trans_strand=0\u003e]\n```\n\n## APIs Overview\n\n```markdown\n* Minimap2 module\n  - fastx_read                  Read fasta/fastq file.\n  - revcomp                     Reverse complement sequence.\n  - execute                     Calls the main function of Minimap2 with arguments. `Minimap2.execute(\"--version\")`\n\n  * Aligner class\n    * attributes\n      - index                   Returns the value of attribute index.\n      - idx_opt                 Returns the value of attribute idx_opt.\n      - map_opt                 Returns the value of attribute map_opt.\n    * methods\n      - new(path, preset: nil)  Create a new aligner. (presets: sr, map-pb, map-out, map-hifi, splice, asm5, etc.)\n      - align                   Maps and returns alignments.\n      - seq                     Retrieve a subsequence from the index.\n\n  * Alignment class\n    * attributes\n      - ctg                     Returns name of the reference sequence the query is mapped to.\n      - ctg_len                 Returns total length of the reference sequence.\n      - r_st                    Returns start positions on the reference.\n      - r_en                    Returns end positions on the reference.\n      - strand                  Returns +1 if on the forward strand; -1 if on the reverse strand.\n      - trans_strand            Returns transcript strand. +1 if on the forward strand; -1 if on the reverse strand; 0 if unknown.\n      - blen                    Returns length of the alignment, including both alignment matches and gaps but excluding ambiguous bases.\n      - mlen                    Returns length of the matching bases in the alignment, excluding ambiguous base matches.\n      - nm                      Returns number of mismatches, gaps and ambiguous positions in the alignment.\n      - primary                 Returns if the alignment is primary (typically the best and the first to generate).\n      - q_st                    Returns start positions on the query.\n      - q_en                    Returns end positions on the query.\n      - mapq                    Returns mapping quality.\n      - cigar                   Returns CIGAR returned as an array of shape (n_cigar,2). The two numbers give the length and the operator of each CIGAR operation.\n      - read_num                Returns read number that the alignment corresponds to; 1 for the first read and 2 for the second read.\n      - cs                      Returns the cs tag.\n      - md                      Returns the MD tag as in the SAM format. It is an empty string unless the md argument is applied when calling Aligner#align.\n      - cigar_str               Returns CIGAR string.\n    * methods\n      - to_h                    Convert Alignment to hash.\n      - to_s                    Convert to the PAF format without the QueryName and QueryLength columns.\n\n  ## FFI module\n    * IdxOpt class              Indexing options.\n    * MapOpt class              Mapping options.\n```\n\n- API is based on [Mappy](https://github.com/lh3/minimap2/tree/master/python), the official Python binding for Minimap2.\n- `Aligner#map` has been changed to `align`, because `map` means iterator in Ruby.\n- See [documentation](https://kojix2.github.io/ruby-minimap2/) for details.\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eC Structures and Functions\u003c/b\u003e\u003c/summary\u003e\n\n### FFI\n\n- Ruby-Minimap2 is built on top of [Ruby-FFI](https://github.com/ffi/ffi).\n  - Native C functions can be called from the `Minimap2::FFI` module.\n  - Native C structure members can be accessed.\n  - Bitfields are supported by [ffi-bitfield](https://github.com/kojix2/ffi-bitfield) gems.\n\n```ruby\naligner.idx_opt.members\n# =\u003e [:k, :w, :flag, :bucket_bits, :mini_batch_size, :batch_size]\naligner.kds_opt.values\n# =\u003e [15, 10, 0, 14, 50000000, 9223372036854775807]\naligner.idx_opt[:k]\n# =\u003e 15\naligner.idx_opt[:k] = 14\naligner.idx_opt[:k]\n# =\u003e 14\n```\n\n\u003c/details\u003e\n\n## Contributing\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eDevelopment\u003c/b\u003e\u003c/summary\u003e\n\nFork your repository.\nthen clone.\n\n```sh\ngit clone --recursive https://github.com/kojix2/ruby-minimap2\n# git clone https://github.com/kojix2/ruby-minimap2\n# cd ruby-minimap2\n# git submodule update -i\n```\n\nBuild Minimap2 and Mappy.\n\n```sh\ncd ruby-minimap2\nbundle install # Install dependent packages including Ruby-FFI\nbundle exec rake minimap2:build\n```\n\nA shared library will be created in the vendor directory.\n\n```\n└── vendor\n   └── libminimap2.so\n```\n\nRun tests.\n\n```\nbundle exec rake test\n```\n\nRelease a Gem.\n\n```\nbundle exec rake minimap2:cleanall\nbundle exec rake build\nls -l pkg # Check the size of the Gem and make sure it does not contain any unused code such as shared libraries or lib/simde.\nbundle exec rake release\n```\n\n\u003c/details\u003e\n\nruby-minimap2 is a library under development and there are many points to be improved.\n\nPlease feel free to report [bugs](https://github.com/kojix2/ruby-minimap2/issues) and [pull requests](https://github.com/kojix2/ruby-minimap2/pulls)!\n\nMany OSS projects become abandoned because only the founder has commit rights to the original repository.\nIf you need commit rights to ruby-minimap2 repository or want to get admin rights and take over the project, please feel free to contact me @kojix2.\n\n## License\n\n[MIT License](https://opensource.org/licenses/MIT).\n\n## Acknowledgements\n\nI would like to thank Heng Li for making Minimap2, and all the readers who read the README to the end.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkojix2%2Fruby-minimap2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkojix2%2Fruby-minimap2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkojix2%2Fruby-minimap2/lists"}