ValueError: could not convert string to float: 'LogLikelihood' and TypeError: Cannot cast array data from dtype('O') to dtype('float64') according to the rule 'safe'

Issue #28 resolved
刘梓峰 created an issue
### Welcome to iPHoP ###
Looks like everything is now set up, we will first clean up the input file, and then we will start the host prediction steps themselves
[1/1/Run] Running blastn against genomes...
[1/3/Run] Get relevant blast matches...
[2/1/Run] Running blastn against CRISPR...
[2/2/Run] Get relevant crispr matches...
[3/1/Run] Running WIsH...
[3/2/Run] Get relevant WIsH hits...
[4/1/Run] Running VHM s2 similarities...
[4/2/Run] Get relevant VHM hits...
[5/1/Run] Running PHP...
[5/2/Run] Get relevant PHP hits...
[6/1/Run] Running RaFAH...
[6/2/Run] Get relevant RaFAH scores...
[6.5/1/Run] Running Diamond comparison to RaFAH references...
[6.5/2/Run] Get AAI distance to RaFAH refs...
write
[7] Aggregating all results and formatting for TensorFlow...
[7/1] Loading all parsed data...
Traceback (most recent call last):
  File "pandas/_libs/parsers.pyx", line 1095, in pandas._libs.parsers.TextReader._convert_tokens
TypeError: Cannot cast array data from dtype('O') to dtype('float64') according to the rule 'safe'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/hl/zhoumengqing/anaconda3/envs/ViWrap/ViWrap-iPHoP/bin/iphop", line 10, in <module>
    sys.exit(cli())
  File "/hl/zhoumengqing/anaconda3/envs/ViWrap/ViWrap-iPHoP/lib/python3.8/site-packages/iphop/iphop.py", line 122, in cli
    args["func"](args)
  File "/hl/zhoumengqing/anaconda3/envs/ViWrap/ViWrap-iPHoP/lib/python3.8/site-packages/iphop/modules/master_predict.py", line 94, in main
    dataprep.aggregate(args)
  File "/hl/zhoumengqing/anaconda3/envs/ViWrap/ViWrap-iPHoP/lib/python3.8/site-packages/iphop/modules/dataprep.py", line 32, in aggregate
    load_all_signal(args,check_host,store)
  File "/hl/zhoumengqing/anaconda3/envs/ViWrap/ViWrap-iPHoP/lib/python3.8/site-packages/iphop/modules/dataprep.py", line 417, in load_all_signal
    df_wish = pd.read_csv(args["wishparsed"],delimiter=',',quotechar='"',dtype={'Virus': "string",'Host': "string",'Ll' : "float",'P-value' : "float",'WiSHrank' : "int"})
  File "/hl/zhoumengqing/anaconda3/envs/ViWrap/ViWrap-iPHoP/lib/python3.8/site-packages/pandas/util/_decorators.py", line 311, in wrapper
    return func(*args, **kwargs)
  File "/hl/zhoumengqing/anaconda3/envs/ViWrap/ViWrap-iPHoP/lib/python3.8/site-packages/pandas/io/parsers/readers.py", line 586, in read_csv
    return _read(filepath_or_buffer, kwds)
  File "/hl/zhoumengqing/anaconda3/envs/ViWrap/ViWrap-iPHoP/lib/python3.8/site-packages/pandas/io/parsers/readers.py", line 488, in _read
    return parser.read(nrows)
  File "/hl/zhoumengqing/anaconda3/envs/ViWrap/ViWrap-iPHoP/lib/python3.8/site-packages/pandas/io/parsers/readers.py", line 1047, in read
    index, columns, col_dict = self._engine.read(nrows)
  File "/hl/zhoumengqing/anaconda3/envs/ViWrap/ViWrap-iPHoP/lib/python3.8/site-packages/pandas/io/parsers/c_parser_wrapper.py", line 223, in read
    chunks = self._reader.read_low_memory(nrows)
  File "pandas/_libs/parsers.pyx", line 801, in pandas._libs.parsers.TextReader.read_low_memory
  File "pandas/_libs/parsers.pyx", line 880, in pandas._libs.parsers.TextReader._read_rows
  File "pandas/_libs/parsers.pyx", line 1026, in pandas._libs.parsers.TextReader._convert_column_data
  File "pandas/_libs/parsers.pyx", line 1101, in pandas._libs.parsers.TextReader._convert_tokens
ValueError: could not convert string to float: 'LogLikelihood'

Sorry to bother you again, and now there is such a problem again, the data I use is the simulated data you provided. I don't know how to solve this problem now.

Comments (13)

  1. Simon Roux repo owner

    This looks like an error in the output file from wish and/or the wrong version of pandas is installed. Can you check what the content of the file “wishparsed.csv” is ?

  2. 刘梓峰 Account Deactivated reporter
    Virus,Host,Ll,P-value,WiSHrank
    Phage,Best hit among provided hosts,LogLikelihood,p-value if null parameters provided,1
    IMGVR_UViG_3300013456_000001,GCF_003852405.1,-1.33672,0.0257105,1
    IMGVR_UViG_3300013274_000001,GCF_000422885.1,-1.33835,0.034663,1
    MT657335.1,GCF_009745975.1,-1.21802,6.21903e-06,1
    AJ421943.1,GCF_000686805.1,-1.34353,0.0936964,1
    CP017905.1,GCF_000354175.2,-1.33567,0.00657399,1
    

    The content of the file “wishparsed.csv“ looks fine,pandas vierson in anconda3 is 1.3.2 and WIsH version also is all right

  3. Simon Roux repo owner

    Actually, the “wishparsed.csv” file does not look fine: the second line (starting “Phage” and ending with “,1”) should not be there. I recommend removing it, removing all the files starting with “matrix…” in the Wdir folder, and try to run iPHoP again.

  4. 刘梓峰 Account Deactivated reporter

    Hi,Simon

    Thank you very much , i removed the second line , its done well !

    best,

    liu

  5. 刘梓峰 Account Deactivated reporter

    Hi,

    Is there a way to modify a script so that it does not generate wrong lines?

  6. Simon Roux repo owner

    So the way I understand it, the problem is with the WIsH output. Do you use the WIsH program provided with iPHoP or did you install it on your own ? And if the latter, did you check the version you installed ?

  7. 刘梓峰 Account Deactivated reporter

    I used on my own (use the command “ln -s “ replace the WIsH program provided with IPHoP),it is because the program that came with it before failed to run(the wrong word is “Segmentation fault“),so i replace it with my own

  8. 刘梓峰 Account Deactivated reporter

    Changing to the 2017 version of WIsH to run will still cause the same error result. It is estimated that we can only modify the program of WIsH itself

  9. Simon Roux repo owner

    I’m not sure if you tried it and it failed, or if this is an “estimation” (prediction ?), but using one of the previous versions of WIsH that provides the output in the format expected by iPHoP will definitely work. Although of course, you can also change this format in the WIsH code itself and recompile, that would be the same in the end.

  10. Log in to comment