How to use pyopencga - 10 common examples

To help you get started, we’ve selected a few pyopencga examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github opencb / opencga / opencga-client / src / main / python / pyOpenCGA / pyopencga / tests.py View on Github external
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']
                                                                         )
github opencb / opencga / opencga-client / src / main / python / pyOpenCGA / pyopencga / tests.py View on Github external
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)
github opencb / opencga / opencga-client / src / main / python / pyOpenCGA / pyopencga / tests.py View on Github external
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']
                                                                         )
github opencb / opencga / opencga-client / src / main / python / pyOpenCGA / pyopencga / tests.py View on Github external
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'])
github opencb / opencga / opencga-client / src / main / python / pyOpenCGA / pyopencga / rest_clients / cohort_client.py View on Github external
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
github opencb / opencga / opencga-client / src / main / python / pyOpenCGA / pyopencga / rest_clients / file_client.py View on Github external
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
github opencb / opencga / opencga-client / src / main / python / pyOpenCGA / pyopencga / rest_clients / panel_client.py View on Github external
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
github opencb / opencga / opencga-client / src / main / python / pyOpenCGA / pyopencga / rest_clients / job_client.py View on Github external
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
github opencb / opencga / opencga-client / src / main / python / pyOpenCGA / pyopencga / rest_clients / project_client.py View on Github external
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)
github opencb / opencga / opencga-client / src / main / python / pyOpenCGA / pyopencga / rest_clients / sample_client.py View on Github external
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