wdecoster/methplotlib

No content in the output image and Error reporting

Opened this issue · 1 comments

Hi, I get an error as follow:

1,
my command: ~/miniconda3/envs/OSCC/bin/methplotlib -m /NAS/wg_xialin/pancancer/raw_data/oral/fast5/yyl.T/yyl.T_methy.tsv /NAS/wg_hl/pancancer/OSCC/Methylation/f5c_meth/OSCC3/OSCC3.meth_cov10_freq.format.tsv -w chr1:99678000-99688500 -n calls frequencies --simplify

error:
Input file /NAS/wg_hl/pancancer/OSCC/Methylation/f5c_meth/OSCC3/OSCC3.meth_cov10_freq.format.tsv not recognized!

Detailed error:
Traceback (most recent call last):
File "/home/wg_hl/miniconda3/envs/OSCC/lib/python3.10/site-packages/pandas/core/groupby/groupby.py", line 1871, in _agg_py_fallback
res_values = self.grouper.agg_series(ser, alt, preserve_dtype=True)
File "/home/wg_hl/miniconda3/envs/OSCC/lib/python3.10/site-packages/pandas/core/groupby/ops.py", line 850, in agg_series
result = self._aggregate_series_pure_python(obj, func)
File "/home/wg_hl/miniconda3/envs/OSCC/lib/python3.10/site-packages/pandas/core/groupby/ops.py", line 871, in _aggregate_series_pure_python
res = func(group)
File "/home/wg_hl/miniconda3/envs/OSCC/lib/python3.10/site-packages/pandas/core/groupby/groupby.py", line 2377, in
alt=lambda x: Series(x).mean(numeric_only=numeric_only),
File "/home/wg_hl/miniconda3/envs/OSCC/lib/python3.10/site-packages/pandas/core/series.py", line 6221, in mean
return NDFrame.mean(self, axis, skipna, numeric_only, **kwargs)
File "/home/wg_hl/miniconda3/envs/OSCC/lib/python3.10/site-packages/pandas/core/generic.py", line 11978, in mean
return self._stat_function(
File "/home/wg_hl/miniconda3/envs/OSCC/lib/python3.10/site-packages/pandas/core/generic.py", line 11935, in _stat_function
return self._reduce(
File "/home/wg_hl/miniconda3/envs/OSCC/lib/python3.10/site-packages/pandas/core/series.py", line 6129, in _reduce
return op(delegate, skipna=skipna, **kwds)
File "/home/wg_hl/miniconda3/envs/OSCC/lib/python3.10/site-packages/pandas/core/nanops.py", line 147, in f
result = alt(values, axis=axis, skipna=skipna, **kwds)
File "/home/wg_hl/miniconda3/envs/OSCC/lib/python3.10/site-packages/pandas/core/nanops.py", line 404, in new_func
result = func(values, axis=axis, skipna=skipna, mask=mask, **kwargs)
File "/home/wg_hl/miniconda3/envs/OSCC/lib/python3.10/site-packages/pandas/core/nanops.py", line 720, in nanmean
the_sum = _ensure_numeric(the_sum)
File "/home/wg_hl/miniconda3/envs/OSCC/lib/python3.10/site-packages/pandas/core/nanops.py", line 1693, in _ensure_numeric
raise TypeError(f"Could not convert string '{x}' to numeric")
TypeError: Could not convert string 'chr1' to numeric

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/wg_hl/miniconda3/envs/OSCC/bin/methplotlib", line 10, in
sys.exit(main())
File "/home/wg_hl/miniconda3/envs/OSCC/lib/python3.10/site-packages/methplotlib/methplotlib.py", line 16, in main
meth_data = get_data(args.methylation, args.names, window, args.smooth)
File "/home/wg_hl/miniconda3/envs/OSCC/lib/python3.10/site-packages/methplotlib/import_methylation.py", line 77, in get_data
return [read_meth(f, n, window, smoothen) for f, n in zip(methylation_files, names)]
File "/home/wg_hl/miniconda3/envs/OSCC/lib/python3.10/site-packages/methplotlib/import_methylation.py", line 77, in
return [read_meth(f, n, window, smoothen) for f, n in zip(methylation_files, names)]
File "/home/wg_hl/miniconda3/envs/OSCC/lib/python3.10/site-packages/methplotlib/import_methylation.py", line 56, in read_meth
.mean()
File "/home/wg_hl/miniconda3/envs/OSCC/lib/python3.10/site-packages/pandas/core/groupby/groupby.py", line 2375, in mean
result = self._cython_agg_general(
File "/home/wg_hl/miniconda3/envs/OSCC/lib/python3.10/site-packages/pandas/core/groupby/groupby.py", line 1926, in _cython_agg_general
new_mgr = data.grouped_reduce(array_func)
File "/home/wg_hl/miniconda3/envs/OSCC/lib/python3.10/site-packages/pandas/core/internals/managers.py", line 1428, in grouped_reduce
applied = sb.apply(func)
File "/home/wg_hl/miniconda3/envs/OSCC/lib/python3.10/site-packages/pandas/core/internals/blocks.py", line 366, in apply
result = func(self.values, **kwargs)
File "/home/wg_hl/miniconda3/envs/OSCC/lib/python3.10/site-packages/pandas/core/groupby/groupby.py", line 1923, in array_func
result = self._agg_py_fallback(how, values, ndim=data.ndim, alt=alt)
File "/home/wg_hl/miniconda3/envs/OSCC/lib/python3.10/site-packages/pandas/core/groupby/groupby.py", line 1875, in _agg_py_fallback
raise type(err)(msg) from err
TypeError: agg function failed [how->mean,dtype->object]

2, I have modified the command to the following:
~/miniconda3/envs/OSCC/bin/methplotlib -m /NAS/wg_xialin/pancancer/raw_data/oral/fast5/yyl.T/yyl.T_methy.tsv /NAS/wg_hl/pancancer/OSCC/Methylation/f5c_meth/OSCC3/OSCC3.meth_cov10_freq.format.tsv -w 1:99678000-99688500 -n calls frequencies --simplify

but no content in the output image. May I ask what the reason is and how can I solve it. Thanks.

Hi,

Thank you for reporting this. I will look into this. I don't have an immediate explanation, and due to my parental leave it may take longer to follow up on this.

Cheers,
Wouter