예제 #1
0
파일: heatmap.py 프로젝트: cokelaer/biokit
 def _check_metric(self, value):
     easydev.check_param_in_list(value,
         ['braycurtis', 'canberra', 'chebyshev', 'cityblock',
          'correlation', 'cosine', 'dice', 'euclidean', 'hamming',
          'jaccard', 'kulsinski', 'mahalanobis', 'matching',
          'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean',
          'kalmichener', 'sokalsneath', 'sqeuclidean', 'yule'])
예제 #2
0
 def check_method(self, value):
     # None is possible
     # in R, in addition to single, complete, average, centroid,
     # median and ward
     # there are  ward.D, wardD2 and mcquitty
     # default is complete
     easydev.check_param_in_list(str(value), self.methods)
예제 #3
0
 def _check_metric(self, value):
     easydev.check_param_in_list(value, [
         'braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation',
         'cosine', 'dice', 'euclidean', 'hamming', 'jaccard', 'kulsinski',
         'mahalanobis', 'matching', 'minkowski', 'rogerstanimoto',
         'russellrao', 'seuclidean', 'kalmichener', 'sokalsneath',
         'sqeuclidean', 'yule'
     ])
예제 #4
0
파일: linkage.py 프로젝트: biokit/biokit
 def check_method(self, value):
     # None is possible
     # in R, in addition to single, complete, average, centroid, 
     # median and ward
     # there are  ward.D, wardD2 and mcquitty
     # default is complete
     return
     from biokit.viz.commons import valid_methods
     easydev.check_param_in_list(str(value), valid_methods)
예제 #5
0
 def check_method(self, value):
     # None is possible
     # in R, in addition to single, complete, average, centroid,
     # median and ward
     # there are  ward.D, wardD2 and mcquitty
     # default is complete
     return
     from biokit.viz.commons import valid_methods
     easydev.check_param_in_list(str(value), valid_methods)
예제 #6
0
    def check_param_in_list(self, param, valid_values):
        """

        transforms valid_values into list (e.g., convenient if
        an iterator)
        """
        param = self.tolist(param)
        for name in param:
            easydev.check_param_in_list(name, list(valid_values))
예제 #7
0
파일: heatmap.py 프로젝트: cokelaer/biokit
    def _check_method(self, value):
        # None is possible
        # in R, in addition to single, complete, average, centroid, median and ward
        # there are  ward.D, wardD2 and mcquitty
        # default is complete

        easydev.check_param_in_list(str(value), ['linkage', 'single', 'complete', 'None',
                                           'average',' weighted', 'centroid',
                                           'median', 'ward'])
예제 #8
0
    def _check_method(self, value):
        # None is possible
        # in R, in addition to single, complete, average, centroid, median and ward
        # there are  ward.D, wardD2 and mcquitty
        # default is complete

        easydev.check_param_in_list(str(value), [
            'linkage', 'single', 'complete', 'None', 'average', ' weighted',
            'centroid', 'median', 'ward'
        ])
예제 #9
0
    def search(self, database_or_query=None, query=None, frmt='json'):
        """Search a searchable field (database) for a pattern

        The search request is more powerful than fetch for querying the
        database, but search will only returns the fields hgnc_id, symbol and
        score. This is because this tool is mainly intended to query the server
        to find possible entries of interest or to check data (such as your own
        symbols) rather than to fetch information about the genes. If you want
        to retrieve all the data for a set of genes from the search result, the
        user could use the hgnc_id returned by search to then fire off a fetch
        request by hgnc_id.

        :param database: if not provided, search all databases. 


        ::

            # Search all searchable fields for the tern BRAF
            h.search('BRAF')

            # Return all records that have symbols that start with ZNF
            h.search('symbol', 'ZNF*')

            # Return all records that have symbols that start with ZNF
            # followed by one and only one character (e.g. ZNF3)
            # Nov 2015 does not work neither here nor in within in the 
            # official documentation
            h.search('symbol', 'ZNF?')

            # search for symbols starting with ZNF that have been approved 
            # by HGNC
            h.search('symbol', 'ZNF*+AND+status:Approved')
            
            # return ZNF3 and ZNF12
            h.search('symbol', 'ZNF3+OR+ZNF12')

            # Return all records that have symbols that start with ZNF which 
            # are not approved (ie entry withdrawn)
            h.search('symbol', 'ZNF*+NOT+status:Approved')

        """
        if database_or_query is None and query is None:
            raise ValueError('you must provide at least one parameter')
        elif database_or_query is not None and query is None:
            # presumably user wants to search all databases
            query = database_or_query
            url = 'search/{0}'.format(query)
        else:
            database = database_or_query
            easydev.check_param_in_list(database, self.searchable_fields)
            url = 'search/{0}/{1}'.format(database, query)

        headers = self.get_headers(content=frmt)
        res = self.http_get(url, frmt=frmt, headers=headers)
        return res
