gaftools 1.2.0__tar.gz → 1.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gaftools-1.2.0 → gaftools-1.3.0}/CHANGES.rst +17 -0
- {gaftools-1.2.0/gaftools.egg-info → gaftools-1.3.0}/PKG-INFO +2 -1
- {gaftools-1.2.0 → gaftools-1.3.0}/docs/guide.rst +63 -32
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools/_version.py +16 -3
- gaftools-1.3.0/gaftools/cli/find_path.py +107 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools/cli/gfa2rgfa.py +121 -82
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools/cli/order_gfa.py +195 -65
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools/cli/realign.py +80 -71
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools/cli/sort.py +3 -2
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools/gfa.py +52 -14
- {gaftools-1.2.0 → gaftools-1.3.0/gaftools.egg-info}/PKG-INFO +2 -1
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools.egg-info/SOURCES.txt +1 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools.egg-info/requires.txt +1 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/pyproject.toml +1 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/find_path-output.fasta +0 -4
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/graph-conversioncheck-gfa-invertednodes.gfa +1 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/graph-conversioncheck-gfa-partial-tagged.gfa +1 -0
- gaftools-1.3.0/tests/data/graph-conversioncheck-gfa-wrong-Wline-order.gfa +89 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/graph-conversioncheck-gfa.gfa +1 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/graph-conversioncheck-rgfa.gfa +1 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/test_find_path.py +4 -1
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/test_gfa2rgfa.py +50 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/test_run_ordergfa.py +5 -1
- {gaftools-1.2.0 → gaftools-1.3.0}/tox.ini +1 -1
- gaftools-1.2.0/gaftools/cli/find_path.py +0 -65
- {gaftools-1.2.0 → gaftools-1.3.0}/.attic/.vcf_based_sorting_scripts/add-bubble-info.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/.attic/.vcf_based_sorting_scripts/bubble-sort.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/.attic/bicc_networkx.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/.attic/find_bubbles.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/.attic/graph.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/.attic/sort.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/.github/workflows/ci.yml +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/.gitignore +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/.pre-commit-config.yaml +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/.readthedocs.yaml +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/LICENSE +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/MANIFEST.in +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/README.md +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/docs/Makefile +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/docs/README.rst +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/docs/_static/bo_tags.png +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/docs/_static/no_tags.png +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/docs/changes.rst +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/docs/conf.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/docs/develop.rst +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/docs/index.rst +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/docs/installation.rst +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/docs/requirements.txt +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools/.gitignore +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools/__init__.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools/__main__.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools/args.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools/cli/__init__.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools/cli/index.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools/cli/phase.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools/cli/stat.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools/cli/view.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools/conversion.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools/gaf.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools/timer.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools/utils.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools.egg-info/dependency_links.txt +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools.egg-info/entry_points.txt +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/gaftools.egg-info/top_level.txt +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/requirements.txt +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/scripts/split_graph.sh +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/setup.cfg +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/setup.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/alignments-graphaligner.gaf +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/alignments-graphaligner.gaf.gz +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/alignments-minigraph-reversed-reads-stable.gaf +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/alignments-minigraph-reversed-reads-unstable.gaf +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/alignments-minigraph-stable-conversioncheck-only-s2.gaf +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/alignments-minigraph-stable-conversioncheck-only-s464827.gaf +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/alignments-minigraph-stable-conversioncheck.gaf +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/alignments-minigraph-stable-conversioncheck.gaf.gvi +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/alignments-minigraph-stable-conversioncheck.gaf.gz +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/alignments-minigraph-stable-conversioncheck.gaf.gz.gvi +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/alignments-minigraph-stable.gaf +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/alignments-minigraph-unstable-conversioncheck-only-s2.gaf +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/alignments-minigraph-unstable-conversioncheck-only-s464827.gaf +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/alignments-minigraph-unstable-conversioncheck.gaf +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/alignments-minigraph-unstable-conversioncheck.gaf.gvi +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/alignments-minigraph-unstable-conversioncheck.gaf.gz +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/alignments-minigraph-unstable-conversioncheck.gaf.gz.gvi +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/alignments-minigraph-unstable.gaf +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/alignments-more-graphaligner.gaf +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/alignments-more-graphaligner.gaf.gz +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/find_path-input.txt +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/graph-conversioncheck-assembly-BAR.1.fa +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/graph-conversioncheck-assembly-BAR.2.fa +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/graph-conversioncheck-assembly-BAZ.1.fa +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/graph-conversioncheck-assembly-BAZ.2.fa +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/graph-conversioncheck-assembly-FOO.1.fa +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/graph-conversioncheck-assembly-FOO.2.fa +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/graph-conversioncheck-assembly-REF.fa +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/graph-conversioncheck-samples.seqfile +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/large-graph-chr1.gfa.gz +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/reads-conversioncheck.fa +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/reads-more.fa +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/reads-reversed.fa +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/reads.fa +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/reads.fa.fai +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/smallgraph-noseq.gfa +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/smallgraph-ordered.gfa +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/smallgraph.gfa +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/smallgraph_withN.gfa +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/test_GFA_class.gfa +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/data/test_GFA_class_wrong_graph.gfa +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/test_extract_path.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/test_gaf.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/test_gaf_gzipped.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/test_gfa_class.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/test_index.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/test_parsegaf_tags.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/test_run_realign.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/test_run_stat.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/test_sort.py +0 -0
- {gaftools-1.2.0 → gaftools-1.3.0}/tests/test_view.py +0 -0
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
Changes
|
|
2
2
|
=======
|
|
3
3
|
|
|
4
|
+
v1.3.0 (06/11/2025)
|
|
5
|
+
-------------------
|
|
6
|
+
|
|
7
|
+
* Minor updates to :code:`find_path` for improved error handling when given paths are invalid.
|
|
8
|
+
* Fixed timer issue in :code:`gfa2rgfa` subcommand. Now reports more accurate time.
|
|
9
|
+
* Minor fixes to :code:`gfa2rgfa` regarding parsing of S lines and handling of temporary files.
|
|
10
|
+
* Major addition to :code:`order_gfa` subcommand to allow handling of branched graphs. Now users can provide :code:`--ignore-branching` flag to create a ordering even when the graph has a branched structure.
|
|
11
|
+
* Addition of :code:`--output-scaffold` flag in :code:`order_gfa` subcommand to output the scaffold graph in GFA format. This graph has bubbles collapsed into single nodes to better visualise the scaffold structure.
|
|
12
|
+
|
|
13
|
+
v1.2.1 (08/09/2025)
|
|
14
|
+
-------------------
|
|
15
|
+
|
|
16
|
+
* Updated :code:`gaftools gfa2rgfa` subcommand to no longer require :code:`seqfile` by default. The default behaviour is to use the order of assemblies as given in the GFA file.
|
|
17
|
+
* Fixing the time logger issue with :code:`gaftools realign` subcommand.
|
|
18
|
+
* Bug fix in the index file created by :code:`gaftools sort` subcommand. The index file was incorrectly skipping the first alignment record.
|
|
19
|
+
* Minor updates to documentation regarding :code:`seqfile` in :code:`gaftools gfa2rgfa` subcommand.
|
|
20
|
+
|
|
4
21
|
v1.2.0 (03/07/2025)
|
|
5
22
|
-------------------
|
|
6
23
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gaftools
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Toolkit for pangenome alignments
|
|
5
5
|
Author: Arda Soylev, Fawaz Dabbaghie, Tobias Marschall
|
|
6
6
|
Author-email: Samarendra Pani <samarendra.pani@hhu.de>
|
|
@@ -26,6 +26,7 @@ Requires-Dist: pytest; extra == "dev"
|
|
|
26
26
|
Requires-Dist: coverage; extra == "dev"
|
|
27
27
|
Requires-Dist: tox; extra == "dev"
|
|
28
28
|
Requires-Dist: ruff; extra == "dev"
|
|
29
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
29
30
|
Requires-Dist: sphinx; extra == "dev"
|
|
30
31
|
Requires-Dist: sphinx-issues; extra == "dev"
|
|
31
32
|
Requires-Dist: sphinx-rtd-theme; extra == "dev"
|
|
@@ -76,26 +76,32 @@ This subcommand retrieves the base seqeunce of paths in the given GFA.
|
|
|
76
76
|
Usage
|
|
77
77
|
-----
|
|
78
78
|
|
|
79
|
-
The :code:`find_path` subcommand takes 2 obligatory inputs, a GFA file and node path (
|
|
79
|
+
The :code:`find_path` subcommand takes 2 obligatory inputs, a GFA file and either a node path :code:`-p, --path` (e.g., :code:`">s82312<s82313"` (with the quotes))
|
|
80
|
+
or file path which has node paths each on a separate line with :code:`--paths_file`.
|
|
80
81
|
It returns the sequence of the path(s) by default but using the :code:`--fasta` flag, the sequences will be returned as a FASTA file.
|
|
81
82
|
|
|
83
|
+
If one of the paths does not exist, the process will terminate, the user can use :code:`-k, --keep-going` to skip the paths that do not exist and continue with the next path if available.
|
|
84
|
+
|
|
82
85
|
.. code-block::
|
|
83
86
|
:caption: find_path arguments
|
|
84
87
|
|
|
85
|
-
|
|
88
|
+
usage: gaftools find_path [-h] [-p PATH] [--paths_file PATHS_FILE] [-k] [-o OUTPUT] [-f] GFA
|
|
86
89
|
|
|
87
|
-
|
|
90
|
+
Find the genomic sequence of a given connected GFA path.
|
|
88
91
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
path GFA node path to retrieve the sequence (e.g., ">s82312<s82313") OR a filepath containing node paths in different lines
|
|
92
|
-
|
|
93
|
-
optional arguments:
|
|
94
|
-
-h, --help show this help message and exit
|
|
95
|
-
-o OUTPUT, --output OUTPUT
|
|
96
|
-
Output file. If omitted, use standard output.
|
|
97
|
-
-f, --fasta Flag to output the sequence as a FASTA file with the seqeunce named seq_<node path>
|
|
92
|
+
positional arguments:
|
|
93
|
+
GFA GFA file (can be bgzip-compressed)
|
|
98
94
|
|
|
95
|
+
options:
|
|
96
|
+
-h, --help show this help message and exit
|
|
97
|
+
-p PATH, --path PATH GFA node path to retrieve the sequence (e.g., ">s82312<s82313") with the quotes
|
|
98
|
+
--paths_file PATHS_FILE
|
|
99
|
+
File containing the paths to retrieve the sequences for, each path on new line
|
|
100
|
+
-k, --keep-going Keep going after instead of stopping when a path does not exist
|
|
101
|
+
-o OUTPUT, --output OUTPUT
|
|
102
|
+
Output file. If omitted, use standard output.
|
|
103
|
+
-f, --fasta Flag to output the sequence as a FASTA file with the seqeunce named seq_<node path>
|
|
104
|
+
gaftools error: the following arguments are required: GFA
|
|
99
105
|
|
|
100
106
|
.. _gaftools-gfa2rgfa:
|
|
101
107
|
|
|
@@ -104,10 +110,14 @@ gaftools gfa2rgfa
|
|
|
104
110
|
|
|
105
111
|
This subcommand creates rGFA equivalent of GFA files using the W lines present in the GFA.
|
|
106
112
|
|
|
107
|
-
For creating the rGFA tags for all the reference nodes, the minimum requirements (as specified below) should be given.
|
|
113
|
+
For creating the rGFA tags for all the reference nodes, the minimum requirements (as specified below) should be given. We assume that the pangenome graph is based on a pangenome reference (as is the case with minigraph-based graph constructions methods).
|
|
114
|
+
|
|
115
|
+
For further tagging the non-reference nodes coming from assemblies added to the reference assembly, the :code:`seqfile` can be provided and corresponding W lines should be available in the GFA (refer to 'Format of seqfile').
|
|
116
|
+
If the :code:`seqfile` is not provided, then the order in which walks are given in the GFA will be used to tag the non-reference nodes. Users can provide their own order of assemblies in the seqfile, and the coordinates will be generated accordingly.
|
|
117
|
+
|
|
118
|
+
**Note**: If the proper :code:`seqfile` is not provided, the tagging will not be show the coordinates intended by the graph creator since the order of assemblies might be different.
|
|
108
119
|
|
|
109
|
-
|
|
110
|
-
If this information is not provided, then the non-reference nodes will be tagged with non-informative dummy tags to technically follow the format.
|
|
120
|
+
Any node not found in the W lines will be tagged with the :code:`SN` tag as `unknown`, the :code:`SO` tag as `0`, and the :code:`SN` tag as `-1`.
|
|
111
121
|
|
|
112
122
|
If the GFA already has the reference nodes tagged (as is the case of the GFA generated by minigraph-cactus), then the :code:`--reference-tagged` flag can be provided and they will not be retagged.
|
|
113
123
|
|
|
@@ -115,7 +125,9 @@ Minimum Requirements
|
|
|
115
125
|
--------------------
|
|
116
126
|
|
|
117
127
|
* The GFA should have a W line corresponding to the reference name provided as part of the command (using :code:`--reference-name`).
|
|
118
|
-
* The path described by the W line should be cycle-free and oriented in the forward direction (path of the format :code:`>node_1>node_2....>node_N`)
|
|
128
|
+
* The reference path described by the W line should be cycle-free and oriented in the forward direction (path of the format :code:`>node_1>node_2....>node_N`)
|
|
129
|
+
|
|
130
|
+
Note: From the Human Pangenome Reference Consortium, the graphs generated using minigraph-cactus follow these requirements. The PGGB graphs do not.
|
|
119
131
|
|
|
120
132
|
Format of seqfile
|
|
121
133
|
-----------------
|
|
@@ -127,6 +139,10 @@ The assembly names should be of the form :code:`<sample name>.<assembly number>`
|
|
|
127
139
|
|
|
128
140
|
In the case that the assembly is not based on a sample (as is the case of the chm13-minigraph-cactus graph which has a W line for GRCh38 added later and vice-versa for the grch38-minigraph-catus graph), the seqfile should contain a line for :code:`GRCh38` and GFA should have a corresponding W line of format :code:`W <tab> GRCh38 <tab> 0 ...`
|
|
129
141
|
|
|
142
|
+
Users can provide their own order of assemblies and the coordinates will be generated accordingly. The reference path should be cycle-free.
|
|
143
|
+
|
|
144
|
+
**Note**: The code does not require the actual assemblies. So the assemblies provided in the seqfile do not need to be downloaded.
|
|
145
|
+
|
|
130
146
|
|
|
131
147
|
Usage
|
|
132
148
|
-----
|
|
@@ -138,19 +154,19 @@ The :code:`gfa2rgfa` subcommand takes 1 obligatory input, a GFA file. It creates
|
|
|
138
154
|
|
|
139
155
|
usage: gaftools gfa2rgfa [-h] [--reference-name REFERENCE NAME] [--reference-tagged] [--seqfile SEQFILE] [--output GFA] GFA
|
|
140
156
|
|
|
141
|
-
Converting a GFA file to rGFA format using the W-lines
|
|
157
|
+
Converting a GFA file to rGFA format using the W-lines and the acyclic reference path. (e.g., minigraph-based graphs).
|
|
142
158
|
|
|
143
159
|
positional arguments:
|
|
144
|
-
GFA
|
|
160
|
+
GFA GFA file (can be bgzip-compressed). This GFA should have a W-line corresponding to the reference genome or the
|
|
161
|
+
reference nodes have to be tagged already.
|
|
145
162
|
|
|
146
|
-
|
|
163
|
+
options:
|
|
147
164
|
-h, --help show this help message and exit
|
|
148
165
|
--reference-name REFERENCE NAME
|
|
149
166
|
The name of the reference genome given in the W-line. Default: CHM13
|
|
150
167
|
--reference-tagged Flag to denote reference nodes are already tagged in the GFA.
|
|
151
|
-
--seqfile SEQFILE File containing the sequence in which assemblies were given. Provide the seqfile given as part of running minigraph-cactus. It has the format: <assembly_name><tab><assembly_path
|
|
152
|
-
|
|
153
|
-
--output GFA Output rGFA (Automatically bgzipped if the file ends with .gz). If omitted, use standard output.
|
|
168
|
+
--seqfile SEQFILE File containing the sequence in which assemblies were given. Provide the seqfile given as part of running minigraph-cactus (only the first column is required). It has the format: <assembly_name><tab><assembly_path>. If not provided, the order of assemblies will be taken from the GFA file. User-defined order of assemblies can also be given. There should be W lines for each assembly in the GFA.
|
|
169
|
+
--output rGFA Output rGFA (bgzipped if the file ends with .gz). If omitted, use standard output.
|
|
154
170
|
|
|
155
171
|
|
|
156
172
|
.. _gaftools-index:
|
|
@@ -233,6 +249,14 @@ have a NO tag of 0, and the nodes inside a bubble are marked with an increasing
|
|
|
233
249
|
|
|
234
250
|
Note: The :code:`order_gfa` subcommand does not change the name of the nodes and only adds the BO and NO tags as additional information.
|
|
235
251
|
|
|
252
|
+
|
|
253
|
+
Non-linear scaffold graphs:
|
|
254
|
+
---------------------------
|
|
255
|
+
|
|
256
|
+
In the cases where after collapsing the bi-connected component, the scaffold graph is not a line graph, the user can use
|
|
257
|
+
:code:`--ignore-branching` to enforce an ordering where only the linear traversals in the scaffold graph where the articulation points
|
|
258
|
+
have an SN tag matching the reference will be ordered and branches that belong to other haplotypes will be ignored, i.e., give BO and NO tag of -1.
|
|
259
|
+
|
|
236
260
|
Usage
|
|
237
261
|
-----
|
|
238
262
|
The :code:`order_gfa` subcommand takes an rGFA as an obligatory input to order.
|
|
@@ -247,19 +271,26 @@ their BO tag then NO tag, also will output a CSV file with node colors similar t
|
|
|
247
271
|
.. code-block::
|
|
248
272
|
:caption: order_gfa arguments
|
|
249
273
|
|
|
250
|
-
|
|
274
|
+
usage: gaftools order_gfa [-h] [--chromosome-order CHROMOSOME_ORDER] [--without-sequence] [--outdir OUTDIR] [--by-chrom] [--ignore-branching] [--output_scaffold] GRAPH
|
|
251
275
|
|
|
252
|
-
|
|
253
|
-
GRAPH Input rGFA file
|
|
276
|
+
Order bubbles in the GFA by adding BO and NO tags.
|
|
254
277
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
--outdir OUTDIR Output Directory to store all the GFA and CSV files. Default location is a "out" folder from the directory of execution.
|
|
261
|
-
--by-chrom Outputs each chromosome as a separate GFA, otherwise, all chromosomes in one GFA file
|
|
278
|
+
The BO (Bubble Order) tags order bubbles in the GFA.
|
|
279
|
+
The NO (Node Order) tags order the nodes in a bubble (in a lexicographic order).
|
|
280
|
+
|
|
281
|
+
positional arguments:
|
|
282
|
+
GRAPH Input rGFA file
|
|
262
283
|
|
|
284
|
+
options:
|
|
285
|
+
-h, --help show this help message and exit
|
|
286
|
+
--chromosome-order CHROMOSOME_ORDER
|
|
287
|
+
Order in which to arrange chromosomes in terms of BO sorting. By default, it is arranged in the lexicographic order of identified component names. Expecting comma-separated list. Example: 'chr1,chr2,chr3'
|
|
288
|
+
--without-sequence Strip sequences from the output graph (for less memory usage and easier visualization). Default = False
|
|
289
|
+
--outdir OUTDIR Output Directory to store all the GFA and CSV files. Default location is a "out" folder from the directory of execution.
|
|
290
|
+
--by-chrom Outputs each chromosome as a separate GFA, otherwise, all chromosomes in one GFA file
|
|
291
|
+
--ignore-branching Force the order even when branching paths occur in the scaffold graph. Alternative alleles will not be ordered
|
|
292
|
+
--output_scaffold Output the scaffold graph in GFA format. The scaffold graph is the graph created from collapsing all the biconnected components.
|
|
293
|
+
gaftools error: the following arguments are required: GRAPH
|
|
263
294
|
|
|
264
295
|
.. _gaftools-phase:
|
|
265
296
|
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
# file generated by setuptools-scm
|
|
2
2
|
# don't change, don't track in version control
|
|
3
3
|
|
|
4
|
-
__all__ = [
|
|
4
|
+
__all__ = [
|
|
5
|
+
"__version__",
|
|
6
|
+
"__version_tuple__",
|
|
7
|
+
"version",
|
|
8
|
+
"version_tuple",
|
|
9
|
+
"__commit_id__",
|
|
10
|
+
"commit_id",
|
|
11
|
+
]
|
|
5
12
|
|
|
6
13
|
TYPE_CHECKING = False
|
|
7
14
|
if TYPE_CHECKING:
|
|
@@ -9,13 +16,19 @@ if TYPE_CHECKING:
|
|
|
9
16
|
from typing import Union
|
|
10
17
|
|
|
11
18
|
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
19
|
+
COMMIT_ID = Union[str, None]
|
|
12
20
|
else:
|
|
13
21
|
VERSION_TUPLE = object
|
|
22
|
+
COMMIT_ID = object
|
|
14
23
|
|
|
15
24
|
version: str
|
|
16
25
|
__version__: str
|
|
17
26
|
__version_tuple__: VERSION_TUPLE
|
|
18
27
|
version_tuple: VERSION_TUPLE
|
|
28
|
+
commit_id: COMMIT_ID
|
|
29
|
+
__commit_id__: COMMIT_ID
|
|
19
30
|
|
|
20
|
-
__version__ = version = '1.
|
|
21
|
-
__version_tuple__ = version_tuple = (1,
|
|
31
|
+
__version__ = version = '1.3.0'
|
|
32
|
+
__version_tuple__ = version_tuple = (1, 3, 0)
|
|
33
|
+
|
|
34
|
+
__commit_id__ = commit_id = 'g526aa31b3'
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Find the genomic sequence of a given connected GFA path.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import logging
|
|
6
|
+
import sys
|
|
7
|
+
import os
|
|
8
|
+
from gaftools.cli import log_memory_usage
|
|
9
|
+
from gaftools.timer import StageTimer
|
|
10
|
+
from gaftools.gfa import GFA
|
|
11
|
+
from gaftools.utils import FileWriter
|
|
12
|
+
|
|
13
|
+
logger = logging.getLogger(__name__)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def run(gfa_path, path=None, paths_file=None, keep_going=True, output=None, fasta=False):
|
|
17
|
+
timers = StageTimer()
|
|
18
|
+
|
|
19
|
+
if not path and not paths_file:
|
|
20
|
+
logger.error("Either an input path (--p, --path) or (--paths_file) must be specified")
|
|
21
|
+
sys.exit(1)
|
|
22
|
+
|
|
23
|
+
logger.info(f"Reading GFA file {gfa_path}")
|
|
24
|
+
graph = GFA(gfa_path)
|
|
25
|
+
if path:
|
|
26
|
+
if path[0] in [">", "<"]:
|
|
27
|
+
# detected node path
|
|
28
|
+
nodes = [path]
|
|
29
|
+
seq = graph.extract_path(path)
|
|
30
|
+
if not seq:
|
|
31
|
+
if keep_going:
|
|
32
|
+
logger.warning(
|
|
33
|
+
f"The path {path} does not exist in the GFA, will keep going to next path if given"
|
|
34
|
+
)
|
|
35
|
+
else:
|
|
36
|
+
logger.error(f"The path {path} does not exist in the GFA")
|
|
37
|
+
sys.exit(1)
|
|
38
|
+
|
|
39
|
+
path_seqs = [seq]
|
|
40
|
+
else:
|
|
41
|
+
logger.error(f"The input path {path} is not a valid node path")
|
|
42
|
+
sys.exit(1)
|
|
43
|
+
|
|
44
|
+
else:
|
|
45
|
+
if os.path.exists(paths_file):
|
|
46
|
+
# detected file
|
|
47
|
+
reader = open(paths_file, "r")
|
|
48
|
+
nodes = []
|
|
49
|
+
path_seqs = []
|
|
50
|
+
for line in reader:
|
|
51
|
+
nodes.append(line.strip())
|
|
52
|
+
seq = graph.extract_path(nodes[-1])
|
|
53
|
+
if not seq:
|
|
54
|
+
if keep_going:
|
|
55
|
+
logger.warning(
|
|
56
|
+
f"The path {line} does not exist in the GFA, will keep going to next path if given"
|
|
57
|
+
)
|
|
58
|
+
else:
|
|
59
|
+
logger.error(f"The path {line} does not exist in the GFA")
|
|
60
|
+
sys.exit(1)
|
|
61
|
+
path_seqs.append(seq)
|
|
62
|
+
reader.close()
|
|
63
|
+
else:
|
|
64
|
+
logger.error(f"The input file {paths_file} does not exist")
|
|
65
|
+
sys.exit(1)
|
|
66
|
+
|
|
67
|
+
writer = FileWriter(output)
|
|
68
|
+
if fasta:
|
|
69
|
+
for node, path_seq in zip(nodes, path_seqs):
|
|
70
|
+
if path_seq:
|
|
71
|
+
writer.write(f">seq_{node}\n")
|
|
72
|
+
writer.write(f"{path_seq}\n")
|
|
73
|
+
else:
|
|
74
|
+
for node, path_seq in zip(nodes, path_seqs):
|
|
75
|
+
if path_seq:
|
|
76
|
+
writer.write(f"{path_seq}\n")
|
|
77
|
+
|
|
78
|
+
writer.close()
|
|
79
|
+
|
|
80
|
+
logger.info("\n== SUMMARY ==")
|
|
81
|
+
total_time = timers.total()
|
|
82
|
+
log_memory_usage()
|
|
83
|
+
logger.info("Total time: %9.2f s", total_time)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# fmt:off
|
|
87
|
+
def add_arguments(parser):
|
|
88
|
+
arg = parser.add_argument
|
|
89
|
+
# Positional arguments
|
|
90
|
+
arg("gfa_path", metavar="GFA",
|
|
91
|
+
help="GFA file (can be bgzip-compressed)")
|
|
92
|
+
arg("-p", "--path", default=None,
|
|
93
|
+
help='GFA node path to retrieve the sequence (e.g., ">s82312<s82313") with the quotes')
|
|
94
|
+
arg("--paths_file", default=None,
|
|
95
|
+
help="File containing the paths to retrieve the sequences for, each path on new line")
|
|
96
|
+
arg("-k", "--keep-going", action="store_true",
|
|
97
|
+
help="Keep going after instead of stopping when a path does not exist")
|
|
98
|
+
arg("-o", "--output", default=None,
|
|
99
|
+
help="Output file. If omitted, use standard output.")
|
|
100
|
+
arg("-f", "--fasta", action="store_true",
|
|
101
|
+
help="Flag to output the sequence as a FASTA file with the seqeunce named seq_<node path>")
|
|
102
|
+
|
|
103
|
+
# fmt:on
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def main(args):
|
|
107
|
+
run(**vars(args))
|