methplotlib 0.23.2__py3-none-any.whl → 0.23.3__py3-none-any.whl

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.
@@ -91,6 +91,7 @@ def parse_nanopolish(filename, file_type, name, window, smoothen=5):
91
91
  raise
92
92
  header = gzip.open(filename, "rt").readline().rstrip().split("\t")
93
93
  table = pd.read_csv(tabix_stream.stdout, sep="\t", header=None, names=header)
94
+ check_tabix(tabix_stream, filename, window)
94
95
  else:
95
96
  logging.info(f"Reading {filename} slowly by splitting the file in chunks.")
96
97
  sys.stderr.write(f"\nReading {filename} would be faster with bgzip and tabix.\n")
@@ -235,6 +236,19 @@ def no_records_warning(filename, window):
235
236
  sys.stderr.write(f"\nWARNING: {message}\nThis dataset is skipped.\n")
236
237
 
237
238
 
239
+ def check_tabix(tabix_stream, filename, window):
240
+ """
241
+ Exit if tabix failed, as a failing tabix also writes nothing to stdout,
242
+ which would otherwise be reported as a window without records.
243
+ Only call this after its stdout has been read.
244
+ """
245
+ if tabix_stream.wait() != 0:
246
+ sys.exit(
247
+ f"\n\nERROR: tabix failed to read {window.chromosome}:{window.begin}-{window.end} "
248
+ f"from {filename}:\n{tabix_stream.stderr.read().decode()}"
249
+ )
250
+
251
+
238
252
  def read_in_chunks(filename, window, sep, usecols, index_suggestion):
