sbol2.partshop
¶
Module Contents¶
Classes¶
A class which provides an API front-end for |
- class sbol2.partshop.PartShop(url, spoofed_url='')¶
A class which provides an API front-end for online bioparts repositories
- _validate_url(self, url, url_name)¶
Function to validate url with type checking, urlparse and terminal forward slash’s as well as allowing spoofed url to pass as ‘’
- property logger(self)¶
- abstract count(self)¶
Return the count of objects contained in a PartShop
- spoof(self, spoofed_url)¶
- sparqlQuery(self, query)¶
Issue a SPARQL query :param query: the SPARQL query :return: the HTTP response object
- pull(self, uris, doc, recursive=True)¶
Retrieve an object from an online resource :param uris: A list of SBOL objects you want to retrieve, or a single SBOL object URI :param doc: A document to add the data to :param recursive: Whether the GET request should be recursive :return: nothing (doc parameter is updated, or an exception is thrown)
- submit(self, doc, collection='', overwrite=0)¶
Submit a SBOL Document to SynBioHub :param doc: The Document to submit :param collection: The URI of a SBOL Collection to which the Document contents will be uploaded :param overwrite: An integer code: 0 (default) - do not overwrite, 1 - overwrite, 2 - merge :return: the HTTP response object
- _uri2url(self, uri)¶
Converts an SBOL URI to a URL for running queries to a SynBioHub endpoint.
- remove(self, uri)¶
- login(self, user_id, password='')¶
In order to submit to a PartShop, you must login first. Register on [SynBioHub](http://synbiohub.org) to obtain account credentials. :param user_id: User ID :param password: User password :return: the HTTP response object
- getKey(self)¶
- getURL(self)¶
- getUser(self)¶
- getSpoofedURL(self)¶
- attachFile(self, top_level_uri, filepath)¶
Attach a file to an object in SynBioHub.
Returns None if successful.
Raises SBOLError with code SBOL_ERROR_HTTP_UNAUTHORIZED if it there is an HTTP Unauthorized response.
Raises SBOLError with code SBOL_ERROR_BAD_HTTP_REQUEST on any other HTTP error. The actual status code is embedded in the string message.
- downloadAttachment(self, attachment_uri, filepath='.')¶
Download a file attachment from SynBioHub. :param attachment_uri: The URI of the file to download :param filepath: The local path or filename to which the file will be written Returns None if successful.
Raises EnvironmentError if the filepath is invalid
Raises SBOLError with code SBOL_ERROR_HTTP_UNAUTHORIZED if it there is an HTTP Unauthorized response.
Raises SBOLError with code SBOL_ERROR_BAD_HTTP_REQUEST on any other HTTP error. The actual status code is embedded in the string message.
- _make_search_item(self, item: dict) sbol2.identified.Identified ¶
- _search(self, url: str) List[sbol2.identified.Identified] ¶
Given a URL, perform the search and parse the results. The URL is formed by one of the other search methods: search_exact, search_general, and search_advanced.
- search_general(self, search_text: str, object_type: Optional[str] = SBOL_COMPONENT_DEFINITION, offset: int = 0, limit: int = 25) List[sbol2.identified.Identified] ¶
- search_exact(self, search_text: str, object_type: Optional[str] = SBOL_COMPONENT_DEFINITION, property_uri: Optional[str] = None, offset: int = 0, limit: int = 25) List[sbol2.identified.Identified] ¶
- search_advanced(self, search_query: sbol2.SearchQuery)¶
- search(self, search_text: Union[str, sbol2.SearchQuery], object_type: Optional[str] = SBOL_COMPONENT_DEFINITION, property_uri: Optional[Union[str, int]] = None, offset: int = 0, limit: int = 25) List[sbol2.identified.Identified] ¶
- _search_count(self, url)¶
- search_count(self, search_text, object_type, property_uri)¶
- search_count_advanced(self, search_query)¶
- searchCount(self, search_text, object_type=None, property_uri=None)¶
Returns the number of records matching the given criteria.