ModDotPlot 0.9.8__tar.gz → 0.9.9__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.4
2
2
  Name: ModDotPlot
3
- Version: 0.9.8
3
+ Version: 0.9.9
4
4
  Author: Michael Schatz, Adam Phillippy
5
5
  Author-email: Alex Sweeten <alex.sweeten@nih.gov>
6
6
  Maintainer-email: Alex Sweeten <alex.sweeten@nih.gov>
@@ -140,6 +140,9 @@ positional arguments:
140
140
  options:
141
141
  -h, --help show this help message and exit
142
142
  ```
143
+
144
+ Note that running `moddotplot -h` might take a while at first! This is because the Python interpreter is compiling source code into the __pycache__ directory. Subsequent runs will use the pre-compiled code and load much faster!
145
+
143
146
  ---
144
147
 
145
148
  ## Usage
@@ -207,6 +210,10 @@ Each partition takes into account a fraction of its neighboring partitions k-mer
207
210
 
208
211
  Modimizer sketch size. Must be lower than window size `w`. A lower sketch size means less k-mers to compare (and faster runtime), at the expense of lower accuracy. Recommended to be kept >= 1000.
209
212
 
213
+ `--forward <bool>`
214
+
215
+ Use forward k-mers only, instead of the default of canonical k-mers. Warning: this will give strand specific output.
216
+
210
217
  `-r / --resolution <int>`
211
218
 
212
219
  Dotplot resolution. This corresponds to the number of windows each input sequence is partitioned into. Default is 1000. Overrides the `--window` parameter.
@@ -88,6 +88,9 @@ positional arguments:
88
88
  options:
89
89
  -h, --help show this help message and exit
90
90
  ```
91
+
92
+ Note that running `moddotplot -h` might take a while at first! This is because the Python interpreter is compiling source code into the __pycache__ directory. Subsequent runs will use the pre-compiled code and load much faster!
93
+
91
94
  ---
92
95
 
93
96
  ## Usage
@@ -155,6 +158,10 @@ Each partition takes into account a fraction of its neighboring partitions k-mer
155
158
 
156
159
  Modimizer sketch size. Must be lower than window size `w`. A lower sketch size means less k-mers to compare (and faster runtime), at the expense of lower accuracy. Recommended to be kept >= 1000.
157
160
 
161
+ `--forward <bool>`
162
+
163
+ Use forward k-mers only, instead of the default of canonical k-mers. Warning: this will give strand specific output.
164
+
158
165
  `-r / --resolution <int>`
159
166
 
160
167
  Dotplot resolution. This corresponds to the number of windows each input sequence is partitioned into. Default is 1000. Overrides the `--window` parameter.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ModDotPlot"
7
- version = "0.9.8"
7
+ version = "0.9.9"
8
8
  requires-python = ">= 3.7"
