GPatch 0.4.0__tar.gz → 0.5.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.
- {gpatch-0.4.0/src/gpatch.egg-info → gpatch-0.5.0}/PKG-INFO +46 -3
- {gpatch-0.4.0 → gpatch-0.5.0}/README.md +45 -2
- {gpatch-0.4.0 → gpatch-0.5.0}/setup.py +1 -1
- gpatch-0.5.0/src/GPatch/GPatch.py +900 -0
- {gpatch-0.4.0 → gpatch-0.5.0/src/gpatch.egg-info}/PKG-INFO +46 -3
- gpatch-0.4.0/src/GPatch/GPatch.py +0 -406
- {gpatch-0.4.0 → gpatch-0.5.0}/CODE_OF_CONDUCT.md +0 -0
- {gpatch-0.4.0 → gpatch-0.5.0}/LICENSE +0 -0
- {gpatch-0.4.0 → gpatch-0.5.0}/MANIFEST.in +0 -0
- {gpatch-0.4.0 → gpatch-0.5.0}/pyproject.toml +0 -0
- {gpatch-0.4.0 → gpatch-0.5.0}/requirements.txt +0 -0
- {gpatch-0.4.0 → gpatch-0.5.0}/setup.cfg +0 -0
- {gpatch-0.4.0 → gpatch-0.5.0}/src/GPatch/__init__.py +0 -0
- {gpatch-0.4.0 → gpatch-0.5.0}/src/GPatch/__main__.py +0 -0
- {gpatch-0.4.0 → gpatch-0.5.0}/src/gpatch.egg-info/SOURCES.txt +0 -0
- {gpatch-0.4.0 → gpatch-0.5.0}/src/gpatch.egg-info/dependency_links.txt +0 -0
- {gpatch-0.4.0 → gpatch-0.5.0}/src/gpatch.egg-info/entry_points.txt +0 -0
- {gpatch-0.4.0 → gpatch-0.5.0}/src/gpatch.egg-info/not-zip-safe +0 -0
- {gpatch-0.4.0 → gpatch-0.5.0}/src/gpatch.egg-info/requires.txt +0 -0
- {gpatch-0.4.0 → gpatch-0.5.0}/src/gpatch.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: gpatch
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: Assemble contigs into a chromosome-scalse pseudo-assembly using alignments to a reference sequence. Download the github repository for helper scripts to automate GPatch workflows, identify and correct misjoins in the contig assembly, produce dot-plots of patched pseudoassemblies to a reference assembly, and generate chrom.sizes and liftover chains for patched pseudoassemblies.
|
|
5
5
|
Home-page: https://github.com/adadiehl/GPatch
|
|
6
6
|
Author: Adam Diehl
|
|
@@ -40,7 +40,10 @@ Description: # GPatch
|
|
|
40
40
|
|
|
41
41
|
## Usage
|
|
42
42
|
```
|
|
43
|
-
GPatch.py [-h] -q SAM/BAM -r FASTA [-x STR] [-b FILENAME] [-m N] [-w PATH] [-d] [-s] [-l N] [-e] [-k]
|
|
43
|
+
GPatch.py [-h] -q SAM/BAM -r FASTA [-x STR] [-b FILENAME] [-m N] [-w PATH] [-d] [-t] [-s] [-l N] [-e] [-k]
|
|
44
|
+
[--legacy_junctions] [--max_resid N] [--chain_mapq N] [--chain_minlen N] [--chain_maxgap N]
|
|
45
|
+
[--chain_tol N] [--anchor N] [--min_overlap_identity F] [--indel_tol N] [--max_mm2_tests N]
|
|
46
|
+
[--win_min N] [--win_max N] [--minimap2 PATH] [--threads N]
|
|
44
47
|
```
|
|
45
48
|
|
|
46
49
|
Starting with alignments of contigs to a reference genome, produce a chromosome-scale pseudoassembly by patching gaps between mapped contigs with sequences from the reference. By default, reference chromosomes with no mapped contigs are printed to output unchanged. Use the --drop_missing option to disable this behavior. By default, patches are applied to the 5' and 3' telomere ends of pseudochromsomes if the first and last contig alignments do not extend to the start/end of the reference chromsome. In some cases, this may cause spurious duplications. Use the --no_extend option if this is a concern. Note that GPatch is designed to be run on single-haplotype or unphased genome assemblies. For phased assemblies, each haplotype should be separated into its own input FASTA file prior to alignment. GPatch can then be run separately on the BAM files for each haplotype to obtain phased pseudoassemblies, otherwise results will be unpredictable and likely incorrect.
|
|
@@ -60,19 +63,59 @@ Description: # GPatch
|
|
|
60
63
|
| __-m N, --min_qual_score N__ | Minimum mapping quality score to retain an alignment. Default=30 |
|
|
61
64
|
| __-w PATH, --whitelist PATH__ | Path to BED file containing whitelist regions: i.e., the inverse of blacklist regions. Supplying this will have the effect of excluding alignments that fall entirely within blacklist regions. Default=None |
|
|
62
65
|
| __-d, --drop_missing__ | Omit unpatched reference chromosome records from the output if no contigs map to them. Default: Unpatched chromosomes are printed to output unchanged. |
|
|
66
|
+
| __-t, --no_trim__ | Do not trim the 5' end of contigs that overlap the previously-placed contig; overlapping contigs are bookended untrimmed. Default: Trim the overlap, measured directly from the contig sequences (or, with --legacy_junctions, inferred from the soft-clip-extended alignment coordinates). |
|
|
63
67
|
| __-s, --scaffold_only__ | Pad gaps between placed contigs with strings of N characters instead of patching with sequence from the reference assembly. Effectively turns GPatch into a reference-guided scaffolding tool. Note that patches.bed will still be generated to document (inverse) mapped contig boundaries in reference frame. |
|
|
64
68
|
| __-l N, --gap_length N__ | Length of "N" gaps separating placed gontigs when using --scaffold_only. Has no effect when in default patching mode. Default=Estimate gap length from alignment. |
|
|
65
69
|
| __-e, --no_extend__ | Do not patch telomere ends of pseudochromosomes with reference sequence upstream of the first mapped contig and downstream of the last mapped contig. Default is to include 5' and 3' patches to extend telomeres to the ends implied by the alignment. |
|
|
66
70
|
| __-k, --keep_nested__ | Do not drop contigs with mapped positions nested entirely inside other mapped contigs. Instead, these will be bookended after the contig in which they are nested. Default is to drop contigs with mapped positions nested entirely within other mapped contigs. This option should be used with caution as these mappings cannot be placed unambigiously relative to other mapped contigs, thus including them is likely to lead to unpredictable and possibly incorrect results. Do not use this unless you are sure you know what you are doing! |
|
|
67
71
|
|
|
72
|
+
#### Junction-Handling Arguments:
|
|
73
|
+
| Argument | Description |
|
|
74
|
+
|---|---|
|
|
75
|
+
| __--legacy_junctions__ | Use the original (GPatch <= 0.4) junction logic: contig extents from the primary alignment extended by its full soft-clips, overlaps trimmed by the overlap of those extents, and gaps patched by their distance. No junctions.tsv is written. |
|
|
76
|
+
| __--max_resid N__ | Maximum unaligned sequence (bp) remaining at a contig end, after chaining, for the reference gap estimate at that end to be trusted. Default=10000 |
|
|
77
|
+
| __--chain_mapq N__ | Minimum mapping quality of supplementary alignments used to extend contig extents. Default=20 |
|
|
78
|
+
| __--chain_minlen N__ | Minimum aligned query length (bp) of supplementary alignments used to extend contig extents. Default=10000 |
|
|
79
|
+
| __--chain_maxgap N__ | Maximum gap (bp), in both query and reference, between chained alignments. Default=1000000 |
|
|
80
|
+
| __--chain_tol N__ | Maximum overlap (bp) allowed between chained alignments. Default=10000 |
|
|
81
|
+
| __--anchor N__ | Length (bp) of the exact anchors used to detect overlaps between adjacent contigs; also the minimum detectable overlap. Default=500 |
|
|
82
|
+
| __--min_overlap_identity F__ | Minimum identity over the whole overlap for a candidate overlap to be accepted. Default=0.999 |
|
|
83
|
+
| __--indel_tol N__ | Maximum length difference (bp) between the two anchor-implied overlap lengths for a candidate containing indels; such candidates are verified with minimap2. 0 disables. Default=50 |
|
|
84
|
+
| __--max_mm2_tests N__ | Maximum number of indel-containing candidate overlaps verified with minimap2 per junction. Default=20 |
|
|
85
|
+
| __--win_min N__ | Minimum size (bp) of the contig-end windows searched for overlaps. Default=1000000 |
|
|
86
|
+
| __--win_max N__ | Maximum size (bp) of the contig-end windows searched for overlaps. Default=4000000 |
|
|
87
|
+
| __--minimap2 PATH__ | Path to minimap2, used only to verify candidate overlaps containing indels. Default: minimap2 on PATH; if not found, such candidates are not considered. |
|
|
88
|
+
| __--threads N__ | Number of processes used for overlap detection. Default=1 |
|
|
89
|
+
|
|
90
|
+
## Junction Handling
|
|
91
|
+
|
|
92
|
+
At each junction between adjacent placed contigs, GPatch either trims the 5' end of the second contig (the contigs overlap), patches the gap between them with reference sequence, or bookends them. N characters are never introduced, except that patches are replaced by N runs in --scaffold_only mode.
|
|
93
|
+
|
|
94
|
+
1. __Contig extents.__ The primary alignment of each contig is chained to supplementary alignments of the same contig that are on the same chromosome and strand and colinear with it in both query and reference. Each contig end is then extrapolated onto the reference only by the unaligned sequence remaining beyond the outermost chained alignment (the "residual"). These extents are also used to identify nested contigs. With --legacy_junctions, the primary alignment's full soft-clips are used instead.
|
|
95
|
+
2. __Overlap measurement.__ Overlaps are measured directly from the contig sequences. Candidate overlaps come from exact matches of two anchors: the next contig's first bases within the end of the previous contig, and the previous contig's last bases within the start of the next contig. A candidate supported by both anchors is accepted if identity over the whole overlap is at least --min_overlap_identity.
|
|
96
|
+
3. __Decision.__ The extent-based gap estimate is *trusted* when the residuals at both contig ends of the junction are at most --max_resid, *one-sided* when only one exceeds it, and *untrusted* otherwise.
|
|
97
|
+
|
|
98
|
+
| Decision | When |
|
|
99
|
+
|---|---|
|
|
100
|
+
| trim_measured | Exactly one overlap was found; it is trimmed. |
|
|
101
|
+
| trim_ambiguous | Several overlap offsets were found (tandem repeats). The one closest to the estimated overlap is trimmed if the estimate is trusted or one-sided; otherwise the smallest. |
|
|
102
|
+
| patch | No overlap; the estimated gap is >= 0 and trusted. The gap is patched with reference sequence. |
|
|
103
|
+
| patch_one_sided | No overlap; the estimated gap is >= 0 and one-sided. The gap is patched with reference sequence. |
|
|
104
|
+
| bookend | No overlap; the estimate predicts an overlap or is untrusted. The contigs are joined directly. |
|
|
105
|
+
|
|
106
|
+
Chromosome ends are patched when the residual at the terminal contig end is at most --max_resid (and --no_extend is not set). Contigs are never trimmed against a chromosome end. The decision and reasoning for every junction are written to junctions.tsv.
|
|
107
|
+
|
|
68
108
|
## Output
|
|
69
109
|
|
|
70
|
-
GPatch produces
|
|
110
|
+
GPatch produces the following output files:
|
|
71
111
|
| File | Description |
|
|
72
112
|
|---|---|
|
|
73
113
|
| __patched.fasta__ | The final patched genome. |
|
|
74
114
|
| __contigs.bed__ | Location of contigs in the coordinate frame of the patched genome. |
|
|
75
115
|
| __patches.bed__ | Location of patches in the coordinate frame of the reference genome. |
|
|
116
|
+
| __unplaced.tsv__ | Contigs in the input BAM that are not in the pseudoassembly, with the reason (unmapped, low_mapq, whitelist, nested) and their primary alignment. |
|
|
117
|
+
| __unplaced.fasta__ | Sequences of the unplaced contigs, in their original orientation. |
|
|
118
|
+
| __junctions.tsv__ | The decision (trim, patch or bookend) made at each junction between adjacent contigs and at chromosome ends, with the contig extents, residual unaligned lengths, gap estimate, candidate overlaps and the reason for the decision. Not written with --legacy_junctions. |
|
|
76
119
|
|
|
77
120
|
## Helper Scripts
|
|
78
121
|
|
|
@@ -32,7 +32,10 @@ Installation from the github repository is not recommended. However, if you must
|
|
|
32
32
|
|
|
33
33
|
## Usage
|
|
34
34
|
```
|
|
35
|
-
GPatch.py [-h] -q SAM/BAM -r FASTA [-x STR] [-b FILENAME] [-m N] [-w PATH] [-d] [-s] [-l N] [-e] [-k]
|
|
35
|
+
GPatch.py [-h] -q SAM/BAM -r FASTA [-x STR] [-b FILENAME] [-m N] [-w PATH] [-d] [-t] [-s] [-l N] [-e] [-k]
|
|
36
|
+
[--legacy_junctions] [--max_resid N] [--chain_mapq N] [--chain_minlen N] [--chain_maxgap N]
|
|
37
|
+
[--chain_tol N] [--anchor N] [--min_overlap_identity F] [--indel_tol N] [--max_mm2_tests N]
|
|
38
|
+
[--win_min N] [--win_max N] [--minimap2 PATH] [--threads N]
|
|
36
39
|
```
|
|
37
40
|
|
|
38
41
|
Starting with alignments of contigs to a reference genome, produce a chromosome-scale pseudoassembly by patching gaps between mapped contigs with sequences from the reference. By default, reference chromosomes with no mapped contigs are printed to output unchanged. Use the --drop_missing option to disable this behavior. By default, patches are applied to the 5' and 3' telomere ends of pseudochromsomes if the first and last contig alignments do not extend to the start/end of the reference chromsome. In some cases, this may cause spurious duplications. Use the --no_extend option if this is a concern. Note that GPatch is designed to be run on single-haplotype or unphased genome assemblies. For phased assemblies, each haplotype should be separated into its own input FASTA file prior to alignment. GPatch can then be run separately on the BAM files for each haplotype to obtain phased pseudoassemblies, otherwise results will be unpredictable and likely incorrect.
|
|
@@ -52,19 +55,59 @@ Starting with alignments of contigs to a reference genome, produce a chromosome-
|
|
|
52
55
|
| __-m N, --min_qual_score N__ | Minimum mapping quality score to retain an alignment. Default=30 |
|
|
53
56
|
| __-w PATH, --whitelist PATH__ | Path to BED file containing whitelist regions: i.e., the inverse of blacklist regions. Supplying this will have the effect of excluding alignments that fall entirely within blacklist regions. Default=None |
|
|
54
57
|
| __-d, --drop_missing__ | Omit unpatched reference chromosome records from the output if no contigs map to them. Default: Unpatched chromosomes are printed to output unchanged. |
|
|
58
|
+
| __-t, --no_trim__ | Do not trim the 5' end of contigs that overlap the previously-placed contig; overlapping contigs are bookended untrimmed. Default: Trim the overlap, measured directly from the contig sequences (or, with --legacy_junctions, inferred from the soft-clip-extended alignment coordinates). |
|
|
55
59
|
| __-s, --scaffold_only__ | Pad gaps between placed contigs with strings of N characters instead of patching with sequence from the reference assembly. Effectively turns GPatch into a reference-guided scaffolding tool. Note that patches.bed will still be generated to document (inverse) mapped contig boundaries in reference frame. |
|
|
56
60
|
| __-l N, --gap_length N__ | Length of "N" gaps separating placed gontigs when using --scaffold_only. Has no effect when in default patching mode. Default=Estimate gap length from alignment. |
|
|
57
61
|
| __-e, --no_extend__ | Do not patch telomere ends of pseudochromosomes with reference sequence upstream of the first mapped contig and downstream of the last mapped contig. Default is to include 5' and 3' patches to extend telomeres to the ends implied by the alignment. |
|
|
58
62
|
| __-k, --keep_nested__ | Do not drop contigs with mapped positions nested entirely inside other mapped contigs. Instead, these will be bookended after the contig in which they are nested. Default is to drop contigs with mapped positions nested entirely within other mapped contigs. This option should be used with caution as these mappings cannot be placed unambigiously relative to other mapped contigs, thus including them is likely to lead to unpredictable and possibly incorrect results. Do not use this unless you are sure you know what you are doing! |
|
|
59
63
|
|
|
64
|
+
#### Junction-Handling Arguments:
|
|
65
|
+
| Argument | Description |
|
|
66
|
+
|---|---|
|
|
67
|
+
| __--legacy_junctions__ | Use the original (GPatch <= 0.4) junction logic: contig extents from the primary alignment extended by its full soft-clips, overlaps trimmed by the overlap of those extents, and gaps patched by their distance. No junctions.tsv is written. |
|
|
68
|
+
| __--max_resid N__ | Maximum unaligned sequence (bp) remaining at a contig end, after chaining, for the reference gap estimate at that end to be trusted. Default=10000 |
|
|
69
|
+
| __--chain_mapq N__ | Minimum mapping quality of supplementary alignments used to extend contig extents. Default=20 |
|
|
70
|
+
| __--chain_minlen N__ | Minimum aligned query length (bp) of supplementary alignments used to extend contig extents. Default=10000 |
|
|
71
|
+
| __--chain_maxgap N__ | Maximum gap (bp), in both query and reference, between chained alignments. Default=1000000 |
|
|
72
|
+
| __--chain_tol N__ | Maximum overlap (bp) allowed between chained alignments. Default=10000 |
|
|
73
|
+
| __--anchor N__ | Length (bp) of the exact anchors used to detect overlaps between adjacent contigs; also the minimum detectable overlap. Default=500 |
|
|
74
|
+
| __--min_overlap_identity F__ | Minimum identity over the whole overlap for a candidate overlap to be accepted. Default=0.999 |
|
|
75
|
+
| __--indel_tol N__ | Maximum length difference (bp) between the two anchor-implied overlap lengths for a candidate containing indels; such candidates are verified with minimap2. 0 disables. Default=50 |
|
|
76
|
+
| __--max_mm2_tests N__ | Maximum number of indel-containing candidate overlaps verified with minimap2 per junction. Default=20 |
|
|
77
|
+
| __--win_min N__ | Minimum size (bp) of the contig-end windows searched for overlaps. Default=1000000 |
|
|
78
|
+
| __--win_max N__ | Maximum size (bp) of the contig-end windows searched for overlaps. Default=4000000 |
|
|
79
|
+
| __--minimap2 PATH__ | Path to minimap2, used only to verify candidate overlaps containing indels. Default: minimap2 on PATH; if not found, such candidates are not considered. |
|
|
80
|
+
| __--threads N__ | Number of processes used for overlap detection. Default=1 |
|
|
81
|
+
|
|
82
|
+
## Junction Handling
|
|
83
|
+
|
|
84
|
+
At each junction between adjacent placed contigs, GPatch either trims the 5' end of the second contig (the contigs overlap), patches the gap between them with reference sequence, or bookends them. N characters are never introduced, except that patches are replaced by N runs in --scaffold_only mode.
|
|
85
|
+
|
|
86
|
+
1. __Contig extents.__ The primary alignment of each contig is chained to supplementary alignments of the same contig that are on the same chromosome and strand and colinear with it in both query and reference. Each contig end is then extrapolated onto the reference only by the unaligned sequence remaining beyond the outermost chained alignment (the "residual"). These extents are also used to identify nested contigs. With --legacy_junctions, the primary alignment's full soft-clips are used instead.
|
|
87
|
+
2. __Overlap measurement.__ Overlaps are measured directly from the contig sequences. Candidate overlaps come from exact matches of two anchors: the next contig's first bases within the end of the previous contig, and the previous contig's last bases within the start of the next contig. A candidate supported by both anchors is accepted if identity over the whole overlap is at least --min_overlap_identity.
|
|
88
|
+
3. __Decision.__ The extent-based gap estimate is *trusted* when the residuals at both contig ends of the junction are at most --max_resid, *one-sided* when only one exceeds it, and *untrusted* otherwise.
|
|
89
|
+
|
|
90
|
+
| Decision | When |
|
|
91
|
+
|---|---|
|
|
92
|
+
| trim_measured | Exactly one overlap was found; it is trimmed. |
|
|
93
|
+
| trim_ambiguous | Several overlap offsets were found (tandem repeats). The one closest to the estimated overlap is trimmed if the estimate is trusted or one-sided; otherwise the smallest. |
|
|
94
|
+
| patch | No overlap; the estimated gap is >= 0 and trusted. The gap is patched with reference sequence. |
|
|
95
|
+
| patch_one_sided | No overlap; the estimated gap is >= 0 and one-sided. The gap is patched with reference sequence. |
|
|
96
|
+
| bookend | No overlap; the estimate predicts an overlap or is untrusted. The contigs are joined directly. |
|
|
97
|
+
|
|
98
|
+
Chromosome ends are patched when the residual at the terminal contig end is at most --max_resid (and --no_extend is not set). Contigs are never trimmed against a chromosome end. The decision and reasoning for every junction are written to junctions.tsv.
|
|
99
|
+
|
|
60
100
|
## Output
|
|
61
101
|
|
|
62
|
-
GPatch produces
|
|
102
|
+
GPatch produces the following output files:
|
|
63
103
|
| File | Description |
|
|
64
104
|
|---|---|
|
|
65
105
|
| __patched.fasta__ | The final patched genome. |
|
|
66
106
|
| __contigs.bed__ | Location of contigs in the coordinate frame of the patched genome. |
|
|
67
107
|
| __patches.bed__ | Location of patches in the coordinate frame of the reference genome. |
|
|
108
|
+
| __unplaced.tsv__ | Contigs in the input BAM that are not in the pseudoassembly, with the reason (unmapped, low_mapq, whitelist, nested) and their primary alignment. |
|
|
109
|
+
| __unplaced.fasta__ | Sequences of the unplaced contigs, in their original orientation. |
|
|
110
|
+
| __junctions.tsv__ | The decision (trim, patch or bookend) made at each junction between adjacent contigs and at chromosome ends, with the contig extents, residual unaligned lengths, gap estimate, candidate overlaps and the reason for the decision. Not written with --legacy_junctions. |
|
|
68
111
|
|
|
69
112
|
## Helper Scripts
|
|
70
113
|
|
|
@@ -29,7 +29,7 @@ def main():
|
|
|
29
29
|
|
|
30
30
|
metadata = dict(
|
|
31
31
|
name="gpatch",
|
|
32
|
-
version="0.
|
|
32
|
+
version="0.5.0",
|
|
33
33
|
author="Adam Diehl",
|
|
34
34
|
author_email="adadiehl@umich.edu",
|
|
35
35
|
description="Assemble contigs into a chromosome-scalse pseudo-assembly using alignments to a reference sequence. Download the github repository for helper scripts to automate GPatch workflows, identify and correct misjoins in the contig assembly, produce dot-plots of patched pseudoassemblies to a reference assembly, and generate chrom.sizes and liftover chains for patched pseudoassemblies.",
|