Arcadia-Science / ProteinCartography

a pipeline to build similarity maps of protein space
MIT License
27 stars 10 forks source link

AttributeError: 'NoneType' object has no attribute 'services' #72

Closed jasbneal closed 7 months ago

jasbneal commented 10 months ago

I'm trying to pull down the hCG beta subunit protein via UniProt accession number and keep running into an AttributeError. I've tried the command python ProteinCartography/fetch_accession.py -a P0DN86 -o input -f fasta pdb and receive the following error:

Traceback (most recent call last):
  File "/Users/jasmine/ArcadiaScience/ProteinCartography/ProteinCartography/fetch_accession.py", line 94, in <module>
    main()
  File "/Users/jasmine/ArcadiaScience/ProteinCartography/ProteinCartography/fetch_accession.py", line 87, in main
    fetch_fasta(accession, output_dir)
  File "/Users/jasmine/ArcadiaScience/ProteinCartography/ProteinCartography/fetch_accession.py", line 48, in fetch_fasta
    u = UniProtWithExpBackoff()
  File "/Users/jasmine/ArcadiaScience/ProteinCartography/ProteinCartography/api_utils.py", line 59, in __init__
    u.services.settings.MAX_RETRIES = DefaultExpBackoffRetry()
AttributeError: 'NoneType' object has no attribute 'services'

I looked at line 59 of the api_utils.py file and u.services.settings.MAX_RETRIES = DefaultExpBackoffRetry() seems to be the issue. Is this a problem with bioservices or am I doing something completely wrong? I also checked to make sure that bioservices is included in the cartography_tindy conda environment.

Screen Shot 2023-10-29 at 7 01 02 PM Screen Shot 2023-10-29 at 6 53 43 PM

mezarque commented 10 months ago

(note for PC dev team):

change:

class UniProtWithExpBackoff(UniProt):
    """
    Specialize the UniProt class to set the MAX_RETRIES to be a DefaultExpBackoffRetry
    object.
    """

    def __init__(self, *args, **kwargs):
        u = super().__init__(*args, **kwargs)
        u.services.settings.MAX_RETRIES = DefaultExpBackoffRetry()

to:

class UniProtWithExpBackoff(UniProt):
    """
    Specialize the UniProt class to set the MAX_RETRIES to be a DefaultExpBackoffRetry
    object.
    """

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.services.settings.MAX_RETRIES = DefaultExpBackoffRetry()
mezarque commented 7 months ago

This should be resolved as of the most recent release.