Graylab / IgFold

Fast, accurate antibody structure prediction from deep learning on massive set of natural antibodies
Other
319 stars 60 forks source link

ValueError: min() arg is an empty sequence #65

Open johnsnowgo opened 4 months ago

johnsnowgo commented 4 months ago

Hi, I have installed igfold according to the following command: git clone git@github.com:Graylab/IgFold.git, pip install IgFold, conda install -c conda-forge openmm==7.7.0 pdbfixer, conda install -c bioconda abnumber. However, ValueError was reported when I run the example given in the README.md.

from igfold import IgFoldRunner
from igfold.refine.pyrosetta_ref import init_pyrosetta

init_pyrosetta()

sequences = {
    "H": "EVQLVQSGPEVKKPGTSVKVSCKASGFTFMSSAVQWVRQARGQRLEWIGWIVIGSGNTNYAQKFQERVTITRDMSTSTAYMELSSLRSEDTAVYYCAAPYCSSISCNDGFDIWGQGTMVTVS",
    "L": "DVVMTQTPFSLPVSLGDQASISCRSSQSLVHSNGNTYLHWYLQKPGQSPKLLIYKVSNRFSGVPDRFSGSGSGTDFTLKISRVEAEDLGVYFCSQSTHVPYTFGGGTKLEIK"
}
pred_pdb = "my_antibody.pdb"

igfold = IgFoldRunner()
igfold.fold(
    pred_pdb, # Output PDB file
    sequences=sequences, # Antibody sequences
    do_refine=True, # Refine the antibody structure with PyRosetta
    do_renum=True, # Renumber predicted antibody structure (Chothia)
)

Error info was as following:

Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "path_to_IgFold/igfold/IgFoldRunner.py", line 106, in fold
   model_out=fold(
 File "path_to_IgFold/igfold/utils/folding.py", line 219, in fold
   best_model_i = scores.index(min(scores))
ValueError: min() arg is an empty sequence

I saw the similar error were arose in https://github.com/Graylab/IgFold/issues/31. But I can't solve this problem by run pip install .. Could you please help me to fix. THX.

NooriFatima commented 3 months ago

Facing the same issue. This occurs when there are no model checkpoints to load in. I've pip installed both IgFolds but the weights aren't being brought in through it. I'll update if I find a fix!

NooriFatima commented 3 months ago

I figured out the issue: if you put this python file outside of the git igfold (without the folder trained_models), the checkpoint file array is empty. If you put the file inside the igfold folder and have done pip install igfold, it'll import the checkpoint files from the pip install without getting confused about paths. I hope that helps!

johnsnowgo commented 3 months ago

I figured out the issue: if you put this python file outside of the git igfold (without the folder trained_models), the checkpoint file array is empty. If you put the file inside the igfold folder and have done pip install igfold, it'll import the checkpoint files from the pip install without getting confused about paths. I hope that helps!

Can you describe how you solved it in more detail? Which python file needs to be moved after git clone git@github.com:Graylab/IgFold.git before executing pip install IgFold?

NooriFatima commented 3 months ago

I figured out the issue: if you put this python file outside of the git igfold (without the folder trained_models), the checkpoint file array is empty. If you put the file inside the igfold folder and have done pip install igfold, it'll import the checkpoint files from the pip install without getting confused about paths. I hope that helps!

Can you describe how you solved it in more detail? Which python file needs to be moved after git clone git@github.com:Graylab/IgFold.git before executing pip install IgFold?

So I made a file using the code in the README that takes in sequence and pred_pdb name, and was running it in of the IgFold directory that's generated by doing the git clone step. However, when the file runs import igfold, it brings in the igfold subdirectory in IgFold/igfold instead of importing the igfold folder installed in the python packages directory through the pip install step. The package directory has trained models pre-trained weights, the git clone directory does not. So I simply moved my file into the IgFold/igfold directory so it stopped importing the wrong path. Let me know if you have any further questions! Also, order of installation/moving the file doesn't matter here. Only file path.