Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'X' #8

Open
Lorenzo360 opened this issue Apr 28, 2020 · 5 comments
Open

KeyError: 'X' #8

Lorenzo360 opened this issue Apr 28, 2020 · 5 comments

Comments

@Lorenzo360
Copy link

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

@sean-lin-tw
Copy link

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

@NicolasBelloy
Copy link

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

@tirear
Copy link

tirear commented Sep 11, 2020

---     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?

@Tass0sm
Copy link

Tass0sm commented Dec 28, 2020

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.

@Planet-KIM
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants