saketkc / pysradb

Package for fetching metadata and downloading data from SRA/ENA/GEO
https://saketkc.github.io/pysradb
BSD 3-Clause "New" or "Revised" License
307 stars 50 forks source link

UnboundLocalError #160

Closed BiomedicLJZ closed 2 years ago

BiomedicLJZ commented 2 years ago

Describe the bug `UnboundLocalError Traceback (most recent call last) Input In [7], in <cell line: 3>() 1 from pysradb import SRAweb 2 db = SRAweb() ----> 3 df = db.sra_metadata('SRP098789') 4 df.head()

File ~\PycharmProjects\Tools\venv\lib\site-packages\pysradb\sraweb.py:516, in SRAweb.sra_metadata(self, srp, sample_attribute, detailed, expand_sample_attributes, output_read_lengths, **kwargs) 514 experiment_record["sample_title"] = exp_sample_name 515 experiment_record["instrument"] = exp_instrument --> 516 experiment_record["instrument_model"] = exp_platform_model 517 experiment_record["instrument_model_desc"] = exp_platform_desc 518 experiment_record["total_spots"] = exp_total_spots

` To Reproduce from pysradb import SRAweb db = SRAweb() df = db.sra_metadata('any data') df.

Desktop (please complete the following information):

Additional context I just used this oackage a week ago with this exact structure and worked fine imagen_2022-05-24_222235489

BiomedicLJZ commented 2 years ago

Also important to Report that the python env ist completely clean and that the code works in Google colab but i need it to be able to run in local

saketkc commented 2 years ago

Thanks, we should have caught this (seems to be coming from a change at the NCBI end though). Can you try pulling from the master branch and retry?

pip install git+https:://github.com/saketkc/pysradb
jbmorlot commented 2 years ago

Works for me, thanks!

phyden commented 2 years ago

Hi. Thanks for fixing this problem. We also encountered it just today and wanted to report this..

Not neccessary at this point anymore. But here's our solution: it seems like xmltodict 0.13.0 is causing the problem. Downgrading it to 0.12.0 solved it for us.

edit: xmltodict 0.13.0 uses dict instead of OrderedDict now (as reported in the issue tracker of xmltodict)

saketkc commented 2 years ago

Thanks. This should now be fixed in v.1.4.