239
253
  """
240
254
  Read a headerless file in chunks, keeping only the lines of the chromosome of interest.
@@ -303,6 +317,7 @@ def parse_bedgraph(filename, name, window):
303
317
  names=colnames,
304
318
  dtype={0: str},
305
319
  )
320
+ check_tabix(tabix_stream, filename, window)
306
321
  else:
307
322
  table = read_in_chunks(
308
323
  filename,
@@ -380,13 +395,21 @@ def parse_bedmethyl(filename, name, window, smoothen=5, flavor="modkit", mods_of
380
395
  sys.stderr.write("\n\nERROR when opening a tabix stream.\n")
381
396
  sys.stderr.write("Is tabix installed and on the PATH?.")
382
397
  raise
383
- table = pd.read_csv(
384
- tabix_stream.stdout,
385
- sep=sep,
386
- header=None,
387
- usecols=usecols,
388
- dtype={0: str},
389
- ).rename(columns=colnames)
398
+ try:
399
+ table = pd.read_csv(
400
+ tabix_stream.stdout,
401
+ sep=sep,
402
+ header=None,
403
+ usecols=usecols,
404
+ dtype={0: str},
405
+ ).rename(columns=colnames)
406
+ except pd.errors.EmptyDataError:
407
+ table = None
408
+ check_tabix(tabix_stream, filename, window)
409
+ # tabix writes nothing if the window has no records or the chromosome is not in the index
410
+ if table is None:
411
+ no_records_warning(filename, window)
412
+ return []
390
413
  else:
391
414
  table = read_in_chunks(
392
415
  filename,
methplotlib/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.23.2"
1
+ __version__ = "0.23.3"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: methplotlib
3
- Version: 0.23.2
3
+ Version: 0.23.3
4
4
  Summary: Plot nucleotide modification data from nanopore sequencing
5
5
  Home-page: https://github.com/wdecoster/methplotlib
6
6
  Author: Wouter De Coster
@@ -1,19 +1,19 @@
1
1
  methplotlib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  methplotlib/annotation.py,sha256=c-b5bUlVTi2Mc0QDBzsKe4V7N0ETw8BEtvY-e0ZtCjQ,7541
3
3
  methplotlib/helpers.py,sha256=D69CLM_M8D0wNoV4p-ODr81uatfeCBUUzYdifUmjL88,432
4
- methplotlib/import_methylation.py,sha256=XyI52b6GYPDlxm_JbUMFqeDkEMUu8Sg51BcT9a2aEm8,22728
4
+ methplotlib/import_methylation.py,sha256=K9OvjwcjDyEmNBrtU31rllrDjp3CwnjEoJ4J8GgIKKk,23715
5
5
  methplotlib/methplotlib.py,sha256=Gk07ODKVfDlA33SlzgIsqRLP0j1DYng24ku87DyYrXY,6264
6
6
  methplotlib/plots.py,sha256=MPViIwPrrYn_gx_1VYs3ZECthll3OPrbcyoVAC00cLU,14757
7
7
  methplotlib/qc.py,sha256=jvZnkl9KNiZGstcZRt17W3Bngr5z9BmkNPTxrEjJoW4,5350
8
8
  methplotlib/utils.py,sha256=KKdb7R6l7i8oVuybnN5srDc2iB8KDjOPoDpXr6E8nrw,14519
9
- methplotlib/version.py,sha256=yninyH3Qwkx3xw1ShRaTmjGR_Q-bmMjaMjZVzxS2tLM,23
9
+ methplotlib/version.py,sha256=HTz96uK4_QHPX5i3NrEcr4eXcxlyepsy_nU-3niBQe8,23
10
10
  methplotlib/differential/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  methplotlib/differential/differential.py,sha256=YSWUAeMaI_yERj6oAdvyWM3vKn2laTtWp6Y8ZuwvLA4,1773
12
- methplotlib-0.23.2.data/scripts/allele_specific_modification,sha256=PpBdGIiVm8M6OjM0m68OPWnsyDeXJZDnbSNCrH3CaHY,1403
13
- methplotlib-0.23.2.data/scripts/differential_modification,sha256=SZ0odGaykx_cqIHh5tOKSVUCbXOdHR4PSv4Yv6V04Zw,1461
14
- methplotlib-0.23.2.dist-info/licenses/LICENSE,sha256=qan9p7Fjhl7WzXuiZoaXCViH5si1PSKBNm9K2f0_51c,1073
15
- methplotlib-0.23.2.dist-info/METADATA,sha256=RjlPvceeAGuHWJ7kV8NCItOj6vi8Xhm-GQ2C6cDjAW4,5718
16
- methplotlib-0.23.2.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
17
- methplotlib-0.23.2.dist-info/entry_points.txt,sha256=Tav-_W5yZc2G8ApYYuFLfVKU2QugXuEN8z_AjPZwORs,61
18
- methplotlib-0.23.2.dist-info/top_level.txt,sha256=w1XBGUmKUyGeE0_ufRQ6Vi5lMIzDq6TwF587aofDxuQ,12
19
- methplotlib-0.23.2.dist-info/RECORD,,
12
+ methplotlib-0.23.3.data/scripts/allele_specific_modification,sha256=PpBdGIiVm8M6OjM0m68OPWnsyDeXJZDnbSNCrH3CaHY,1403
13
+ methplotlib-0.23.3.data/scripts/differential_modification,sha256=SZ0odGaykx_cqIHh5tOKSVUCbXOdHR4PSv4Yv6V04Zw,1461
14
+ methplotlib-0.23.3.dist-info/licenses/LICENSE,sha256=qan9p7Fjhl7WzXuiZoaXCViH5si1PSKBNm9K2f0_51c,1073
15
+ methplotlib-0.23.3.dist-info/METADATA,sha256=58qJ6B-4UVk72VCdKEvvF8pod_mtaz9qavVJcRTeUtY,5718
16
+ methplotlib-0.23.3.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
17
+ methplotlib-0.23.3.dist-info/entry_points.txt,sha256=Tav-_W5yZc2G8ApYYuFLfVKU2QugXuEN8z_AjPZwORs,61
18
+ methplotlib-0.23.3.dist-info/top_level.txt,sha256=w1XBGUmKUyGeE0_ufRQ6Vi5lMIzDq6TwF587aofDxuQ,12
19
+ methplotlib-0.23.3.dist-info/RECORD,,