{"id":29353699,"url":"https://github.com/thavlik/mirbase","last_synced_at":"2026-05-19T03:34:27.458Z","repository":{"id":303658047,"uuid":"1016251681","full_name":"thavlik/mirbase","owner":"thavlik","description":"Code for generating a sqlite database from miRBase data","archived":false,"fork":false,"pushed_at":"2025-07-08T19:22:37.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-08T19:27:38.819Z","etag":null,"topics":["bioinformatics","dna","docker","genetics","lncrna","mirbase","mirdb","mirna","parser","rna"],"latest_commit_sha":null,"homepage":"","language":"Go","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/thavlik.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,"zenodo":null}},"created_at":"2025-07-08T18:06:34.000Z","updated_at":"2025-07-08T19:22:41.000Z","dependencies_parsed_at":"2025-07-08T19:28:21.691Z","dependency_job_id":"8580f092-1553-4d1a-8ff2-bcef8ae7a5e4","html_url":"https://github.com/thavlik/mirbase","commit_stats":null,"previous_names":["thavlik/mirbase"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thavlik/mirbase","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thavlik%2Fmirbase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thavlik%2Fmirbase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thavlik%2Fmirbase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thavlik%2Fmirbase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thavlik","download_url":"https://codeload.github.com/thavlik/mirbase/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thavlik%2Fmirbase/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264379216,"owners_count":23598824,"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","dna","docker","genetics","lncrna","mirbase","mirdb","mirna","parser","rna"],"created_at":"2025-07-09T02:08:57.925Z","updated_at":"2026-05-19T03:34:27.452Z","avatar_url":"https://github.com/thavlik.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mirbase\r\n[\u003cimg src=\"https://img.shields.io/docker/image-size/thavlik/mirbase/latest\"\u003e](https://hub.docker.com/r/thavlik/mirbase)\r\n[\u003cimg src=\"https://img.shields.io/badge/maintenance%20status-actively%20developed-brightgreen\"\u003e](https://github.com/thavlik/mirbase)\r\n[\u003cimg src=\"https://img.shields.io/badge/Language-go-01add8.svg\"\u003e](https://go.dev/)\r\n[\u003cimg src=\"https://img.shields.io/badge/License-MIT-lightblue.svg\"\u003e](./LICENSE)\r\n\r\nThis repository contains a Dockerfile for building a [sqlite](https://www.sqlite.org/) database from the [miRBase data](https://www.mirbase.org/download/). \r\n\r\n## Building\r\nRun [./scripts/build.sh](./scripts/build.sh) or run the following command:\r\n```bash\r\ndocker build -t thavlik/mirbase:latest .\r\n```\r\n\r\n## Schema\r\nSee [tables.sql](pkg/store/sql_store/tables.sql) for how the tables are created. Note that the schema used for sqlite differs from the official miRBase release.\r\n\r\n\r\n## Usage\r\nThere are two ways to utilize the prebuilt image: as a base image, and the `mirbase` command line.\r\n\r\nWhen used as a base image, where you can find the database file at `/mirbase.sqlite`:\r\n\r\n```Dockerfile\r\n# Create a reference to the database image as a build stage.\r\nFROM thavlik/mirbase:latest AS db\r\n\r\n# Create your image here.\r\nFROM debian:latest\r\nCOPY --from=db /mirbase.sqlite /opt/mirbase.sqlite\r\n#\r\n# Now your docker image contains the prebuilt\r\n# sqlite database file at /opt/mirbase.sqlite\r\n#\r\n```\r\n\r\nNote: the only time you must build this image is if you want to change how data is handled. For example, you want to insert into a PostgreSQL server instead of writing to a sqlite file. If sqlite is sufficient for you, you are encouraged to use the [prebuilt image](https://hub.docker.com/r/thavlik/mirbase).\r\n\r\n### Loading\r\nSee [init_store.go](pkg/store/init_store/init_store.go) for code that demonstrates how to open the database. It is advised to optimize your connection query for your application. Note that [go-sqlite3](https://github.com/mattn/go-sqlite3) requires compiling with `CGO_ENABLED=1`.\r\n\r\n### Searching\r\n[tables.sql](pkg/store/sql_store/tables.sql) creates an [fts5](https://www.sqlite.org/fts5.html) virtual table to fuzzy search for rows in the `mirna` table. The trigram tokenizer provides a fuzzy searching behavior. \r\n\r\nHere is some example code written in [Go](https://go.dev/) that demonstrates paginated fuzzy searching and applies bold (\\\u003cb\\\u003e and \\\u003c/b\\\u003e) tags to the matched text. Note that [go-sqlite3](https://github.com/mattn/go-sqlite3) with the search function requires compiling with **both** `CGO_ENABLED=1` **and** `-tags \"fts5\"`.\r\n```go\r\ntype MiRNASearchResult struct {\r\n\tMiRNAAcc    string `json:\"mirna_acc\"`\r\n\tMiRNAID     string `json:\"mirna_id\"`\r\n\tDescription string `json:\"description,omitempty\"`\r\n\tSequence    string `json:\"sequence,omitempty\"`\r\n\tComment     string `json:\"comment,omitempty\"`\r\n}\r\n\r\n// SearchMiRNAs fuzzy searches the sqlite database for miRNAs,\r\n// partially matching accession number, ID, description, sequence,\r\n// or comment. Results are sorted by rank and paginated.\r\nfunc SearchMiRNAs(\r\n\tctx context.Context,\r\n\tdb *sql.DB,\r\n\tquery string,\r\n\tpageSize int,\r\n\tpage int,\r\n) ([]*MiRNASearchResult, error) {\r\n\trows, err := db.QueryContext(\r\n\t\tctx,\r\n\t\t`SELECT mirna_acc, mirna_id,\r\n  highlight(mirna_search, 2, '\u003cb\u003e', '\u003c/b\u003e'),\r\n  highlight(mirna_search, 3, '\u003cb\u003e', '\u003c/b\u003e'),\r\n  highlight(mirna_search, 4, '\u003cb\u003e', '\u003c/b\u003e')\r\nFROM mirna_search($1)\r\nORDER BY rank\r\nLIMIT $2 OFFSET $3`,\r\n\t\tquery,\r\n\t\tpageSize,\r\n\t\t(page-1)*pageSize,\r\n\t)\r\n\tif err != nil {\r\n\t\treturn nil, errors.Wrap(err, \"sql query\")\r\n\t}\r\n\tdefer rows.Close()\r\n\tresults := []*MiRNASearchResult{}\r\n\tfor rows.Next() {\r\n\t\tresult := new(MiRNASearchResult)\r\n\t\tif err := rows.Scan(\r\n\t\t\t\u0026result.MiRNAAcc,\r\n\t\t\t\u0026result.MiRNAID,\r\n\t\t\t\u0026result.Description,\r\n\t\t\t\u0026result.Sequence,\r\n\t\t\t\u0026result.Comment,\r\n\t\t); err != nil {\r\n\t\t\treturn nil, errors.Wrap(err, \"sql scan\")\r\n\t\t}\r\n\t\tresults = append(results, result)\r\n\t}\r\n\tif err := rows.Err(); err != nil {\r\n\t\treturn nil, errors.Wrap(err, \"sql rows iterator\")\r\n\t}\r\n\treturn results, nil\r\n}\r\n```\r\n\r\nThe above function is implemented as the `search` subcommand, which can be ran as follows:\r\n```bash\r\ndocker run -it --rm thavlik/mirbase:latest mirbase search 12180\r\n```\r\n```json\r\n[\r\n  {\r\n    \"mirna_acc\": \"MI0040618\",\r\n    \"mirna_id\": \"mmu-mir-12180\",\r\n    \"description\": \"Mus musculus miR-\\u003cb\\u003e12180\\u003c/b\\u003e stem-loop\",\r\n    \"sequence\": \"AGUGUUCCAGCAUGGAAGGGGAGGGGUUCCUGAGCUUGUGUCUUUAACCAAGGAGCUGUGGACACUUGA\"\r\n  },\r\n  {\r\n    \"mirna_acc\": \"MI0012180\",\r\n    \"mirna_id\": \"bmo-mir-2731-2\",\r\n    \"description\": \"Bombyx mori miR-2731-2 stem-loop\",\r\n    \"sequence\": \"AAACCUAACAGAUGCGAGACCAUGGUAUGUGGAAAUAAAAGCCACCCGGUUUUUAUCUUUCCACACCAAAAGAUCCACAUUUCCCGAGGUG\"\r\n  }\r\n]\r\n```\r\n\r\n## License\r\nThe code in this repository for building the database is [licensed under MIT](./LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthavlik%2Fmirbase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthavlik%2Fmirbase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthavlik%2Fmirbase/lists"}