def read_seq_dict(pathstem, trypath=None):
    'read seqDict for NLMSA'
    if os.access(pathstem + '.seqDictP', os.R_OK):
        from pygr import worldbase
        ifile = file(pathstem+'.seqDictP', 'rb') # pickle is binary file!
        try: # load from worldbase-aware pickle file
            seqDict = worldbase._mdb.loads(ifile.read())
        finally:
            ifile.close()
    elif os.access(pathstem + '.seqDict', os.R_OK): # old-style union header
        import seqdb
        seqDict = seqdb.PrefixUnionDict(filename=pathstem+'.seqDict',
                                        trypath=trypath)
    else:
        raise ValueError('''Unable to find seqDict file
%s.seqDictP or %s.seqDict
and no seqDict provided as an argument''' % (pathstem, pathstem))
    return seqDict
dataset/ETHPy150Open cjlee112/pygr/pygr/nlmsa_utils.py/read_seq_dict/original