GFA Import: Sequence Graph Name Not Derived from File (CLI & Python)
Problem
When importing a GFA file (via CLI or Python bindings), the sequence graph (aka block group) is always created with an empty name (""), unlike FASTA and GenBank imports which use the entry name from the file.
Comparison:
| Import Type |
CLI Block Group Name |
Python Block Group Name |
| GFA |
Always "" |
Always "" |
| FASTA |
From file (sequence name/ID) |
From file |
| GenBank |
From file (locus name) |
From file |
| Library |
CLI arg library_name |
Arg library_name |
Relevant code locations:
- CLI:
src/commands/import/gfa.rs:52 - passes "" to BlockGroup::create
- Python:
gen-python/src/imports.rs:80 - calls CLI function with empty name
Impact
This affects both CLI and Python users:
- All GFA-imported block groups have the same (empty) name
- Difficult to identify or query specific GFA imports afterward
- Inconsistent behavior compared to other import types
- Importing the same GFA file multiple times keeps adding more nodes and edges to the same object
Short-term Solution
Use the filename without extension as the default block group name, with an optional parameter to override it.
CLI changes (src/commands/import/gfa.rs):
- Add new CLI argument:
--graph-name (optional) to explicitly set the block group name
- If not provided, derive from filename:
Path::new(&path).file_stem().to_string_lossy()
Python bindings (gen-python/src/imports.rs):
- Add optional
graph_name: Option<String> parameter to import_gfa()
- Pass through to Rust function; derive from filename if not provided
Example Usage
CLI:
# Uses "my_design" as block group name (derived from filename)
gen import gfa my_design.gfa --sample s1
# Explicitly overrides block group name to "custom_name"
gen import gfa my_design.gfa --sample s1 --graph-name custom_name
Python:
# Uses "my_design" as block group name (derived from filename)
db.import_gfa("my_design.gfa", sample="s1")
# Explicitly overrides block group name to "custom_name"
db.import_gfa("my_design.gfa", sample="s1", graph_name="custom_name")
Related: Larger model renaming effort
The current --name flag for collection is confusing. What I'm hoping we conclude there will have us treating collections like filesystem paths with analogous navigation concepts (nesting, cd, pwd, ls). Reserving --name for the sequence graph name seems sensible, provided we have a good way to deal with multiple contigs per file.
GFA Import: Sequence Graph Name Not Derived from File (CLI & Python)
Problem
When importing a GFA file (via CLI or Python bindings), the sequence graph (aka block group) is always created with an empty name (
""), unlike FASTA and GenBank imports which use the entry name from the file.Comparison:
""""library_namelibrary_nameRelevant code locations:
src/commands/import/gfa.rs:52- passes""toBlockGroup::creategen-python/src/imports.rs:80- calls CLI function with empty nameImpact
This affects both CLI and Python users:
Short-term Solution
Use the filename without extension as the default block group name, with an optional parameter to override it.
CLI changes (
src/commands/import/gfa.rs):--graph-name(optional) to explicitly set the block group namePath::new(&path).file_stem().to_string_lossy()Python bindings (
gen-python/src/imports.rs):graph_name: Option<String>parameter toimport_gfa()Example Usage
CLI:
Python:
Related: Larger model renaming effort
The current --name flag for collection is confusing. What I'm hoping we conclude there will have us treating collections like filesystem paths with analogous navigation concepts (nesting, cd, pwd, ls). Reserving --name for the sequence graph name seems sensible, provided we have a good way to deal with multiple contigs per file.