{"id":30660086,"url":"https://github.com/nanoporetech/pomfret","last_synced_at":"2025-08-31T13:44:08.232Z","repository":{"id":294751510,"uuid":"982833396","full_name":"nanoporetech/pomfret","owner":"nanoporetech","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-15T12:58:09.000Z","size":6884,"stargazers_count":20,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-07-16T05:09:57.159Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nanoporetech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-05-13T13:25:50.000Z","updated_at":"2025-07-15T12:58:12.000Z","dependencies_parsed_at":"2025-05-21T22:30:27.004Z","dependency_job_id":null,"html_url":"https://github.com/nanoporetech/pomfret","commit_stats":null,"previous_names":["nanoporetech/pomfret"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nanoporetech/pomfret","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoporetech%2Fpomfret","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoporetech%2Fpomfret/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoporetech%2Fpomfret/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoporetech%2Fpomfret/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nanoporetech","download_url":"https://codeload.github.com/nanoporetech/pomfret/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoporetech%2Fpomfret/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272988783,"owners_count":25026959,"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","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-08-31T13:44:06.256Z","updated_at":"2025-08-31T13:44:08.206Z","avatar_url":"https://github.com/nanoporetech.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pomfret\n\n**Pomfret** is a methylation-assisted phase block joiner that leverages **5-methylcytosine (5mC)** signals to improve read phasing and resolve phase block discontinuities.\n\nHaplotype-specific 5mC methylation is common in **humans and other vertebrates**, and can reveal long-range haplotype structure even in variant-sparse regions.\nPomfret uses this information to bridge phase blocks and produce more complete phasing results.\n\n---\n\n## Overview\n\nPomfret integrates directly into a standard variant phasing workflow.\nNo additional post-processing is required.\n\n**Inputs:**\n- A **sorted and indexed BAM** file with alignments (MD tag required)\n- A **phased VCF** file\n\n**Outputs:**\n- A **VCF** file with updated phase block IDs (variant calls are unchanged)\n- A **GTF** file defining the methylation-informed phase blocks\n\n---\n\n## Getting started\n\n### Build Instructions\n\nPomfret builds on **Linux** and **macOS**. Dependencies:\n\n- ``gcc``\n- ``zlib``\n- [HTSlib](https://github.com/samtools/htslib)\n\n```bash\n# Clone and build Pomfret\ngit clone https://github.com/nanoporetech/pomfret.git\ncd pomfret\nmake\n```\n\n## Quick Start\n\nRun Pomfret on the provided example data:\n\n```bash\npomfret \\\n    methphase \\\n\t-o out \\\n\t-c 60 \\\n\t--write-bam \\\n\t--vcf example/variants.vcf.gz \\\n\texample/phased.bam\n```\n\nStandard usage:\n```bash\npomfret \\\n    methphase \\\n\t-o prefix \\\n\t--vcf phased.vcf \\\n\ttagged.bam\n```\n\n---\n\n## Additional Options\n\n* To define phase blocks with a GTF file instead of a VCF, use the ``--gtf`` option.\n* For untagged BAMs (e.g. from Dorado), use ``--bam-is-untagged``.\n  Pomfret will infer read haplotypes from the basecalled sequence and the VCF.\n\n---\n\n## Reporting Phase Join Quality\n\nPomfret also provides a ``report`` command to assess methylation phasing quality:\n\n```\n# Report success, error and no-join of meth-phasing in a subset of the phased regions:\npomfret \\\n    report \\\n\t-o prefix \\\n\t--vcf phased.vcf \\\n\ttagged.bam\n```\n\nThe report can be focued to specific regions using ``--chunk-size 50000 --chunk-stride 100000``.\n\n---\n\n## Notes\n\n* Add the ``-t`` option to specify the number of threads to use.\n* All input files must remain unchanged during execution.\n* BAM files must be sorted and indexed.\n* VCF, GTF, and TSV files must be sorted, and may be plain or gzipped.\n* Use ``-h`` or ``--help`` for command options.\n\nFor custom HTSlib install: ``LD_LIBRARY_PATH=/path/to/htsliblib DIR_HTSLIB=/path/to/htslib make``\n\n---\n\n# Evaluations\n\nBasecalled and aligned HG002 readsets was obtained from [Jan 2025 public data release](https://epi2me.nanoporetech.com/giab-2025.01/).\nThere were two runs, and each was basecalled by either the SUP or the HAC model.\nFor each basecaller, BAM files were merged with `samtools merge -@32`.\nBAMs were then sampled to different depths to be used in evaluations by `samtools view -bh -s INT.FLOAT -@24`.\n\nWe performed variant calling with [wf-human-variation workflow](https://github.com/epi2me-labs/wf-human-variation):\n`nextflow run epi2me-labs/wf-human-variation -r v2.4.1 --out_dir wfhuman.out --bam input.bam --override_basecaller_cfg dna_r10.4.1_e8.2_400bps_MODEL@v5.0.0 --sex XY --ref hg38.fna --bed chr_all_all.bed --sample_name hg002 --threads 32 --snp -profile singularity`\nwhere the MODEL was either ``sup``  or ``hac``, according to the input.\n\nwhatshap~\\cite{martin2016whatshap} (version 2.4.dev2+gbe88057) was run as follows:\n\n```\nwhatshap \\\n    phase \\\n\t-o phased.vcf \\\n    --ignore-read-groups \\\n    --reference=hg38.fna \\\n\thg002.wf_snp.vcf.gz \\\n\tinput.bam\n```\n\nGTF file containing phase blocks was generated with ``whatshap stats -{}-gtf=phased.vcf.gtf phased.vcf``.\nVCF was compressed and indexed.\n\nFor variant-based phasing, we used whatshap (version 2.4.dev2+gbe88057) or hapcut2 (v1.3.4, commit 0eb707). \nWhatshap was run as follows:\n\n```\nwhatshap \\\n    phase \\\n\t--only-snvs \\\n\t-o phased.vcf \\\n\t--ignore-read-groups \\\n\t--reference=hg38.fna \\\n\thg002.wf_snp.vcf.gz \\\n\tinput.bam\n```\nThis matches [wf-human-variation workflow's ``--phase`` option](https://github.com/epi2me-labs/wf-human-variation/blob/036d1ac08ce5abb751463e385eb9b611ac43096d/modules/local/wf-human-snp.nf#L507).\n\nHapcut was run as follows:\n```\nextractHAIRS \\\n\t--bam input.bam \\\n\t--vcf hg002.wf_snp.vcf \\\n\t--ref hg38.fa \\\n\t--ont 1 \\\n\t--out out_fragment\nHAPCUT2 \\\n\t--fragments out_fragment \\\n\t--VCF hg002.wf_snp.vcf \\\n\t--output out_final\n```\n\nReference genome was the GCA_000001405.15 no-alt analysis set.\nPomfret was ran as follows:\n```\npomfret \\\n\tmethphase \\\n\t-o output \\\n\t--vcf phased.vcf.gz \\\n\t-u \\\n\t-t 32 \\\n\tinput.bam\n```\n\nThis command assumes the input BAM is not haplotagged and performs tagging as a preprocessing step.\n``pomfret methphase -t32`` runs took 20-30 minutes with peak memory around 2.5GiB. \n\nFor evaluation, ``whatshap`` was run as follows:\n```\nwhatshap \\\n\tcompare \\\n\t--names truth,phased \\\n\t--ploidy 2 \\\n\t--ignore-sample-name \\\n\t--only-snvs \\\n\t--tsv-pairwise compare.tsv \\\n\tref.vcf \\\n\tin.vcf\nwhatshap \\\n\tstats \\\n\t--tsv stats.tsv \\\n\tin.vcf\n```\n\nThe reference VCF was GIAB's HG002 T2TQ100-V1.1 VCF.\n\n|dataset    | phasing  | phase block N50| switch error rate|\n|:----      |:------   | :------             | :------             |\n|combined-hac-30x | whatshap | 0.69Mb | 0.128%|\n|combined-hac-30x | pomfret-whatshap | 1.52Mb | 0.127%|\n|combined-hac-60x | whatshap | 1.00Mb | 0.121%|\n|combined-hac-60x | pomfret-whatshap | 2.74Mb | 0.121%|\n|combined-sup-30x | whatshap | 0.77Mb | 0.103%|\n|combined-sup-30x | pomfret-whatshap | 1.45Mb | 0.104%|\n|combined-sup-60x | whatshap | 1.00Mb | 0.115%|\n|combined-sup-60x | pomfret-whatshap | 2.19Mb | 0.116%|\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnanoporetech%2Fpomfret","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnanoporetech%2Fpomfret","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnanoporetech%2Fpomfret/lists"}