Hi,

I want to develop an application based on PyGr, and learn to use the
version 0.8.
I first succeeded in merging several FASTA files into pureseq and
seqlen files but I have run
into a problem when trying to create from them a pygr file (I use
eclipse on windows xp and set the environment variable PYGRDATAPATH to
a local disk).

Thanks for your help

Michel

1/ if I run the following program (cf 3/) I get this error message :
Traceback (most recent call last):
  File "E:\sosma\projet\python\SYSBIOPY\src\tool\database
\makepygr.py", line 8, in <module>
    import Data
  File "Z:\prog\python25\lib\site-packages\pygr\Data.py", line 2, in
<module>
    from pygr import pygrData,pygrSchema
ImportError: cannot import name pygrData

2/ if I use the console I get this message:

import seqdb
import Data
os.chdir('D:/data/ucsc/genome')
newDB = seqdb.SequenceFileDB('D:/data/ucsc/genome/hg18')
seqLenDict open
newDB.__doc__ = 'homo sapiens genome sequence draft 18'
Data.Bio.Seq.HUMAN.hg18 = newDB
Traceback (most recent call last):
  File "Z:\prog\python25\lib\site-packages\pygr\metabase.py", line
905, in update
    **mdbArgs)
  File "Z:\prog\python25\lib\site-packages\pygr\metabase.py", line
770, in __init__
    storage = ShelveMetabase(dbpath, self, **kwargs)
  File "Z:\prog\python25\lib\site-packages\pygr\metabase.py", line
488, in __init__
    self.db = dbfile.shelve_open(self.dbpath, 'c')
  File "Z:\prog\python25\lib\site-packages\pygr\dbfile.py", line 119,
in shelve_open
    d = open_index(filename, flag, useHash, mode) # construct Shelf
only if OK
  File "Z:\prog\python25\lib\site-packages\pygr\dbfile.py", line 77,
in open_index
    return open_bsddb(filename, flag, useHash, mode)
  File "Z:\prog\python25\lib\site-packages\pygr\dbfile.py", line 45,
in open_bsddb
    return open_anydbm(filename, flag)
  File "Z:\prog\python25\lib\site-packages\pygr\dbfile.py", line 21,
in open_anydbm
    return anydbm.open(*args, **kwargs)
  File "Z:\prog\python25\lib\anydbm.py", line 83, in open
    return mod.open(file, flag, mode)
  File "Z:\prog\python25\lib\dbhash.py", line 16, in open
    return bsddb.hashopen(file, flag, mode)
  File "Z:\prog\python25\lib\bsddb\__init__.py", line 310, in hashopen
    d.open(file, db.DB_HASH, flags, mode)
DBError: (5, 'Input/output error')

WARNING: error accessing metabase 'D:/pygr/data'.  Continuing...
Exception exceptions.AttributeError: "'ShelveMetabase' object has no
attribute 'db'" in <bound method ShelveMetabase.__del__ of
<pygr.metabase.ShelveMetabase object at 0x0122C8B0>> ignored
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "Z:\prog\python25\lib\site-packages\pygr\metabase.py", line
1196, in __setattr__
    self._mdb.add_resource(self.getPath(name), obj)
  File "Z:\prog\python25\lib\site-packages\pygr\metabase.py", line
724, in add_resource
    self.get_writer().saver.add_resource(resID, obj)
  File "Z:\prog\python25\lib\site-packages\pygr\metabase.py", line
864, in get_writer
    return MetabaseBase.get_writer(self) # proceed as usual
  File "Z:\prog\python25\lib\site-packages\pygr\metabase.py", line
721, in get_writer
    raise PygrDataReadOnlyError('this metabase is read-only!')
PygrDataReadOnlyError: this metabase is read-only!

3/ my program:

'''
Created on 23 avr. 2009
construct pygr data base
@author: bellis
'''
import os
import seqdb
import Data




def make_blast_db(inputFileDir):
    """ generate   .seqlen and test.pureseq files.
       test.seqlen file is for saving coordinates and identifiers
information
       to access your sequences (python shelve file), and test.pureseq
file
       is sequence only file without sequence header.
    """
    os.chdir(inputFileDir)
    fileList=os.listdir(inputFileDir)
    for fileName in fileList:
        seqdb.BlastDB(fileName)


def make_pygr_db(inputFileDir, speciesName, dbName, shortDescription):
    os.chdir(inputFileDir)
    newDB = seqdb.SequenceFileDB(inputFileDir+os.sep+dbName)
    newDB.__doc__ = shortDescription
    eval('Data.Bio.Seq.Genome.%s.%s = newDB',speciesName,dbName)
    Data.save()



if __name__=='__main__':

    #MERGE FASTA FILES
#    INPUTFILE_DIR='D:/data/ucsc/hg18'
#    make_blast_db(INPUTFILE_DIR)

    #CREATE PYGR RESSOURCE
    INPUTFILE_DIR='D:/data/ucsc/genome'
    SPECIES='HUMAN'
    DB_NAME='hg18'
    SHORT_DESCRIPTION='homo sapiens genome sequence draft 18'
    make_pygr_db(INPUTFILE_DIR, SPECIES, DB_NAME, SHORT_DESCRIPTION)

#COMMAND USED IN CONSOLE MODE
#import os
#import seqdb
#import Data
#os.chdir('D:/data/ucsc/genome')
#newDB = seqdb.SequenceFileDB('D:/data/ucsc/genome/hg18')
#newDB.__doc__ = 'homo sapiens genome sequence draft 18'
#Data.Bio.Seq.HUMAN.hg18 = newDB
#Data.save()

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pygr-dev" group.
To post to this group, send email to pygr-dev@googlegroups.com
To unsubscribe from this group, send email to 
pygr-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pygr-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to