Provides tools for extracting segment paths from Graphical Fragment Assembly ('GFA') and Graph Alignment Format ('GAF') files. parse_paths_gfa() reads P (path) and W (walk) records and returns a named list of segment identifiers for each accession. parse_paths_gaf() parses the path string from each alignment and returns a named list of segments traversed by each query. parse_segment_lengths_gfa() reads S records and returns a named list of segment lengths keyed by segment identifier. These tools are intended to simplify downstream interpretation and analysis of pangenome graphs.
An R package for parsing GAF and GFA files, allowing easier interpretation and pangenomic analysis.
# install.packages("remotes")
remotes::install_github("cromazurek/MatchAlign")
GFA (Graphical Fragment Assembly) files encode the variation captured by pangenome graphs. parse_paths_gfa() extracts the segment path for each accession from P (path) and W (walk) lines.
library(MatchAlign)
accession_paths <- parse_paths_gfa("path/to/example.gfa")
# Returns named list: each accession represented as vector of segment names
accession_paths[["CM294333.1"]]
#> [1] "2+" "3+" "4+" "6+" "7+" "9+" "10+"
GAF (Graph Alignment Format) files store alignments of sequences to a pangenome graph. parse_paths_gaf() extracts the segments traversed by each alignment.
alignment_paths <- parse_paths_gaf("path/to/example.gaf")
# Returns a named list: read name -> vector of segment names
alignment_paths[["A01127:121:HCLF5DRX5:2:2203:13579:24680"]]
#> [1] "5001" "5002" "5003" "5004" "5005" "5006" "5007"
P lines (column 2 = accession name, column 3 = comma-separated segments) and W lines (key = sample#hap_index#seq_id, column 7 = >/<-delimited walk) are supported.>seg1>seg2<seg3).