| Crates.io | parfait-gfa |
| lib.rs | parfait-gfa |
| version | 0.1.3 |
| created_at | 2025-10-22 23:17:54.503406+00 |
| updated_at | 2026-01-14 05:31:04.458343+00 |
| description | gfa v1/v2 parser and validator |
| homepage | |
| repository | https://github.com/0w0x/parfait-gfa |
| max_upload_size | |
| id | 1896388 |
| size | 208,286 |
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.
prints any errors and shows file stats
parfait-gfa path/to/file.gfa
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);
MIT