{"id":13834686,"url":"https://github.com/bio-cr/bam-filter","last_synced_at":"2025-08-20T19:16:43.680Z","repository":{"id":44105013,"uuid":"449592427","full_name":"bio-cr/bam-filter","owner":"bio-cr","description":"Use simple expressions to filter a BAM/CRAM file","archived":false,"fork":false,"pushed_at":"2024-02-10T00:33:11.000Z","size":65,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-08T19:03:09.155Z","etag":null,"topics":["bam","bioinformatics","crystal","genomics","htslib"],"latest_commit_sha":null,"homepage":"","language":"C","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/bio-cr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"ko_fi":"kojix2"}},"created_at":"2022-01-19T07:35:21.000Z","updated_at":"2023-03-24T23:39:13.000Z","dependencies_parsed_at":"2024-06-29T08:46:11.481Z","dependency_job_id":null,"html_url":"https://github.com/bio-cr/bam-filter","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/bio-cr/bam-filter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bio-cr%2Fbam-filter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bio-cr%2Fbam-filter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bio-cr%2Fbam-filter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bio-cr%2Fbam-filter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bio-cr","download_url":"https://codeload.github.com/bio-cr/bam-filter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bio-cr%2Fbam-filter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259910672,"owners_count":22930703,"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":["bam","bioinformatics","crystal","genomics","htslib"],"created_at":"2024-08-04T14:00:51.050Z","updated_at":"2025-08-20T19:16:43.654Z","avatar_url":"https://github.com/bio-cr.png","language":"C","funding_links":["https://ko-fi.com/kojix2"],"categories":["bio-crystal"],"sub_categories":[],"readme":"# bam-filter\n\n[![.github/workflows/ci.yml](https://github.com/bio-cr/bam-filter/actions/workflows/ci.yml/badge.svg)](https://github.com/bio-cr/bam-filter/actions/workflows/ci.yml)\n[![Slack](http://img.shields.io/badge/slack-bio--crystal-purple?labelColor=000000\u0026logo=slack)](https://bio-crystal.slack.com/)\n[![Get invite to BioCrystal](http://img.shields.io/badge/Get_invite_to_BioCrystal-purple?labelColor=000000\u0026logo=slack)](https://join.slack.com/t/bio-crystal/shared_invite/zt-tas46pww-JSEloonmn3Ma5eD2~VeT_g)\n\n[Crystal](https://github.com/crystal-lang/crystal) implementation of [bam-filter](https://github.com/brentp/hts-nim-tools) by Brent Pedersen.\n\nFilter BAM / CRAM / SAM files with a simple expression language.\n\n## Installation\n\n```sh\ngit clone https://github.com/bio-cr/bam-filter\nmake\nsudo make install\n```\n\n- Ubuntu 20.04 and 22.04: deb packages are available from the [Github release page](https://github.com/bio-cr/bam-filter/releases).\n  - Please note that installing the bam-filter deb package may uninstall packages that depend on `libcurl4-openssl-dev`, since `libhts-dev` depends on `libcurl4-gnutls-dev`.\n- Currently only Linux is supported. Pull requests are welcome.\n\n## Usage\n\n```\nUsage: bam-filter [options] \u003cbam_file\u003e\n    -e, --expression EXPR            eval code\n    -o, --output PATH                Write output to FILE [standard output]\n    -f, --fasta FASTA                Reference sequence FASTA FILE [null]\n    -S, --sam                        Output SAM\n    -b, --bam                        Output BAM\n    -C, --cram                       Output CRAM (requires -f)\n    -t, --threads NUM                Number of threads to use [0]\n    --no-PG                          Do not add @PG line to the header\n    -h, --help                       Show this help\n    -v, --version                    Show version number\n```\n\nExample\n\n```\nbam-filter -S -e \"chr=='chr1' \u0026\u0026 pos \u003e 200 \u0026\u0026 tag_AS \u003e 35\" test/moo.bam\n```\n\nThe given expression is evaluated by [klib/kexpr](https://attractivechaos.github.io/klib/#Kexpr%3A%20parsing%20mathematical%20expressions).\n\n### Available values in expression\n\nFields: `name` `flag` `chr` `pos` `start` `stop` `mapq` `mchr` `mpos` `isize`\n\nFlags: `paired` `proper_pair` `unmapped` `mate_unmapped`\n`reverse` `mate_reverse` `read1` `read2` `secondary`\n`qcfail` `duplicate` `supplementary`\n\nTags: `tag_XX` (XX is aux tag)\n\n## Development\n\nThe easiest way to start development is to use [Gitpod](https://www.gitpod.io/). All you need is a browser.\n\n## Contributing\n\nBug fixes and macOS support are welcome.\n\n## Note\n\nbam-filter was originally created to develop and test [HTS.cr](https://github.com/bio-cr/hts.cr).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbio-cr%2Fbam-filter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbio-cr%2Fbam-filter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbio-cr%2Fbam-filter/lists"}