cmonkey.util
index
/home/weiju/Projects/ISB/cmonkey-python/cmonkey/util.py

util.py - cMonkey utility module
 
This file is part of cMonkey Python. Please see README and LICENSE for
more information and licensing details.

 
Modules
       
BeautifulSoup
collections
gzip
logging
math
multiprocessing
numpy
operator
os
rpy2.robjects
scipy
shelve
time
urllib

 
Classes
       
__builtin__.tuple(__builtin__.object)
DelimitedFile
ThesaurusBasedMap
exceptions.Exception(exceptions.BaseException)
DocumentNotFound
urllib.FancyURLopener(urllib.URLopener)
CMonkeyURLopener

 
class CMonkeyURLopener(urllib.FancyURLopener)
    An URL opener that can detect 404 errors
 
 
Method resolution order:
CMonkeyURLopener
urllib.FancyURLopener
urllib.URLopener

Methods defined here:
http_error_default(self, url, fp, errcode, errmsg, headers)
overriding the default error handling method to handle HTTP 404
errors

Methods inherited from urllib.FancyURLopener:
__init__(self, *args, **kwargs)
get_user_passwd(self, host, realm, clear_cache=0)
http_error_301(self, url, fp, errcode, errmsg, headers, data=None)
Error 301 -- also relocated (permanently).
http_error_302(self, url, fp, errcode, errmsg, headers, data=None)
Error 302 -- relocated (temporarily).
http_error_303(self, url, fp, errcode, errmsg, headers, data=None)
Error 303 -- also relocated (essentially identical to 302).
http_error_307(self, url, fp, errcode, errmsg, headers, data=None)
Error 307 -- relocated, but turn POST into error.
http_error_401(self, url, fp, errcode, errmsg, headers, data=None)
Error 401 -- authentication required.
This function supports Basic authentication only.
http_error_407(self, url, fp, errcode, errmsg, headers, data=None)
Error 407 -- proxy authentication required.
This function supports Basic authentication only.
prompt_user_passwd(self, host, realm)
Override this in a GUI environment!
redirect_internal(self, url, fp, errcode, errmsg, headers, data)
retry_http_basic_auth(self, url, realm, data=None)
retry_https_basic_auth(self, url, realm, data=None)
retry_proxy_http_basic_auth(self, url, realm, data=None)
retry_proxy_https_basic_auth(self, url, realm, data=None)

Methods inherited from urllib.URLopener:
__del__(self)
addheader(self, *args)
Add a header to be used by the HTTP interface only
e.g. u.addheader('Accept', 'sound/basic')
cleanup(self)
close(self)
http_error(self, url, fp, errcode, errmsg, headers, data=None)
Handle http errors.
Derived class can override this, or provide specific handlers
named http_error_DDD where DDD is the 3-digit error code.
open(self, fullurl, data=None)
Use URLopener().open(file) instead of open(file, 'r').
open_data(self, url, data=None)
Use "data" URL.
open_file(self, url)
Use local file or FTP depending on form of URL.
open_ftp(self, url)
Use FTP protocol.
open_http(self, url, data=None)
Use HTTP protocol.
open_https(self, url, data=None)
Use HTTPS protocol.
open_local_file(self, url)
Use local file.
open_unknown(self, fullurl, data=None)
Overridable interface to open unknown URL type.
open_unknown_proxy(self, proxy, fullurl, data=None)
Overridable interface to open unknown URL type.
retrieve(self, url, filename=None, reporthook=None, data=None)
retrieve(url) returns (filename, headers) for a local object
or (tempfilename, headers) for a remote object.

Data and other attributes inherited from urllib.URLopener:
version = 'Python-urllib/1.17'

 
class DelimitedFile(__builtin__.tuple)
    DelimitedFile(lines, header)
 
 
Method resolution order:
DelimitedFile
__builtin__.tuple
__builtin__.object

Methods defined here:
__getnewargs__(self)
Return self as a plain tuple.  Used by copy and pickle.
__getstate__(self)
Exclude the OrderedDict from pickling
__repr__(self)
Return a nicely formatted representation string
_asdict(self)
Return a new OrderedDict which maps field names to their values
_replace(_self, **kwds)
Return a new DelimitedFile object replacing specified fields with new values

Class methods defined here:
_make(cls, iterable, new=<built-in method __new__ of type object>, len=<built-in function len>) from __builtin__.type
Make a new DelimitedFile object from a sequence or iterable

Static methods defined here:
__new__(_cls, lines, header)
Create new instance of DelimitedFile(lines, header)

Data descriptors defined here:
__dict__
Return a new OrderedDict which maps field names to their values
header
Alias for field number 1
lines
Alias for field number 0

Data and other attributes defined here:
_fields = ('lines', 'header')

Methods inherited from __builtin__.tuple:
__add__(...)
x.__add__(y) <==> x+y
__contains__(...)
x.__contains__(y) <==> y in x
__eq__(...)
x.__eq__(y) <==> x==y
__ge__(...)
x.__ge__(y) <==> x>=y
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__gt__(...)
x.__gt__(y) <==> x>y
__hash__(...)
x.__hash__() <==> hash(x)
__iter__(...)
x.__iter__() <==> iter(x)
__le__(...)
x.__le__(y) <==> x<=y
__len__(...)
x.__len__() <==> len(x)
__lt__(...)
x.__lt__(y) <==> x<y
__mul__(...)
x.__mul__(n) <==> x*n
__ne__(...)
x.__ne__(y) <==> x!=y
__rmul__(...)
x.__rmul__(n) <==> n*x
__sizeof__(...)
T.__sizeof__() -- size of T in memory, in bytes
count(...)
T.count(value) -> integer -- return number of occurrences of value
index(...)
T.index(value, [start, [stop]]) -> integer -- return first index of value.
Raises ValueError if the value is not present.

 
class DocumentNotFound(exceptions.Exception)
    An exception indicating that the requested document does not exist
 
 
Method resolution order:
DocumentNotFound
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
class ThesaurusBasedMap
    wrapping a thesaurus and a feature id based map for a flexible
lookup container that can use any valid gene alias
 
  Methods defined here:
__getitem__(self, key)
override the __getitem__ method for dictionary-like behaviour
__init__(self, synonyms, wrapped_dict)
create new instance
__repr__(self)
keys(self)
Returns the keys of the thesaurus

 
Functions
       
best_matching_links(search_string, html)
given a search string and an HTML text, extract the best matching
href
quantile(values, probability)
does the same as R's quantile function.
values a list of numeric values
probability a value in the range between 0 and 1
read_url(url)
convenience method to read a document from a URL using the
CMonkeyURLopener
read_url_cached(url, cache_filename)
convenience method to read a document from a URL using the
CMonkeyURLopener, cached version
trim_mean(values, trim)
returns the trim mean

 
Data
        __all__ = ['DelimitedFile', 'best_matching_links', 'quantile', 'DocumentNotFound', 'CMonkeyURLopener', 'read_url', 'read_url_cached', 'ThesaurusBasedMap', 'trim_mean']