示例#1
0
    def run(self):
        if not os.path.isfile(pdb_path(self._pdbid)):
            whynot_path = datetime.datetime.now().strftime(
                    '/srv/data/scratch/whynot2/comment/%Y%m%d_pdbredo.txt')
            with open(whynot_path, 'a') as f:
                f.write('COMMENT: No PDB-format coordinate file available\n')
                f.write('PDB_REDO, %s\n' % self._pdbid)
        elif not os.path.isfile(pdb_flat_path(self._pdbid)):
            PdbExtractJob(pdb_path(self._pdbid)).run()

        _log.info("[pdbredo] running pdbredo for %s" % self._pdbid)
        days = 3 * 24 * 60 * 60
        if not log_command(_log, 'pdbredo',
                           "%s %s" % (redo_script, self._pdbid),
                           timeout=days):
            _log.error("[pdbredo] pdbredo timeout for %s" % self._pdbid)

            whynot_path = os.path.join(zata_dir, 'whynot.txt')
            with open(whynot_path, 'a') as f:
                f.write(
                    'COMMENT: PDB REDO script timed out\nPDB_REDO, %s'
                    % self._pdbid
                )

        tot_path = os.path.join(pdbredo_path(self._pdbid),
                                  "%s_final_tot.pdb" % self._pdbid)
        if os.path.isfile(tot_path):
            link_path = os.path.join(settings["DATADIR"],
                                     "pdb_redo/flat/%s" % self._pdbid)
            if os.path.islink(link_path):
                os.symlink(tot_path, link_path)
示例#2
0
def pdbreport_obsolete(pdbid):
    paths = glob(os.path.join(settings["DATADIR"], "pdbreport/??", pdbid))
    if len(paths) <= 0:
        return False
    out_path = os.path.join(paths[0], "index.html")
    in_path = pdb_path(pdbid)
    return os.path.isfile(out_path) and not os.path.isfile(in_path)
示例#3
0
def find_input(pdbid):
    cif_path = mmcif_path(pdbid)
    p_path = pdb_path(pdbid)
    if os.path.isfile(p_path):
        return p_path
    else:
        return cif_path
示例#4
0
def bdb_uptodate(pdbid):
    in_path = pdb_path(pdbid)
    dir_path = bdb_path(pdbid)
    file_path = os.path.join(dir_path, "%s.bdb" % pdbid)
    whynot_path = os.path.join(dir_path, "%s.whynot" % pdbid)
    for path in [file_path, whynot_path]:
        if os.path.isfile(path) and (not os.path.isfile(in_path) or \
                os.path.getmtime(path) >= os.path.getmtime(in_path)):
            return True
    return False
示例#5
0
文件: scene.py 项目: cmbi/databanks
def scene_obsolete(src, lis_type, pdbid):
    if src.lower() == 'pdb':
        in_path = pdb_path(pdbid)
    elif src.lower() == 'redo':
        in_path = final_path(pdbid)
    else:
        raise Exception("no such structure type: %s" % src)
    sce_path = os.path.join(scene_path(src, lis_type, pdbid),
                            "%s_%s.sce" % (pdbid, lis_names[lis_type]))
    return os.path.isfile(sce_path) and not os.path.isfile(in_path)
示例#6
0
文件: scene.py 项目: cmbi/databanks
    def run(self):
        if self._src.lower() == 'pdb':
            struct_path = pdb_path(self._pdbid)
        elif self._src.lower() == 'redo':
            struct_path = final_path(self._pdbid)
        else:
            raise Exception("unknown structure type %s" % self._src)

        in_path = wilist_data_path(self._src, self._lis_type, self._pdbid)
        root_dir = os.path.join(settings["DATADIR"], "wi-lists/%s" % self._src)
        if os.path.isfile(in_path):
            os.environ["SCENES_SETTINGS"] = scene_settings
            log_command(_log,
                        'scene',
                        "%s %d %s %s %s %s %s" %
                        (script, os.getpid(), struct_path, self._pdbid,
                         self._src.upper(), commands[self._lis_type], in_path),
                        cwd=root_dir)