예제 #10
0
파일: hgnc.py 프로젝트: zencore/bioservices
    def search(self, database_or_query=None, query=None, frmt='json'):
        """Search a searchable field (database) for a pattern

        The search request is more powerful than fetch for querying the
        database, but search will only returns the fields hgnc_id, symbol and
        score. This is because this tool is mainly intended to query the server
        to find possible entries of interest or to check data (such as your own
        symbols) rather than to fetch information about the genes. If you want
        to retrieve all the data for a set of genes from the search result, the
        user could use the hgnc_id returned by search to then fire off a fetch
        request by hgnc_id.

        :param database: if not provided, search all databases. 


        ::

            # Search all searchable fields for the tern BRAF
            h.search('BRAF')

            # Return all records that have symbols that start with ZNF
            h.search('symbol', 'ZNF*')

            # Return all records that have symbols that start with ZNF
            # followed by one and only one character (e.g. ZNF3)
            # Nov 2015 does not work neither here nor in within in the 
            # official documentation
            h.search('symbol', 'ZNF?')

            # search for symbols starting with ZNF that have been approved 
            # by HGNC
            h.search('symbol', 'ZNF*+AND+status:Approved')
            
            # return ZNF3 and ZNF12
            h.search('symbol', 'ZNF3+OR+ZNF12')

            # Return all records that have symbols that start with ZNF which 
            # are not approved (ie entry withdrawn)
            h.search('symbol', 'ZNF*+NOT+status:Approved')

        """
        if database_or_query is None and query is None:
            raise ValueError('you must provide at least one parameter')
        elif database_or_query is not None and query is None:
            # presumably user wants to search all databases
            query = database_or_query
            url = 'search/{0}'.format(query)
        else:
            database = database_or_query
            easydev.check_param_in_list(database, self.searchable_fields)
            url = 'search/{0}/{1}'.format(database, query)

        headers = self.get_headers(content=frmt)
        res = self.http_get(url, frmt=frmt, headers=headers)
        return res
예제 #11
0
파일: setup.py 프로젝트: cellnopt/CellNOptR
def setup():
    argv = sys.argv
    # default mode is INSTALL
    if len(argv) == 1:
        mode = 'INSTALL'
    elif len(argv) == 2:
        easydev.check_param_in_list(argv[1], ['install', 'build'])
        mode = argv[1]

    for package in ['CellNOptR', 'CNORdt', 'CNORfuzzy', 'CNORfeeder', 'CNORode']:
        if mode == 'install':
            cmd = 'INSTALL'
        elif mode == 'build':
            cmd = 'build'
        cmd = 'R CMD %s packages' % cmd + os.sep + package
        print cmd
        os.system(cmd)
예제 #12
0
파일: hgnc.py 프로젝트: zencore/bioservices
    def fetch(self, database, query, frmt='json'):
        """Retrieve particular records from a searchable fields

        Returned object is a json object with fields as in
        :attr:`stored_field`, which is returned from :meth:`get_info` method.

        Only one query at a time. No wild cards are accepted.
        ::

            >>> h = HGNC()
            >>> h.fetch('symbol', 'ZNF3')
            >>> h.fetch('alias_name', 'A-kinase anchor protein, 350kDa')
        """
        easydev.check_param_in_list(database, self.searchable_fields)
        url = 'fetch/{0}/{1}'.format(database, query)
        headers = self.get_headers(content=frmt)
        res = self.http_get(url, frmt=frmt, headers=headers)
        return res
예제 #13
0
    def fetch(self, database, query, frmt='json'):
        """Retrieve particular records from a searchable fields

        Returned object is a json object with fields as in
        :attr:`stored_field`, which is returned from :meth:`get_info` method.

        Only one query at a time. No wild cards are accepted.
        ::

            >>> h = HGNC()
            >>> h.fetch('symbol', 'ZNF3')
            >>> h.fetch('alias_name', 'A-kinase anchor protein, 350kDa')
        """
        easydev.check_param_in_list(database, self.searchable_fields)
        url = 'fetch/{0}/{1}'.format(database, query)
        headers = self.get_headers(content=frmt)
        res = self.http_get(url, frmt=frmt, headers=headers)
        return res
예제 #14
0
 def _check_subname(self, subname):
     from easydev import check_param_in_list
     check_param_in_list(subname, self.sub_challenges)
예제 #15
0
 def check_metric(self, value):
     return
     from biokit.viz.commons import valid_metrics
     easydev.check_param_in_list(value, valid_metrics)
예제 #16
0
파일: stats.py 프로젝트: shukwong/gdsctools
 def _set_method(self, method):
     easydev.check_param_in_list(method, self.valid_methods)
     if method == 'fdr':
         method = 'fdr_bh'
     self._method = method
예제 #17
0
 def _check_subname(self, subname):
     from easydev import check_param_in_list
     check_param_in_list(subname, self.sub_challenges)
예제 #18
0
 def check_param_in_list(self, param, valid_values):
     easydev.check_param_in_list(param, valid_values)
예제 #19
0
 def check_param_in_list(self, param, valid_values):
     easydev.check_param_in_list(param, valid_values)
예제 #20
0
 def check_metric(self, value):
     easydev.check_param_in_list(value, self.metrics)
예제 #21
0
파일: linkage.py 프로젝트: biokit/biokit
 def check_metric(self, value):
     return
     from biokit.viz.commons import valid_metrics
     easydev.check_param_in_list(value, valid_metrics)
예제 #22
0
 def _set_mode(self, mode):
     easydev.check_param_in_list(mode, ["time", "control"])
     self._mode = mode
예제 #23
0
 def from_bool(self, value):
     check_param_in_list(value, [True, False])
     if value is True:
         return "T"
     if value is False:
         return "F"