Giter Site home page Giter Site logo

Python Api about pysradb HOT 7 CLOSED

saketkc avatar saketkc commented on June 19, 2024
Python Api

from pysradb.

Comments (7)

saketkc avatar saketkc commented on June 19, 2024 1

why is there no mention or use case scenario of SRAweb() mode in the docs as python API (in the python API usage section). Is it because web mode isn't complete yet?

Partially, yes. And partially because I have been slow at updating the documentation. Most part
is interoperable between the SRAdb and SRAweb mode and as such most of the documentation works for both modes. But, not all.

But then cli commands also use SRAweb() when SRAmetadb.sqlite isn't available locally so it can be used by python files also by importing sraweb module.

The rationale for this design was to return the user some results rather than just failing with an error if SRAmetadb is not specified or present in the current working directory. This might not be the best approach, but I could not think of a better approach when I wrote it. Happy to take suggestions. The ultimate goal is to essentially get rid of the SRAdb mode. But we cannot until search is supported.

from pysradb.

DaasDaham avatar DaasDaham commented on June 19, 2024

It's not broken. You are using SRAdb which requires SRAmetadb.sqlite to be downloaded locally on your machine using $ pysradb metadb command. This explains why a "no such table" error is thrown. The _verify_srametadb() in SRAdb function has a check for this. I too faced this problem as it is not mentioned explicitly in the docs and since it creates a file of the same name entered into SRAdb() function in the current working directory, it interferes with $ pysradb metadata <sra_id> command also since the metadata() function in cli.py has a check to see if there is a database with this name in cwd.
This code, however, would work:-
from pysradb import sraweb
db = sraweb.SRAweb()
df = db.sra_metadata('SRP098789')
df.head()

A few things that can be done:

  1. Mention in the Python API Usage section in docs to download metadb locally on machine before using SRAdb.
  2. Modify the _verify_srametadb() function to throw an error which mentions to run pysradb metadb before running the current command.
  3. Introduce a layer of abstraction just like the cli command $ pysradb metadata <sra_id> to check if db is available locally else use "web" db.
    @saketkc Can I work on this?

from pysradb.

saketkc avatar saketkc commented on June 19, 2024

Thanks @Chokerino for the bug report. I agree its a bug, but the API is not broken. @DaasDaham's findings are indeed correct. We are trying to move away from the SRAmetadb.sqlite usage as it is not up to date and has records missing at random. That said, I still want to keep supporting it until SRAweb mode can support everything that the SRAdb mode (the one relying on local sqlite db) does.

@DaasDaham your suggestions look good! Feel free to send a PR and I will be happy to take a look.

from pysradb.

DaasDaham avatar DaasDaham commented on June 19, 2024

@saketkc Sure, I'll do it

from pysradb.

DaasDaham avatar DaasDaham commented on June 19, 2024

@saketkc why is there no mention or use case scenario of SRAweb() mode in the docs as python API (in the python API usage section). Is it because web mode isn't complete yet?
But then cli commands also use SRAweb() when SRAmetadb.sqlite isn't available locally so it can be used by python files also by importing sraweb module.

from pysradb.

DaasDaham avatar DaasDaham commented on June 19, 2024

Thanks for the clarification!

from pysradb.

saketkc avatar saketkc commented on June 19, 2024

Closed via #31

from pysradb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.