Пример #1
0
def save_NLMSA_downloaders(url, fileFilter=lambda x: x.endswith(".txt.gz"),
                           resourceStem='Bio.MSA.UCSC.',
                           fileDocumenter=None, fileNamer=None):
    'save NLMSA downloader / builder objects for a set of downloadable textdump files'
    if fileDocumenter is None:
        fileDocumenter = lambda x: 'NLMSA alignment '+x
    if fileNamer is None: # a default resource naming function
        fileNamer = lambda x:resourceStem+x[:-3] # remove .gz suffix
    from pygr.nlmsa_utils import NLMSABuilder
    from pygr.downloader import SourceURL
    d = catalog_downloads(url, fileFilter, fileNamer,
                          fileDocumenter, SourceURL)
    for resID,o in d.items():
        nlmsa = NLMSABuilder(o)
        nlmsa.__doc__ = fileDocumenter(resID)
        d[resID[:-4]] = nlmsa # remove .txt suffix
    from pygr import worldbase
    worldbase.add_resource(d)
    worldbase.commit()
    return d # just in case the user wants to see what was saved
Пример #2
0
def save_NLMSA_downloaders(url,
                           fileFilter=lambda x: x.endswith(".txt.gz"),
                           resourceStem='Bio.MSA.UCSC.',
                           fileDocumenter=None,
                           fileNamer=None):
    '''save NLMSA downloader / builder objects for a set
    of downloadable textdump files'''
    if fileDocumenter is None:
        fileDocumenter = lambda x: 'NLMSA alignment ' + x
    if fileNamer is None:  # a default resource naming function
        fileNamer = lambda x: resourceStem + x[:-3]  # remove .gz suffix
    from pygr.nlmsa_utils import NLMSABuilder
    from pygr.downloader import SourceURL
    d = catalog_downloads(url, fileFilter, fileNamer, fileDocumenter,
                          SourceURL)
    for resID, o in d.items():
        nlmsa = NLMSABuilder(o)
        nlmsa.__doc__ = fileDocumenter(resID)
        d[resID[:-4]] = nlmsa  # remove .txt suffix
    from pygr import worldbase
    worldbase.add_resource(d)
    worldbase.commit()
    return d  # just in case the user wants to see what was saved
def create_downloadable_resource(url, mdb, name, doc):
    dfile = SourceURL(url)
    nbuilder = NLMSABuilder(dfile)
    nbuilder.__doc__ = doc
    mdb.add_resource(name, nbuilder)
    mdb.commit()
Пример #4
0
def create_downloadable_resource(url, mdb, name, doc):
    dfile = SourceURL(url)
    nbuilder = NLMSABuilder(dfile)
    nbuilder.__doc__ = doc
    mdb.add_resource(name, nbuilder)
    mdb.commit()