예제 #1
0
def get_pdbs_with_ftp(*pdbs):
    """
  Fetches PDB files using FTP from a list of pdb-codes/text-files.
  """
    pdbs = expand_pdbs(*pdbs)
    entries = ['pdb%s.ent.gz' % pdb for pdb in pdbs]
    mget_scripts = ["get %s" % entry for entry in entries]
    substitutions = {
        'host': 'ftp.wwpdb.org',
        'mget_str': '\n'.join(mget_scripts),
    }
    ftp_script = template % substitutions
    open('ftp.sh', 'w').write(ftp_script)
    util.run_with_output('chmod +x ftp.sh')
    util.run_with_output('./ftp.sh')
    for pdb, entry in zip(pdbs, entries):
        fname = pdb + '.pdb'
        if os.path.isfile(entry):
            out_f = open(fname, 'w')
            for line in gzip.open(entry):
                out_f.write(line)
            util.clean_fname(entry)
            print fname
        else:
            print "Failed: %s" % fname
    util.clean_fname('ftp.sh')
예제 #2
0
def get_pdbs_with_ftp(*pdbs):
  """
  Fetches PDB files using FTP from a list of pdb-codes/text-files.
  """
  pdbs = expand_pdbs(*pdbs)
  entries = ['pdb%s.ent.gz' % pdb for pdb in pdbs]
  mget_scripts = ["get %s" % entry for entry in entries]
  substitutions = {
    'host': 'ftp.wwpdb.org',
    'mget_str': '\n'.join(mget_scripts),
  }
  ftp_script = template % substitutions
  open('ftp.sh', 'w').write(ftp_script)
  util.run_with_output('chmod +x ftp.sh')
  util.run_with_output('./ftp.sh')
  for pdb, entry in zip(pdbs, entries):
    fname = pdb + '.pdb'
    if os.path.isfile(entry):
      out_f = open(fname, 'w')
      for line in gzip.open(entry):
        out_f.write(line)
      util.clean_fname(entry)
      print fname
    else:
      print "Failed: %s" % fname
  util.clean_fname('ftp.sh')
예제 #3
0
파일: namd.py 프로젝트: janman13/pdbtool
def check_dcd_byte_order(dcd):
  if sys.byteorder in 'big':
    option = '-B'
  elif sys.byteorder in 'little':
    option = '-L'
  else:
    raise "Couldn't find o.s. byte order %s" % sys.byteorder
    
  util.run_with_output('flipdcd %s %s' % (option, dcd))
예제 #4
0
def run_pymol_script(pml, width=500, height=500):
  is_quit = 'quit' in util.words_in_file(pml)
  if is_quit:
    pymol_batch = data.binary("pymol_batch")
    cmd = pymol_batch + ' -c '
  else:
    pymol = data.binary("pymol")
    cmd = pymol + " -q " # no splash screen
  cmd += " -W %d -H %d " % (width, height)
  cmd += pml
  util.run_with_output(cmd)