9
9
  dependencies = [
10
10
  "pysam",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ModDotPlot
3
- Version: 0.9.8
3
+ Version: 0.9.9
4
4
  Author: Michael Schatz, Adam Phillippy
5
5
  Author-email: Alex Sweeten <alex.sweeten@nih.gov>
6
6
  Maintainer-email: Alex Sweeten <alex.sweeten@nih.gov>
@@ -140,6 +140,9 @@ positional arguments:
140
140
  options:
141
141
  -h, --help show this help message and exit
142
142
  ```
143
+
144
+ Note that running `moddotplot -h` might take a while at first! This is because the Python interpreter is compiling source code into the __pycache__ directory. Subsequent runs will use the pre-compiled code and load much faster!
145
+
143
146
  ---
144
147
 
145
148
  ## Usage
@@ -207,6 +210,10 @@ Each partition takes into account a fraction of its neighboring partitions k-mer
207
210
 
208
211
  Modimizer sketch size. Must be lower than window size `w`. A lower sketch size means less k-mers to compare (and faster runtime), at the expense of lower accuracy. Recommended to be kept >= 1000.
209
212
 
213
+ `--forward <bool>`
214
+
215
+ Use forward k-mers only, instead of the default of canonical k-mers. Warning: this will give strand specific output.
216
+
210
217
  `-r / --resolution <int>`
211
218
 
212
219
  Dotplot resolution. This corresponds to the number of windows each input sequence is partitioned into. Default is 1000. Overrides the `--window` parameter.
@@ -1,4 +1,4 @@
1
- VERSION = "0.9.8"
1
+ VERSION = "0.9.9"
2
2
  COLS = [
3
3
  "#query_name",
4
4
  "query_start",
@@ -316,6 +316,18 @@ def get_parser():
316
316
  type=str,
317
317
  )
318
318
 
319
+ static_parser.add_argument(
320
+ "--forward",
321
+ action="store_true",
322
+ help="Enforce forward only k-mers instead of canonical k-mers. Warning: only use if you want strand-specific output!",
323
+ )
324
+
325
+ static_parser.add_argument(
326
+ "--plot-direction",
327
+ action="store_true",
328
+ help="Create a plot containing the direction of each k-mer array (relative to the first array). Arrays with inversions will be highlighted in blue (forward) and pink (reverse).",
329
+ )
330
+
319
331
  static_parser.add_argument(
320
332
  "--colors",
321
333
  default=None,
@@ -635,7 +647,10 @@ def main():
635
647
  # -----------LOAD SEQUENCES INTO MEMORY-----------
636
648
  kmer_list = []
637
649
  for i in fasta_list:
638
- kmer_list.append(readKmersFromFile(i, args.kmer, False))
650
+ if args.forward:
651
+ kmer_list.append(readKmersFromFile(i, args.kmer, False, True))
652
+ else:
653
+ kmer_list.append(readKmersFromFile(i, args.kmer, False, False))
639
654
  k_list = [item for sublist in kmer_list for item in sublist]
640
655
  # Throw error if compare only selected with one sequence.
641
656
  if len(k_list) < 2 and args.compare_only:
@@ -37,7 +37,9 @@ def extractRegion(seq_name):
37
37
  return None
38
38
 
39
39
 
40
- def generateKmersFromFasta(seq: Sequence[str], k: int, quiet: bool) -> Iterable[int]:
40
+ def generateKmersFromFasta(
41
+ seq: Sequence[str], k: int, quiet: bool, fw_only: bool
42
+ ) -> Iterable[int]:
41
43
  n = len(seq)
42
44
  if not quiet:
43
45
  progress_thresholds = round(n / 77)
@@ -60,11 +62,12 @@ def generateKmersFromFasta(seq: Sequence[str], k: int, quiet: bool) -> Iterable[
60
62
  # Remove case sensitivity
61
63
  kmer = seq[i : i + k].upper()
62
64
  fh = mmh3.hash(kmer)
63
-
64
- # Calculate reverse complement hash directly without the need for translation
65
- rc = mmh3.hash(kmer[::-1].translate(tab_b))
66
-
67
- yield fh if fh < rc else rc
65
+ if fw_only:
66
+ yield fh
67
+ else:
68
+ # Calculate reverse complement hash directly without the need for translation
69
+ rc = mmh3.hash(kmer[::-1].translate(tab_b))
70
+ yield fh if fh < rc else rc
68
71
 
69
72
 
70
73
  def isValidFasta(file_path):
@@ -151,7 +154,9 @@ def printProgressBar(
151
154
  print()
152
155
 
153
156
 
154
- def readKmersFromFile(filename: str, ksize: int, quiet: bool) -> List[List[int]]:
157
+ def readKmersFromFile(
158
+ filename: str, ksize: int, quiet: bool, fw_only: bool
159
+ ) -> List[List[int]]:
155
160
  """
156
161
  Given a filename and an integer k, returns a list of all k-mers found in the sequences in the file.
157
162
  """
@@ -161,7 +166,9 @@ def readKmersFromFile(filename: str, ksize: int, quiet: bool) -> List[List[int]]
161
166
  for seq_id in seq.references:
162
167
  print(f"Retrieving k-mers from {seq_id}.... \n")
163
168
  kmers_for_seq = []
164
- for kmer_hash in generateKmersFromFasta(seq.fetch(seq_id), ksize, quiet):
169
+ for kmer_hash in generateKmersFromFasta(
170
+ seq.fetch(seq_id), ksize, quiet, fw_only
171
+ ):
165
172
  kmers_for_seq.append(kmer_hash)
166
173
  all_kmers.append(kmers_for_seq)
167
174
  print(f"\n{seq_id} k-mers retrieved! \n")
File without changes
File without changes