Skip to content

Beifang/rhtype-skill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RHtyper Blood Group Genotyping Skill

This skill is designed for AI agents (e.g. Biomni/Phylo) to run automatically. The user only needs to provide a BAM file path — the agent handles everything else.


What This Skill Does

Predicts RHD and RHCE Rh blood group genotypes from short-read whole-genome or whole-exome sequencing (WGS/WES) BAM files, using RHtyper v1.1.

The agent will automatically:

  1. Create an isolated conda environment (Python 3.7 + RHtyper 1.1 + XGBoost <1.0)
  2. Apply upstream bug patches to RHtyper (bare-name chromosome support for hg19)
  3. Validate the BAM file and estimate RH locus coverage
  4. Run RHtyper and collect all output files
  5. Return a natural-language genotype report with clinical interpretation

Supported genome builds: hg38, hg19 (both chr1 and bare 1 naming styles) Supported data types: WGS, WES Research use only — not validated for clinical diagnostic decisions.


Minimal Test Prompts

Copy any of the following prompts to test the skill with a public BAM file:

hg19 (30x WGS, GIAB NA12878, public)

Please run Rh blood group genotyping on this BAM file (hg19, WGS):
https://ftp-trace.ncbi.nlm.nih.gov/ReferenceSamples/giab/data/NA12878/NIST_NA12878_HG001_HiSeq_300x/RMNISTHS_30xdownsample.bam

Local file (simplest)

Please run RHD/RHCE blood group genotyping on /data/patient001.bam (hg38, WGS).

How to Register This Skill on Biomni/Phylo

Any Biomni user can register this skill into their own account in three steps:

  1. Get the skill package — clone or download this repository.
  2. Open a new Biomni conversation and send the contents of SKILL.md to the agent with the message:
    Please register the following skill to my account:
    <paste SKILL.md content here>
    
  3. Confirm — the agent will call WriteSkill and save it. From that point on, Biomni will automatically recognize Rh genotyping requests and invoke this skill without any further action from the user.

Note: The skill package (scripts/, assets/, references/) must be accessible to the agent's execution environment at runtime. Place it in a directory the agent can reach, or upload it via the platform's file interface.


How This Skill Is Invoked

On Biomni/Phylo

Once registered, the skill is listed in the agent's skill index. Biomni reads the description field at the start of each conversation. When a user request semantically matches keywords such as "Rh blood group", "RHD/RHCE", "BAM genotyping", or "sickle cell blood group compatibility", the agent automatically loads the full SKILL.md guidance and executes the pipeline.

You do not need to say "use the RHtyper skill" — just describe what you want.

The agent recognizes requests like:

  • "Run Rh blood group genotyping on this BAM"
  • "RHD/RHCE genotyping from WGS data"
  • "Rh blood group compatibility for sickle cell disease patient"
  • "Predict RH antigens from a BAM file"
  • "Alloimmunization risk assessment from WGS"

On other agent platforms (LangChain, AutoGen, etc.)

This skill is not automatically registered on other platforms. To use it:

  1. Copy the SKILL.md content into your agent's system prompt or tool description.
  2. Make the three scripts (setup_env.py, validate_bam.py, run_rhtyper.py) accessible to your agent's code execution environment.
  3. Ensure the assets/ directory (bundled reference FASTAs, environment.yml) is present alongside the scripts.

The scripts are self-contained and can be called from any Python-capable agent that has conda/mamba available.


Minimum Information Needed from the User

Field Required Example
BAM file path or URL Yes /data/sample.bam
Genome build Recommended hg38 or hg19 (default: hg38)
Data type Optional WGS or WES (default: WGS)

Expected Outputs

  • Predicted RHD and RHCE genotypes (allele names, ISBT nomenclature)
  • Clinical interpretation (D-positive/negative, variant antigen status)
  • Per-exon copy number profile (deletion detection)
  • Output files: .bloodtyping.txt, .bloodtyping.pdf, .exonCNV.txt

Validated Results

Sample Build Coverage Expected Result Status
NA12878 (GIAB) hg38 255x RHD: Deletion / RHD*01 ✓ PASS
NA12878 (GIAB) hg19 30x RHD: RHD*01 / RHD*01 ✓ PASS
HG00096 (1000G) hg19 4.4x Coverage QC FAIL ✓ PASS

Known Issues Fixed

RHtyper v1.1 contains two bugs that are automatically patched by this skill:

  1. chr/tarchr crash on hg19 bare-name BAMsValueError: invalid contig chr1 when the BAM uses SN:1 instead of SN:chr1. Fixed by patching 4 call sites in BGClf/accessory.py during environment setup.

  2. SameFileError when --work-dir and --output-dir point to the same path. Fixed in run_rhtyper.py.


License

MIT — see LICENSE

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages