parfait-gfa

Crates.ioparfait-gfa
lib.rsparfait-gfa
version0.1.3
created_at2025-10-22 23:17:54.503406+00
updated_at2026-01-14 05:31:04.458343+00
descriptiongfa v1/v2 parser and validator
homepage
repositoryhttps://github.com/0w0x/parfait-gfa
max_upload_size
id1896388
size208,286
(0w0x)

documentation

README

parfait-gfa

a gfa v1 and v2 parser with validation and error reporting. originally built for the parfait gfa visualisation tool, but can be used standalone as an executable or crate.

currently a work in progress; the api is not stable. please open issues for any features you would like to see.

usage (cli)

prints any errors and shows file stats

parfait-gfa path/to/file.gfa

example (crate)

use parfait_gfa::gfa::{GfaParser, ParseOptions, GFAVersion};
use parfait_gfa::optional_field::OptionalFieldValue;

let mut gfa = GfaParser::new();

// parse a gfa file
let result = gfa.parse("path/to/file.gfa", &ParseOptions::default());

match result {
  Ok(_) => println!("Parsed successfully"),
  Err(errors) => println!("Failed to parse file"),
}

// add an integer tag "ab" with value 12345 to all segments
for segment in gfa.segments_mut() {
    segment.tags.add_tag("ab", OptionalFieldValue::Int(12345));
}

// write the modified GFA to a new file
let _ = gfa.write_to_file("file_with_ab_tags.gfa", GFAVersion::V2);

missing features

  • groups cannot be derived into paths (they are still are parsed/validated)
  • jump connections in walks are ignored, any valid link/jump is accepted
  • optional field tags that use JSON are parsed as strings
  • path/walk parsing isn't very efficient and may be slow on large files
  • error messages are missing context in most cases

licence

MIT

Commit count: 14

cargo fmt