GPatch 0.3.5__tar.gz → 0.3.8__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.3.5/src/GPatch.egg-info → GPatch-0.3.8}/PKG-INFO +10 -5
- {GPatch-0.3.5 → GPatch-0.3.8}/README.md +8 -4
- {GPatch-0.3.5 → GPatch-0.3.8}/setup.py +1 -1
- {GPatch-0.3.5 → GPatch-0.3.8}/src/GPatch/GPatch.py +40 -6
- {GPatch-0.3.5 → GPatch-0.3.8/src/GPatch.egg-info}/PKG-INFO +10 -5
- {GPatch-0.3.5 → GPatch-0.3.8}/CODE_OF_CONDUCT.md +0 -0
- {GPatch-0.3.5 → GPatch-0.3.8}/LICENSE +0 -0
- {GPatch-0.3.5 → GPatch-0.3.8}/MANIFEST.in +0 -0
- {GPatch-0.3.5 → GPatch-0.3.8}/pyproject.toml +0 -0
- {GPatch-0.3.5 → GPatch-0.3.8}/requirements.txt +0 -0
- {GPatch-0.3.5 → GPatch-0.3.8}/setup.cfg +0 -0
- {GPatch-0.3.5 → GPatch-0.3.8}/src/GPatch/__init__.py +0 -0
- {GPatch-0.3.5 → GPatch-0.3.8}/src/GPatch/__main__.py +0 -0
- {GPatch-0.3.5 → GPatch-0.3.8}/src/GPatch.egg-info/SOURCES.txt +0 -0
- {GPatch-0.3.5 → GPatch-0.3.8}/src/GPatch.egg-info/dependency_links.txt +0 -0
- {GPatch-0.3.5 → GPatch-0.3.8}/src/GPatch.egg-info/entry_points.txt +0 -0
- {GPatch-0.3.5 → GPatch-0.3.8}/src/GPatch.egg-info/not-zip-safe +0 -0
- {GPatch-0.3.5 → GPatch-0.3.8}/src/GPatch.egg-info/requires.txt +0 -0
- {GPatch-0.3.5 → GPatch-0.3.8}/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.
|
|
3
|
+
Version: 0.3.8
|
|
4
4
|
Summary: Assemble contigs into a chromosome-scalse pseudo-assembly using alignments to a reference sequence.
|
|
5
5
|
Home-page: https://github.com/adadiehl/GPatch
|
|
6
6
|
Author: Adam Diehl
|
|
@@ -40,8 +40,8 @@ Description: # GPatch
|
|
|
40
40
|
|
|
41
41
|
## Usage
|
|
42
42
|
```
|
|
43
|
-
usage: GPatch [-h] -q SAM/BAM -r FASTA [-x
|
|
44
|
-
|
|
43
|
+
usage: GPatch.py [-h] -q SAM/BAM -r FASTA [-x STR] [-b FILENAME] [-m N]
|
|
44
|
+
[-w PATH] [-d]
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
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. Reference chromosomes with no mapped contigs are printed to output unchanged.
|
|
@@ -59,7 +59,9 @@ Description: # GPatch
|
|
|
59
59
|
| __-x STR, --prefix STR__ | Prefix to add to output file names. Default=None |
|
|
60
60
|
| __-b FILENAME, --store_final_bam FILENAME__ | Store the final set of primary contig alignments to the given file name. Default: Do not store the final BAM. |
|
|
61
61
|
| __-m N, --min_qual_score N__ | Minimum mapping quality score to retain an alignment. Default=30 |
|
|
62
|
-
|
|
62
|
+
| __-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 |
|
|
63
|
+
| __-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. |
|
|
64
|
+
| __-t, --no_trim__ | Do not trim the 5-prime end of contigs whose mappings overlap the previously-placed contig. Default: Overlapping contig sequence will be trimmed at the previous 3-prime contig breakpoint. |
|
|
63
65
|
|
|
64
66
|
## Output
|
|
65
67
|
|
|
@@ -74,7 +76,10 @@ Description: # GPatch
|
|
|
74
76
|
## Citing GPatch
|
|
75
77
|
Please use the following citation if you use this software in your work:
|
|
76
78
|
|
|
77
|
-
|
|
79
|
+
Fast and Accurate Draft Genome Patching with GPatch
|
|
80
|
+
Adam Diehl, Alan Boyle
|
|
81
|
+
bioRxiv 2025.05.22.655567; doi: https://doi.org/10.1101/2025.05.22.655567
|
|
82
|
+
|
|
78
83
|
Keywords: genomics,genome assembly
|
|
79
84
|
Platform: UNKNOWN
|
|
80
85
|
Classifier: Development Status :: 4 - Beta
|
|
@@ -32,8 +32,8 @@ Installation from the github repository is not recommended. However, if you must
|
|
|
32
32
|
|
|
33
33
|
## Usage
|
|
34
34
|
```
|
|
35
|
-
usage: GPatch [-h] -q SAM/BAM -r FASTA [-x
|
|
36
|
-
|
|
35
|
+
usage: GPatch.py [-h] -q SAM/BAM -r FASTA [-x STR] [-b FILENAME] [-m N]
|
|
36
|
+
[-w PATH] [-d]
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
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. Reference chromosomes with no mapped contigs are printed to output unchanged.
|
|
@@ -51,7 +51,9 @@ Starting with alignments of contigs to a reference genome, produce a chromosome-
|
|
|
51
51
|
| __-x STR, --prefix STR__ | Prefix to add to output file names. Default=None |
|
|
52
52
|
| __-b FILENAME, --store_final_bam FILENAME__ | Store the final set of primary contig alignments to the given file name. Default: Do not store the final BAM. |
|
|
53
53
|
| __-m N, --min_qual_score N__ | Minimum mapping quality score to retain an alignment. Default=30 |
|
|
54
|
-
|
|
54
|
+
| __-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 |
|
|
55
|
+
| __-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. |
|
|
56
|
+
| __-t, --no_trim__ | Do not trim the 5-prime end of contigs whose mappings overlap the previously-placed contig. Default: Overlapping contig sequence will be trimmed at the previous 3-prime contig breakpoint. |
|
|
55
57
|
|
|
56
58
|
## Output
|
|
57
59
|
|
|
@@ -66,4 +68,6 @@ GPatch produces three output files:
|
|
|
66
68
|
## Citing GPatch
|
|
67
69
|
Please use the following citation if you use this software in your work:
|
|
68
70
|
|
|
69
|
-
|
|
71
|
+
Fast and Accurate Draft Genome Patching with GPatch
|
|
72
|
+
Adam Diehl, Alan Boyle
|
|
73
|
+
bioRxiv 2025.05.22.655567; doi: https://doi.org/10.1101/2025.05.22.655567
|
|
@@ -29,7 +29,7 @@ def main():
|
|
|
29
29
|
|
|
30
30
|
metadata = dict(
|
|
31
31
|
name="GPatch",
|
|
32
|
-
version="0.3.
|
|
32
|
+
version="0.3.8",
|
|
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.",
|
|
@@ -7,7 +7,7 @@ from Bio.Seq import Seq
|
|
|
7
7
|
import pysam
|
|
8
8
|
import random
|
|
9
9
|
|
|
10
|
-
__version__ = "0.3.
|
|
10
|
+
__version__ = "0.3.8"
|
|
11
11
|
|
|
12
12
|
"""
|
|
13
13
|
Given a name-sorted BAM file, cluster mapped reads by name and
|
|
@@ -21,16 +21,25 @@ def create_primary_alignments_list(query_bam, min_qual_score):
|
|
|
21
21
|
Extract all primary alignments from the BAM file and return
|
|
22
22
|
as a list.
|
|
23
23
|
"""
|
|
24
|
+
#i = 0
|
|
25
|
+
#j = 0
|
|
26
|
+
#k = 0
|
|
27
|
+
#l = 0
|
|
24
28
|
ret = []
|
|
25
29
|
for aln in query_bam:
|
|
30
|
+
#i += 1
|
|
26
31
|
if aln.is_unmapped:
|
|
27
32
|
# Skip unmapped contigs
|
|
33
|
+
#j += 1
|
|
28
34
|
continue
|
|
29
35
|
if aln.mapping_quality < min_qual_score:
|
|
30
36
|
# Skip low-quality mappings
|
|
37
|
+
#k += 1
|
|
31
38
|
continue
|
|
32
39
|
if not (aln.is_supplementary or aln.is_secondary):
|
|
40
|
+
#l += 1
|
|
33
41
|
ret.append(aln)
|
|
42
|
+
#sys.stderr.write("%d\t%d\t%d\t%d\t%d\n" % (i, j, k, l, len(ret)))
|
|
34
43
|
return ret
|
|
35
44
|
|
|
36
45
|
|
|
@@ -45,7 +54,9 @@ def contig_breakpoints_from_cigar(primary_alignments):
|
|
|
45
54
|
chrom = contig.reference_name
|
|
46
55
|
start = contig.reference_start
|
|
47
56
|
end = contig.reference_end
|
|
57
|
+
#sys.stderr.write("%s\t%s\t%s\n" % (chrom, start, end))
|
|
48
58
|
# Check for left and right soft-clips
|
|
59
|
+
#sys.stderr.write("%s\n%s\n" % (contig.cigartuples[0], contig.cigartuples[-1]))
|
|
49
60
|
if contig.cigartuples[0][0] == 4:
|
|
50
61
|
# left soft-clip
|
|
51
62
|
start -= contig.cigartuples[0][1]
|
|
@@ -53,6 +64,7 @@ def contig_breakpoints_from_cigar(primary_alignments):
|
|
|
53
64
|
# right soft-clip
|
|
54
65
|
end += contig.cigartuples[-1][1]
|
|
55
66
|
contig_breakpoints[contig.query_name] = [chrom, start, end, contig.query_name]
|
|
67
|
+
#sys.stderr.write("%s\n" % (contig_breakpoints))
|
|
56
68
|
|
|
57
69
|
return contig_breakpoints
|
|
58
70
|
|
|
@@ -168,6 +180,9 @@ def main():
|
|
|
168
180
|
parser.add_argument('-d', '--drop_missing',
|
|
169
181
|
required=False, default=False, action="store_true",
|
|
170
182
|
help='Omit unpatched reference chromosome records from the output if no contigs map to them. Default: Unpatched chromosomes are printed to output unchanged.')
|
|
183
|
+
parser.add_argument('-t', '--no_trim',
|
|
184
|
+
required=False, default=False, action="store_true",
|
|
185
|
+
help='Do not trim the 5-prime end of contigs whose mappings overlap the previously-placed contig. Default: Overlapping contig sequence will be trimmed at the previous 3-prime contig breakpoint.')
|
|
171
186
|
|
|
172
187
|
args = parser.parse_args()
|
|
173
188
|
|
|
@@ -204,6 +219,7 @@ def main():
|
|
|
204
219
|
for ref_seq in SeqIO.parse(args.reference_fasta, "fasta"):
|
|
205
220
|
# Select all contigs mapped to this sequence.
|
|
206
221
|
contigs = list(sorted_primary_alignments.fetch(ref_seq.id))
|
|
222
|
+
#sys.stderr.write("%s\t%s\n" % (ref_seq.id, contigs))
|
|
207
223
|
|
|
208
224
|
# Convert the list of contigs into a list of tuples: (start, end, name),
|
|
209
225
|
# representing the inferred contig breakpoints, sorted by start, then end position.
|
|
@@ -265,11 +281,16 @@ def main():
|
|
|
265
281
|
patched_seq = ""
|
|
266
282
|
for contig in contigs:
|
|
267
283
|
rstart = contig_breakpoints[contig.query_name][1]
|
|
284
|
+
"""
|
|
285
|
+
# This introduced a one-off error! We don't need to do this
|
|
286
|
+
# because all coordinates are already in proper zero-based form.
|
|
268
287
|
if rstart > 0:
|
|
269
288
|
rstart -= 1
|
|
289
|
+
"""
|
|
270
290
|
|
|
271
291
|
# Check for overlapping/bookended contig mappings.
|
|
272
292
|
qstart = 0 # Start of contig interval to append
|
|
293
|
+
#sys.stderr.write("%s\t%s\t%s\n" % (rstart, pos, pos-rstart))
|
|
273
294
|
if rstart > pos:
|
|
274
295
|
# No overlap. Append the patch, in all lower-case
|
|
275
296
|
# for easy identification.
|
|
@@ -278,8 +299,18 @@ def main():
|
|
|
278
299
|
patches_bed.write("%s\t%d\t%d\n" % (ref_seq.id, pos, rstart))
|
|
279
300
|
else:
|
|
280
301
|
# Handle overlapping contig ends by trimming the 5' end of
|
|
281
|
-
# this contig sequence by the length of the overlap.
|
|
282
|
-
|
|
302
|
+
# this contig sequence by the length of the overlap. Note this
|
|
303
|
+
# evaluates to zero if contigs are bookended (i.e., pos and
|
|
304
|
+
# rstart are equal.)
|
|
305
|
+
if not args.no_trim:
|
|
306
|
+
qstart = pos - rstart
|
|
307
|
+
if qstart > len(Seq(contig.query_sequence)):
|
|
308
|
+
# This should not happen, as it is indicative of a nested
|
|
309
|
+
# mapping, which should be filtered out prior to sequence-
|
|
310
|
+
# building. However, I have seen instances of nested mappings
|
|
311
|
+
# that somehow slip through the cracks. This is a hack to fix
|
|
312
|
+
# those instances until I can figure out why it happens.
|
|
313
|
+
continue
|
|
283
314
|
|
|
284
315
|
# Append the contig sequence to the patched sequence string
|
|
285
316
|
contig_start = len(patched_seq)
|
|
@@ -299,14 +330,17 @@ def main():
|
|
|
299
330
|
|
|
300
331
|
# Update the current position in the reference sequence if the
|
|
301
332
|
# end position of the current contig is 3' of the current pos.
|
|
333
|
+
#sys.stderr.write("%s\t%s\t%s\n" % (pos, contig_breakpoints[contig.query_name][2], len(ref_seq.seq)))
|
|
302
334
|
if contig_breakpoints[contig.query_name][2] > pos:
|
|
303
335
|
# This should always evaluate true in the absence of nested contigs.
|
|
304
336
|
pos = contig_breakpoints[contig.query_name][2]
|
|
305
|
-
|
|
337
|
+
|
|
306
338
|
# Once the above loop finishes, we need to add the terminal segment
|
|
307
339
|
# from the reference genome.
|
|
308
|
-
|
|
309
|
-
|
|
340
|
+
if pos < len(ref_seq.seq):
|
|
341
|
+
#sys.stderr.write("%s\n" % (ref_seq.seq[pos:len(ref_seq.seq)]))
|
|
342
|
+
patched_seq = patched_seq + ref_seq.seq[pos:len(ref_seq.seq)]
|
|
343
|
+
patches_bed.write("%s\t%d\t%d\n" % (ref_seq.id, pos, len(ref_seq.seq)))
|
|
310
344
|
|
|
311
345
|
# Swap in the patched sequence for the reference sequence and print the result
|
|
312
346
|
ref_seq.seq = patched_seq
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: GPatch
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.8
|
|
4
4
|
Summary: Assemble contigs into a chromosome-scalse pseudo-assembly using alignments to a reference sequence.
|
|
5
5
|
Home-page: https://github.com/adadiehl/GPatch
|
|
6
6
|
Author: Adam Diehl
|
|
@@ -40,8 +40,8 @@ Description: # GPatch
|
|
|
40
40
|
|
|
41
41
|
## Usage
|
|
42
42
|
```
|
|
43
|
-
usage: GPatch [-h] -q SAM/BAM -r FASTA [-x
|
|
44
|
-
|
|
43
|
+
usage: GPatch.py [-h] -q SAM/BAM -r FASTA [-x STR] [-b FILENAME] [-m N]
|
|
44
|
+
[-w PATH] [-d]
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
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. Reference chromosomes with no mapped contigs are printed to output unchanged.
|
|
@@ -59,7 +59,9 @@ Description: # GPatch
|
|
|
59
59
|
| __-x STR, --prefix STR__ | Prefix to add to output file names. Default=None |
|
|
60
60
|
| __-b FILENAME, --store_final_bam FILENAME__ | Store the final set of primary contig alignments to the given file name. Default: Do not store the final BAM. |
|
|
61
61
|
| __-m N, --min_qual_score N__ | Minimum mapping quality score to retain an alignment. Default=30 |
|
|
62
|
-
|
|
62
|
+
| __-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 |
|
|
63
|
+
| __-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. |
|
|
64
|
+
| __-t, --no_trim__ | Do not trim the 5-prime end of contigs whose mappings overlap the previously-placed contig. Default: Overlapping contig sequence will be trimmed at the previous 3-prime contig breakpoint. |
|
|
63
65
|
|
|
64
66
|
## Output
|
|
65
67
|
|
|
@@ -74,7 +76,10 @@ Description: # GPatch
|
|
|
74
76
|
## Citing GPatch
|
|
75
77
|
Please use the following citation if you use this software in your work:
|
|
76
78
|
|
|
77
|
-
|
|
79
|
+
Fast and Accurate Draft Genome Patching with GPatch
|
|
80
|
+
Adam Diehl, Alan Boyle
|
|
81
|
+
bioRxiv 2025.05.22.655567; doi: https://doi.org/10.1101/2025.05.22.655567
|
|
82
|
+
|
|
78
83
|
Keywords: genomics,genome assembly
|
|
79
84
|
Platform: UNKNOWN
|
|
80
85
|
Classifier: Development Status :: 4 - Beta
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|