示例#7
0
文件: scene.py 项目: cmbi/databanks
def scene_uptodate(src, lis_type, pdbid):
    if src.lower() == 'pdb':
        in_path = pdb_path(pdbid)
    elif src.lower() == 'redo':
        in_path = structurefactors_path(pdbid)
    else:
        raise Exception("no such structure type: %s" % src)
    dir_path = scene_path(src, lis_type, pdbid)
    sce_path = os.path.join(dir_path,
                            "%s_%s.sce" % (pdbid, lis_names[lis_type]))
    whynot_path = os.path.join(dir_path,
                               "%s_%s.whynot" % (pdbid, lis_names[lis_type]))

    for path in [sce_path, whynot_path]:
        if os.path.isfile(path) and (not os.path.isfile(in_path) or \
                os.path.getmtime(path) >= os.path.getmtime(in_path)):
            return True
    return False
示例#8
0
def bdb_obsolete(pdbid):
    out_path = os.path.join(bdb_path(pdbid), '%s.bdb' % pdbid)
    in_path = pdb_path(pdbid)
    return os.path.isfile(out_path) and (not os.path.isfile(in_path) or \
            os.path.getmtime(out_path) < os.path.getmtime(in_path))
示例#9
0
文件: run_pdb.py 项目: cmbi/databanks
import os
import sys

import logging
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)

root_path = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
sys.path.append(root_path)

from databanks.fetch import FetchPdbJob
from databanks.pdb import PdbCleanupJob, PdbExtractJob, pdb_path

if len(sys.argv) == 1:
    fetch_job = FetchPdbJob()
    fetch_job.run()
    PdbCleanupJob(fetch_job).run()
elif len(sys.argv) == 2:
    PdbExtractJob(pdb_path(sys.argv[1])).run()
else:
    print("Usage: %s pdbid" % sys.argv[0])
    print("Usage: %s" % sys.argv[0])
示例#10
0
def dssp_obsolete(pdbid):
    out_path = dssp_path(pdbid)
    in_path = pdb_path(pdbid)
    return os.path.isfile(out_path) and not os.path.isfile(in_path)
示例#11
0
def pdbreport_uptodate(pdbid):
    in_path = pdb_path(pdbid)
    out_dir = pdbreport_path(pdbid)
    index_path = os.path.join(out_dir, "index.html")
    return os.path.isfile(index_path) and \
            os.path.getmtime(index_path) >= os.path.getmtime(in_path)
示例#12
0
    return strftime("%Y %B %d, %H:%M:%S", gmtime(os.path.getmtime(path)))


if len(sys.argv) == 2:
    pdbid = sys.argv[1]

    print("mmcif:")
    path = mmcif_path(pdbid)
    print("\tpath:", path)
    if os.path.isfile(path):
        print("\tmodification time:", s_mtime(path))
    else:
        print("\t<absent>")

    print("pdb:")
    for path in [pdb_path(pdbid), pdb_flat_path(pdbid)]:
        print("\tpath:", path)
        if os.path.isfile(path):
            print("\tmodification time:", s_mtime(path))
        else:
            print("\t<absent>")

    print("bdb:")
    path = bdb_path(pdbid)
    print("\tpath:", path)
    if os.path.isdir(path):
        print("\tmodification time:", s_mtime(path))
        print("\tup to date:", yesno(bdb_uptodate(pdbid)))
        print("\tobsolete:", yesno(bdb_obsolete(pdbid)))
    else:
        print("\t<absent>")
示例#13
0
    def run(self):
        in_path = pdb_path(self._pdbid)
        out_path = dssp_path(self._pdbid)

        if os.path.isfile(in_path):
            log_command(_log, 'dssp', "%s %s %s" % (MKDSSP, in_path, out_path))
示例#14
0
def dssp_uptodate(pdbid):
    in_path = pdb_path(pdbid)
    out_path = dssp_path(pdbid)
    return os.path.isfile(out_path) and \
        os.path.getmtime(out_path) >= os.path.getmtime(in_path)
示例#15
0
def hbonds_uptodate(pdbid):
    in_path = pdb_path(pdbid)
    dir_path = hbonds_path(pdbid)
    log_path = os.path.join(dir_path, "%s.hb2.bz2" % pdbid)
    return os.path.isfile(log_path) and \
            os.path.getmtime(log_path) >= os.path.getmtime(in_path)
示例#16
0
def hbonds_obsolete(pdbid):
    out_path = os.path.join(hbonds_path(pdbid),
                           "%s.hb2.bz2" % pdbid)
    in_path = pdb_path(pdbid)
    return os.path.isfile(out_path) and not os.path.isfile(in_path)
示例#17
0
文件: nmr.py 项目: cmbi/databanks
def nmr_obsolete(pdbid):
    out_path = nmr_path(pdbid)
    in_path = pdb_path(pdbid)
    return os.path.isfile(out_path) and not os.path.isfile(in_path)