Giter VIP home page Giter VIP logo

Comments (4)

cokelaer avatar cokelaer commented on July 20, 2024

@lionel-spinelli thanks for using bioservices status is not ok with Server Error is indeed an error on psiciquic server.

Do you have a workable snippet to provide so I can test myself ? could be that the length of the final query is too long. There are limitations indeed regarding the length of the URL but this is a general issue. I have not update this service for a long time. Thera are maybe some new interface based on the POST request (rather than GET) that I can check out for you. If you provide an example this will help me to start with this issue and give more feedback. best

from bioservices.

lionel-spinelli avatar lionel-spinelli commented on July 20, 2024

Hello @cokelaer ,

thanks a lot for your response. Here is an extraction/modification of my code as example (you may have to simplify it for testing). Let me know if it is clear enough :


self.psicquicDatabase = "InnateDB"
self.speciesName = "Homo_Sapiens"
self.speciesCodeDict ={}
self.speciesCodeDict[ self.speciesName ] = "9606"
self.DOWNLOAD_BATCH_SIZE = 100
database_interactions_count = (the number of interaction in the queried database retrieved previously through the PSICQUIC service)


# Divide the quantity of interactions in different batches
batch_number = ( database_interactions_count // self.DOWNLOAD_BATCH_SIZE) + 1

# Loop over query batches to get all interactions since a single query is not authorized
for batch_id in range( batch_number ):

    # get the list of interaction in the current batch
    interaction_list = psicquic_service.query( service=self.psicquicDatabase.lower(),
                                             query="species:" + str( self.speciesCodeDict[ self.speciesName ]),
                                             output="xml25",
                                             version="current",
                                             firstResult=1 + batch_id * self.DOWNLOAD_BATCH_SIZE,
                                             maxResults=min( (batch_id+1) * self.DOWNLOAD_BATCH_SIZE, database_interactions_count)
                                                       )

     # save the list of the interactions to XML file
     print( "|-- writing XML file...")
     with open( os.path.join( self.output_path, self.speciesName + "_" + self.psicquicDatabase + "_batch" + str( batch_id) + ".xml" ),
                 "wb" ) as output_file:
         pickle.dump( interaction_list, output_file )

     # wait before new request to avoid black listing from psicquic servers
      print( "|-- waiting before new request..." )
      time.sleep( 3)

from bioservices.

cokelaer avatar cokelaer commented on July 20, 2024

I see that you are using xml25 as output. I tried a simple example on another database nad got a 500 error. Using the default output set to tab25 worked. This example retrieves 100 results but fails:

p.query("intact", "species:9606", output="xml25",firstResult=1000, maxResults=1100)

while this one works:

p.query("intact", "species:9606", output="xml25",firstResult=1000, maxResults=1100)

extended to 1000 queries, it works as well:

p.query("intact", "species:9606", output="tab25",firstResult=1000, maxResults=1100)

Not sure why but looks like an issue on the server side. Using tab25 is easier to parse but you may miss some information.

from bioservices.

lionel-spinelli avatar lionel-spinelli commented on July 20, 2024

Hello,

thanks for your test. You are perfectly right : the tab25 output works while the xml25 does not. I am even able to query the whole databse at once. I would never have though it could be a format issue... Unfortunatly, the XML structure is largely better to parse because it is highly structured...
I will go and check on the Psicquic side if they have some clue about this output format issue.

Thanks again for your test and for finding me the reason of theses issues..
Lionel

from bioservices.

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.