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

Error in update method (get_mgds) #8

Open
GLHolliday79 opened this issue Jan 7, 2022 · 1 comment
Open

Error in update method (get_mgds) #8

GLHolliday79 opened this issue Jan 7, 2022 · 1 comment

Comments

@GLHolliday79
Copy link

There appears to be an issue with the update method, specifically in the get_mgds method. At least one of the mgd ids appears to be simply "M" which causes the code to fall over.

Line 187 in database.py. I solved this by:

def get_mgds(self, hgnc):
    mgds = []

    if 'mgd_id' in hgnc:

        for mgd in hgnc['mgd_id']:

            if mgd not in self.mgds:
                try:
                    mgdid = int(mgd.split(':')[-1])
                except ValueError:
                    mgdid = None
                if mgdid:
                    self.mgds[mgd] = models.MGD(mgdid=mgdid)
                    mgds.append(self.mgds[mgd])

    return mgds

However, I'm not sure if the real issue is in the download or not.

@bgriffen
Copy link

bgriffen commented Nov 17, 2022

Indeed, there is an error whilst running pyhgnc.update().

File ~/miniforge3/lib/python3.8/site-packages/pyhgnc/manager/database.py:195, in DbManager.get_mgds(self, hgnc)
    192 for mgd in hgnc['mgd_id']:
    194     if mgd not in self.mgds:
--> 195         mgdid = int(mgd.split(':')[-1])
    196         self.mgds[mgd] = models.MGD(mgdid=mgdid)
    198     mgds.append(self.mgds[mgd])

ValueError: invalid literal for int() with base 10: ''

Happens on multiple systems, versions and OSs. Indeed the work around by @GLHolliday79 works! Thanks.

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

2 participants