volkamerlab/teachopencadd

T008 - module 'Bio' has no attribute 'Alphabet

Ash100 opened this issue · 5 comments

Ash100 commented

Hello Everyone,
I am learning by running some tutorials T008. I am supposed to run
results = align(complexes, method=METHODS["mda"])

I am having the following error;

AttributeError Traceback (most recent call last)
in <cell line: 1>()
----> 1 results = align(complexes, method=METHODS["mda"])

4 frames
/usr/local/lib/python3.10/dist-packages/opencadd/structure/superposition/sequences.py in fasta2select(fastafilename, ref_resids, ref_segids, target_resids, target_segids, backbone_selection)
113
114 """
--> 115 protein_gapped = Bio.Alphabet.Gapped(Bio.Alphabet.IUPAC.protein)
116 with open(fastafilename) as fasta:
117 alignment = Bio.AlignIO.read(fasta, "fasta", alphabet=protein_gapped)

AttributeError: module 'Bio' has no attribute 'Alphabet'

Would you please guide me, how to address this issue of alphabet?


Ash100 commented

I installed biopython=1.77, but it generated the same error. As a pure biologist, I read the installation instructions but was unable to reproduce them, therefore, I tried this way, open a new Jupyter notebook, and install the following stuff one by one.
'!pip install biopython==1.77'
'!pip install rdkit'
'!pip install biotite'
'!pip install pypdb'
'!pip install nglview'
'!pip install requests-cache'
'!pip install ipywidgets'
'!pip install git+https://github.com/volkamerlab/opencadd.git'
'!pip install MDAnalysis'
'!pip install redo'

Then, I used the import scripts mentioned there, and all the scripts till,
'results = align(complexes, method=METHODS["mda"])' worked properly.

How I installed these packages?
I run the import script, and following the error, took help from google and keep installing each package as mentioned above.

I thought I am doing good.

Best Regards,

Hi Ash, thanks for your reply!

It looks like the environment that you are using for running T008 is not the one where you installed biopython==1.77 as the error AttributeError: module 'Bio' has no attribute 'Alphabet' should only occur from 1.78 on (see here). Are you sure that the environment that you installed all these packages into, is the one that Jupyter Lab is using to run T008?

We cannot easily debug your custom installation, but we can try to help you get the installation as shown on our website to work for you, as that way, you should have all the correct package versions for all talktorials in place.

Can you tell us (a) where you got stuck in the instructions here and (b) which operating system you are using?

An alternative would be to run T008 in the cloud via Binder:
https://mybinder.org/v2/gh/volkamerlab/TeachOpenCADD/master
(installation setup might take a while though)

Ash100 commented

Thank you for your response. As I mentioned earlier, I do not have in-depth knowledge of programming, therefore, I opened a notebook and run the installation scripts (mentioned by you) directly, but that did not work either. Then, I found my local way, and first run the import script mentioned in T008. I knew it will generate an error because nothing was installed. I read all the errors one by one, and from there i figure out what packages I will require, and thus I installed all these packages in notebook individually (mentioned above).
You have asked for the environment, I installed "!pip install biopython==1.77", and it said, successfully installed. Also I am working on Win10, Chrome Browser.

ok, i will try to figure out, how to install those scripts on a notebook. Thank you so much once again

Ash100 commented

I have confirmed the version with,
'print(Bio.version)' that is perfectly fine 1.77.
I included
'from Bio.Alphabet import IUPAC'
'from Bio.Alphabet import Alphabet'
'from Bio.Alphabet import generic_dna, generic_rna, generic_protein'
But now I am having
TypeError: read() got an unexpected keyword argument 'alphabet'