JK-Liu7 / AttentionMGT-DTA

25 stars 4 forks source link

脚本“ Protein_process.py”第 300 行出现问题 #9

Open angeload opened 6 months ago

angeload commented 6 months ago

感谢您在 GitHub 上提供代码。 我很抱歉用英语写,但我更喜欢这种语言,因为我不确定谷歌翻译是否能正确表达文本。

I have succeed to execute part of your code. Unfortunately, in line 300 of "Protein_embedding_process" method in the script "protein_process.py", there is an error caused by np_save method. Since each protein has a different ESM lenght, it seems that the np_save can not deal with them and rises the following error:

Exception has occurred: ValueError
setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (19964,) + inhomogeneous part.
  File "/Users/angelo/Documents/FIOCRUZ/Repo3D/AttentionMGT-DTA_repo3d/ang_protein_process.py", line 337, in Protein_embedding_process
    np.save(dir_output + '/train/fold/' + str(fold) + '/protein_embedding.npy', proteins_embedding_train)
  File "/Users/angelo/Documents/FIOCRUZ/Repo3D/AttentionMGT-DTA_repo3d/ang_protein_process.py", line 391, in <module>
    Protein_embedding_process(dataset=dataset, fold=fold, id_train=protein_id_train, id_test=protein_id_test, dir_output=dir_output)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (19964,) + inhomogeneous part.

Could you please indicate a solution for this problem or explain how you solve it in your execution?

Best regards.

ChangLi-tt commented 5 months ago

Excuse me, how did you solve the problem?

angeload commented 5 months ago

Two possible solutions:

1) Use pickle.dump instead of np.save 2) Use np.vstack to rearranje the proteins_embedding_train array beofre useing np.save

Even solve the np.sabe pronblem there are still other problems. The script train.py rises error when using those files and I do nto know how to solve it. I hope the authors can give some solution.