alphafold_pytorch icon indicating copy to clipboard operation
alphafold_pytorch copied to clipboard

KeyError: 'X'

Open Lorenzo360 opened this issue 4 years ago • 5 comments

I found that an error for some input sequences is produced if an alignment during the feature generation pipeline contains the amino acid place holder X:

KeyError: 'X' Traceback (most recent call last): File "feature.py", line 263, in <module> feature_generation(SEQ_FILE, OUT_FILE) File "feature.py", line 194, in feature_generation non_gapped_profile[i, mapping[j]] += 1

I could solve the problem by replacing line 194 in feature.py with: if (j!='X'): non_gapped_profile[i, mapping[j]] += 1

Lorenzo360 avatar Apr 28 '20 17:04 Lorenzo360

I got the same error. Did you also get a segmentation fault when executing PSI-BLAST?

sean-lin-tw avatar Jun 02 '20 00:06 sean-lin-tw

I had a segmentation fault with psi-blast 2.10 but it seems to work with ver 2.9 : You 'll find at -> ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.9.0/ncbi-blast-2.9.0+-x64-linux.tar.gz

NicolasBelloy avatar Jun 06 '20 09:06 NicolasBelloy

---     mapping = {aa: i for i, aa in enumerate('ARNDCQEGHILKMFPSTWYV-')}
+++     mapping = {aa: i for i, aa in enumerate('ARNDCQEGHILKMFPSTWYVX-')}
---     non_gapped_profile = np.zeros((L, 21), dtype=np.float32)
+++     non_gapped_profile = np.zeros((L, 22), dtype=np.float32)
        for i in range(L):
            for j in aln[:, i]:
                non_gapped_profile[i, mapping[j]] += 1
        non_gapped_profile[:, -1] = 0
+++     non_gapped_profile = np.delete(non_gapped_profile, non_gapped_profile.shape[1] - 1, 1)
        non_gapped_profile /= non_gapped_profile.sum(-1).reshape(-1, 1)

Is this modification in feature.py better to handle the residue X?

tirear avatar Sep 11 '20 08:09 tirear

I had this issue as well. The code change above fixed it. It would be nice to add it to the repository. If you would like, I can open a pull request with these changes.

Tass0sm avatar Dec 28 '20 21:12 Tass0sm

  • How to solute this problem.
  • Anyone please give me solutions.

Planet-KIM avatar Mar 22 '21 09:03 Planet-KIM