GPatch 0.3.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: GPatch
3
- Version: 0.3.6
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
@@ -61,7 +61,7 @@ Description: # GPatch
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
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
-
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. |
65
65
 
66
66
  ## Output
67
67
 
@@ -76,7 +76,10 @@ Description: # GPatch
76
76
  ## Citing GPatch
77
77
  Please use the following citation if you use this software in your work:
78
78
 
79
- CITATION_HERE
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
+
80
83
  Keywords: genomics,genome assembly
81
84
  Platform: UNKNOWN
82
85
  Classifier: Development Status :: 4 - Beta
@@ -53,7 +53,7 @@ Starting with alignments of contigs to a reference genome, produce a chromosome-
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
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
-
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. |
57
57
 
58
58
  ## Output
59
59
 
@@ -68,4 +68,6 @@ GPatch produces three output files:
68
68
  ## Citing GPatch
69
69
  Please use the following citation if you use this software in your work:
70
70
 
71
- CITATION_HERE
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.6",
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.6"
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
 
@@ -171,6 +180,9 @@ def main():
171
180
  parser.add_argument('-d', '--drop_missing',
172
181
  required=False, default=False, action="store_true",
173
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.')
174
186
 
175
187
  args = parser.parse_args()
176
188
 
@@ -207,6 +219,7 @@ def main():
207
219
  for ref_seq in SeqIO.parse(args.reference_fasta, "fasta"):
208
220
  # Select all contigs mapped to this sequence.
209
221
  contigs = list(sorted_primary_alignments.fetch(ref_seq.id))
222
+ #sys.stderr.write("%s\t%s\n" % (ref_seq.id, contigs))
210
223
 
211
224
  # Convert the list of contigs into a list of tuples: (start, end, name),
212
225
  # representing the inferred contig breakpoints, sorted by start, then end position.
@@ -289,7 +302,15 @@ def main():
289
302
  # this contig sequence by the length of the overlap. Note this
290
303
  # evaluates to zero if contigs are bookended (i.e., pos and
291
304
  # rstart are equal.)
292
- qstart = pos - rstart
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
293
314
 
294
315
  # Append the contig sequence to the patched sequence string
295
316
  contig_start = len(patched_seq)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: GPatch
3
- Version: 0.3.6
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
@@ -61,7 +61,7 @@ Description: # GPatch
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
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
-
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. |
65
65
 
66
66
  ## Output
67
67
 
@@ -76,7 +76,10 @@ Description: # GPatch
76
76
  ## Citing GPatch
77
77
  Please use the following citation if you use this software in your work:
78
78
 
79
- CITATION_HERE
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
+
80
83
  Keywords: genomics,genome assembly
81
84
  Platform: UNKNOWN
82
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