Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_sid_generation(self):
open_cga_client = OpenCGAClient(self.configuration, user='pepe', pwd='pepe')
expect(open_cga_client.session_id).to.equal('XOkCfKX09FV0YyPJCBvd')
open_cga_client = OpenCGAClient(self.configuration, session_id='XOkCfKX09FV0YyPJCBvd')
expect(open_cga_client.session_id).to.equal('XOkCfKX09FV0YyPJCBvd')
open_cga_client.projects.info('pt')
expect(httpretty.last_request()).to.have.property(
"headers").which.have.property('headers').which.should.equal(['Host: mock-opencga\r\n',
'Connection: keep-alive\r\n',
'Accept-Encoding: gzip\r\n',
'Accept: */*\r\n',
'User-Agent: python-requests/2.17.3\r\n',
'Authorization: Bearer XOkCfKX09FV0YyPJCBvd\r\n']
)
def test_pagination(self):
open_cga_client = OpenCGAClient(self.configuration, session_id='XOkCfKX09FV0YyPJCBvd')
r = open_cga_client.files.search(study='st')
expect(len(r.get())).equal_to(10000)
r = open_cga_client.files.search(study='st', limit=500)
expect(len(r.get())).equal_to(500)
for batch in open_cga_client.analysis_variant.query(5001, data={}):
expect(len(batch.get())).lower_than_or_equal_to(5001)
def test_sid_generation(self):
open_cga_client = OpenCGAClient(self.configuration, user='pepe', pwd='pepe')
expect(open_cga_client.session_id).to.equal('XOkCfKX09FV0YyPJCBvd')
open_cga_client = OpenCGAClient(self.configuration, session_id='XOkCfKX09FV0YyPJCBvd')
expect(open_cga_client.session_id).to.equal('XOkCfKX09FV0YyPJCBvd')
open_cga_client.projects.info('pt')
expect(httpretty.last_request()).to.have.property(
"headers").which.have.property('headers').which.should.equal(['Host: mock-opencga\r\n',
'Connection: keep-alive\r\n',
'Accept-Encoding: gzip\r\n',
'Accept: */*\r\n',
'User-Agent: python-requests/2.17.3\r\n',
'Authorization: Bearer XOkCfKX09FV0YyPJCBvd\r\n']
)
def test_extra_parameters(self):
open_cga_client = OpenCGAClient(self.configuration, session_id='XOkCfKX09FV0YyPJCBvd')
open_cga_client.projects.info('pt', extra='as_argument', **{'extra2': 'as_kwargs'})
expect(httpretty.last_request()).to.have.property(
"querystring").which.should.have.key('extra').which.should.equal(['as_argument'])
expect(httpretty.last_request()).to.have.property(
"querystring").which.should.have.key('extra2').which.should.equal(['as_kwargs'])
from pyopencga.rest_clients._parent_rest_clients import _ParentBasicCRUDClient, _ParentAclRestClient, _ParentAnnotationSetRestClient
class Cohorts(_ParentBasicCRUDClient, _ParentAclRestClient, _ParentAnnotationSetRestClient):
"""
This class contains method for Cohorts ws (i.e, update, create)
"""
def __init__(self, configuration, session_id=None, login_handler=None, *args, **kwargs):
_category = 'cohorts'
super(Cohorts, self).__init__(configuration, _category, session_id, login_handler, *args, **kwargs)
def aggregation_stats(self, **options):
"""
Fetch catalog cohort stats
URL: /{apiVersion}/cohorts/aggregationStats
:param study: Study [[user@]project:]study where study and project can be either the id or alias
:param type: Type
from pyopencga.rest_clients._parent_rest_clients import _ParentBasicCRUDClient, _ParentAclRestClient, _ParentAnnotationSetRestClient
class Files(_ParentBasicCRUDClient, _ParentAclRestClient, _ParentAnnotationSetRestClient):
"""
This class contains methods for the Files webservices
"""
def __init__(self, configuration, session_id=None, login_handler=None, *args, **kwargs):
_category = 'files'
super(Files, self).__init__(configuration, _category, session_id, login_handler, *args, **kwargs)
def aggregation_stats(self, **options):
"""
Fetch catalog file stats
URL: /{apiVersion}/files/aggregationStats
:param study: study [[user@]project:]study where study and project can be either the id or alias
:param name: name
from pyopencga.rest_clients._parent_rest_clients import _ParentBasicCRUDClient, _ParentAclRestClient
class Panels(_ParentBasicCRUDClient, _ParentAclRestClient):
"""
This class contains the methods for Panels webservices
"""
def __init__(self, configuration, session_id=None, login_handler=None, *args, **kwargs):
_category = 'panels'
super(Panels, self).__init__(configuration, _category, session_id, login_handler, *args, **kwargs)
def search(self, **options):
"""
Panel search
URL: /{apiVersion}/panels/search
:param study: Study [[user@]project:]study
:param name: Panel name
from pyopencga.rest_clients._parent_rest_clients import _ParentBasicCRUDClient, _ParentAclRestClient
class Jobs(_ParentBasicCRUDClient, _ParentAclRestClient):
"""
This class cotains methods for the Jobs webservice
"""
def __init__(self, configuration, session_id=None, login_handler=None, *args, **kwargs):
_category = 'jobs'
super(Jobs, self).__init__(configuration, _category, session_id, login_handler, *args, **kwargs)
def search(self, **options):
"""
Job search method
URL: /{apiVersion}/jobs/search
:param study: study [[user@]project:]study where study and project can be either the id or alias
:param name: name
from pyopencga.rest_clients._parent_rest_clients import _ParentBasicCRUDClient
class Projects(_ParentBasicCRUDClient):
"""
This class contains method for Projects webservices
"""
def __init__(self, configuration, session_id=None, login_handler=None, *args, **kwargs):
_category = "projects"
super(Projects, self).__init__(configuration, _category, session_id, login_handler, *args, **kwargs)
def aggregation_stats(self, project, **options):
"""
Fetch catalog project stats
URL: /{apiVersion}/projects/{projects}/aggregationStats
:param project: project id
:param default: calculate default stats (bool)
from pyopencga.rest_clients._parent_rest_clients import _ParentBasicCRUDClient, _ParentAclRestClient, _ParentAnnotationSetRestClient
class Samples(_ParentBasicCRUDClient, _ParentAclRestClient, _ParentAnnotationSetRestClient):
"""
This class contains method for Samples webservice
"""
def __init__(self, configuration, session_id=None, login_handler=None, *args, **kwargs):
_category = 'samples'
super(Samples, self).__init__(configuration, _category, session_id, login_handler, *args, **kwargs)
def aggregation_stats(self, **options):
"""
Fetch catalog sample stats
URL: /{apiVersion}/samples/aggregationStats
:param study: study [[user@]project:]study where study and project can be either the id or alias
:param source: Source