crystal-facets

crystal facets

Crystal implementation of FACETS as a command-line tool.

Status

  • Crystal only
  • CLI first
  • Internal snp-pileup based on HTSlib
  • Baseline implementations of preprocessing, segmentation, clustering, and CN fitting

Install

shards build --release

Commands

Show help:

bin/facets help

Generate FACETS pileup CSV from VCF and BAM or CRAM input:

bin/facets pileup sites.vcf normal.bam tumor.bam -o sample.csv

Run preprocessing and write jointseg TSV:

bin/facets preproc sample.csv.gz -o jointseg.tsv --pmat pmat.tsv

Run preprocessing and segment summarization:

bin/facets proc-sample sample.csv.gz -o segments.tsv --jointseg jointseg.tsv

Input

The minimum required columns for SNP matrix input are:

  • chrom
  • pos

Accepted aliases:

  • chrom, chr, chromosome
  • pos, position, loc

Typical optional columns:

  • nor_dp
  • nor_rd
  • tum_dp
  • tum_rd
  • vaf_n
  • vaf_t
  • gcpct

FACETS pileup CSV input is also supported.

Library

require "./src/facets"

table = Facets::IO::ReadSnpMatrix.read("example.csv")
result = Facets::Preprocess::PreProcSample.call(table)
pp result.jointseg.chrom_ranges

rows = Facets::IO::SnpPileup.call("sites.bcf", ["normal.bam", "tumor.bam"])
pp rows.first.to_csv_line
Repository

crystal-facets

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 0
  • 6 days ago
  • April 13, 2026
License

MIT License

Links
Synced at

Mon, 13 Apr 2026 14:21:04 GMT

Languages