ValueError: Length of values (5) does not match length of index (2)
Gyuhee-Ahn opened this issue · 4 comments
Recently I've changed PYTHONPATH for other program installation. After that, I cannot run nanostat with fasta option
NanoStat --fasta '/media/sf_sf/barcode06/Trycycler/polish/008_final_polish.fasta'
Traceback (most recent call last):
File "/home/qiime2/miniconda/envs/bandage_env/bin/NanoStat", line 10, in <module>
sys.exit(main())
File "/home/qiime2/miniconda/envs/bandage_env/lib/python3.9/site-packages/nanostat/NanoStat.py", line 93, in main
write_stats(datadfs=[datadf],
File "/home/qiime2/miniconda/envs/bandage_env/lib/python3.9/site-packages/nanomath/nanomath.py", line 193, in write_stats
stats = [Stats(df) for df in datadfs]
File "/home/qiime2/miniconda/envs/bandage_env/lib/python3.9/site-packages/nanomath/nanomath.py", line 193, in <listcomp>
stats = [Stats(df) for df in datadfs]
File "/home/qiime2/miniconda/envs/bandage_env/lib/python3.9/site-packages/nanomath/nanomath.py", line 57, in __init__
self._top5_lengths = get_top_5(df=df,
File "/home/qiime2/miniconda/envs/bandage_env/lib/python3.9/site-packages/nanomath/nanomath.py", line 164, in get_top_5
return df.sort_values(col, ascending=False) \
File "/home/qiime2/miniconda/envs/bandage_env/lib/python3.9/site-packages/pandas/core/frame.py", line 3830, in assign
data[k] = com.apply_if_callable(v, data)
File "/home/qiime2/miniconda/envs/bandage_env/lib/python3.9/site-packages/pandas/core/frame.py", line 3163, in __setitem__
self._set_item(key, value)
File "/home/qiime2/miniconda/envs/bandage_env/lib/python3.9/site-packages/pandas/core/frame.py", line 3242, in _set_item
value = self._sanitize_column(key, value)
File "/home/qiime2/miniconda/envs/bandage_env/lib/python3.9/site-packages/pandas/core/frame.py", line 3899, in _sanitize_column
value = sanitize_index(value, self.index)
File "/home/qiime2/miniconda/envs/bandage_env/lib/python3.9/site-packages/pandas/core/internals/construction.py", line 751, in sanitize_index
raise ValueError(
ValueError: Length of values (5) does not match length of index (2)
However running nanostat with fastq option is still working
NanoStat --fastq '/media/sf_sf/barcode06/Minion_filt80/B5_filt80_sub1.fastq'
General summary:
Mean read length: 14,329.8
Mean read quality: 11.2
Median read length: 10,109.5
Median read quality: 11.3
Number of reads: 16,260.0
Read length N50: 20,930.0
STDEV read length: 12,043.2
Total bases: 233,002,769.0
Number, percentage and megabases of reads above quality cutoffs
>Q5: 16260 (100.0%) 233.0Mb
>Q7: 16260 (100.0%) 233.0Mb
>Q10: 14729 (90.6%) 203.4Mb
>Q12: 2426 (14.9%) 26.6Mb
>Q15: 0 (0.0%) 0.0Mb
Top 5 highest mean basecall quality scores and their read lengths
1: 14.1 (3197)
2: 13.9 (2758)
3: 13.7 (2648)
4: 13.7 (4438)
5: 13.7 (7479)
Top 5 longest reads and their mean basecall quality score
1: 108108 (10.0)
2: 82214 (10.6)
3: 80739 (12.3)
4: 80340 (10.6)
5: 80281 (11.1)
I checked fasta file is intact and have same error with other fasta files
How can I solve this error?
Thanks for reporting this!
Could you let me know the version of your nanomath submodule? You can get that with
python -c "import nanomath ; print(nanomath.__version__)"
The current version is v1.2.1, so if yours is older I would suggest you try upgrading with
pip install nanomath --upgrade
(if you used pip to install NanoStat) or conda upgrade nanomath
(if you used conda to install NanoStat)
Cheers,
Wouter
Thank you for the reply!
python -c "import nanomath ; print(nanomath.__version__)"
showed me 1.2.1
output, so I tried to upgrade with conda upgrade nanomath
(I used conda to install NanoStat)
and libglib is a only package updated (2.68.2-h3e27bee_1 --> 2.68.2-h3e27bee_2)
however nanomath version is still 1.2.1 (checked with python -c "import nanomath ; print(nanomath.__version__)"
) and NanoStat still not working
Upgrade with pip showed me following result
pip install nanomath --upgrade
Requirement already satisfied: nanomath in /home/qiime2/miniconda/envs/py36/lib/python3.7/site-packages (1.2.1)
Requirement already satisfied: numpy>1.8 in /home/qiime2/miniconda/envs/py36/lib/python3.7/site-packages (from nanomath) (1.20.3)
Requirement already satisfied: pandas in /home/qiime2/miniconda/envs/py36/lib/python3.7/site-packages (from nanomath) (1.2.4)
Requirement already satisfied: Python-Deprecated in /home/qiime2/miniconda/envs/py36/lib/python3.7/site-packages (from nanomath) (1.1.0)
Requirement already satisfied: python-dateutil>=2.7.3 in /home/qiime2/miniconda/envs/py36/lib/python3.7/site-packages (from pandas->nanomath) (2.8.1)
Requirement already satisfied: pytz>=2017.3 in /home/qiime2/miniconda/envs/py36/lib/python3.7/site-packages (from pandas->nanomath) (2021.1)
Requirement already satisfied: six>=1.5 in /home/qiime2/miniconda/envs/py36/lib/python3.7/site-packages (from python-dateutil>=2.7.3->pandas->nanomath) (1.16.0)
I'm using Ubuntu 64-bit in virtual box
Thank you again.
If you have version 1.2.1 then there is indeed nothing to upgrade as that is the latest version. Could you perhaps share that fasta file for me to reproduce the issue?
Your fasta file has only 2 reads. NanoStat is not intended for such small datasets. I will add a warning to explain this error, but won't be able to fix this soon as the code for the stats file is... hard to maintain.