Exemplo n.º 1
0
def add_missing_residues(root_output_directory):
    '''Add the removed loop residue backbone atoms back into the Rosetta preminimized structures but in a clearly non-native manner.'''

    # Set up the run
    input_directories = [
        ['..', 'structures', '12_res', 'rosetta', 'pruned'],
        ['..', 'structures', '14_17_res', 'rosetta', 'pruned'],
    ]

    cases = []
    for input_directory in input_directories:
        output_directory = os.path.join(root_output_directory, input_directory[2], input_directory[3], input_directory[4])
        try:
            os.makedirs(output_directory)
        except: pass
        if not(os.path.exists(output_directory)):
            raise Exception('The output directory {0} could not be created.')
        cases.append((os.path.join(*input_directory), output_directory))

    # Determine path to RosettaScripts
    rosetta_scripts_binary = None
    release_binaries = []
    other_binaries = []
    from libraries import settings
    try:
        settings.load(arguments, allow_failure = True)
    except Exception, e:
        raise colortext.Exception('An exception occurred reading the settings.conf file: {0}.'.format(str(e)))
Exemplo n.º 2
0
#$ -S /usr/bin/python
#$ -l mem_free=1G
#$ -l arch=linux-x64
#$ -l netapp=1G
#$ -cwd

import os
import sys; sys.path.append(os.getcwd())
import optparse
import subprocess
import re
import json

from libraries import utilities
from libraries import settings; settings.load(interactive=False)
from libraries import database

# Parse arguments.

if len(sys.argv) != 2 or 'SGE_TASK_ID' not in os.environ:
    print 'Usage: SGE_TASK_ID=<id> loop_benchmark.py <benchmark_id>'
    sys.exit(1)

task_id = int(os.environ['SGE_TASK_ID']) - 1
benchmark_id = int(sys.argv[1])

# Figure out which loop to benchmark.

with database.connect() as session:
    benchmark = session.query(database.Benchmarks).get(benchmark_id)
Exemplo n.º 3
0
                s.append('{0}: {1}'.format(k, progress_fn(v)))
            s.append('')
    return '\n'.join(s)


def report_progress(database_name, benchmark_name, only_show_summary):
    print(
        get_progress_for_terminal(database_name, benchmark_name,
                                  only_show_summary))


if __name__ == '__main__':
    try:
        from libraries import docopt
        arguments = docopt.docopt(__doc__)
        settings.load()
        benchmark_name = arguments['<benchmark_name>']
        summary = arguments['--summary']
        database_name = arguments['--database'] or settings.db_name
        if arguments['--list']:
            name_list = get_benchmark_list_by_name(database_name)
            if name_list:
                colortext.pgreen(
                    '\nList of available benchmarks in the {0} database:\n'.
                    format(database_name))
                for n in name_list:
                    colortext.pcyan('  - {0}'.format(n))
                print('')
            else:
                colortext.pred(
                    '\nNo benchmarks defined in the {0} database.\n'.format(
Exemplo n.º 4
0
#$ -l netapp=1G
#$ -cwd

import os
import sys

sys.path.append(os.getcwd())
import optparse
import subprocess
import re
import json

from libraries import utilities
from libraries import settings

settings.load(interactive=False)
from libraries import database

# Parse arguments.

if len(sys.argv) != 2 or 'SGE_TASK_ID' not in os.environ:
    print 'Usage: SGE_TASK_ID=<id> loop_benchmark.py <benchmark_id>'
    sys.exit(1)

task_id = int(os.environ['SGE_TASK_ID']) - 1
benchmark_id = int(sys.argv[1])

# Figure out which loop to benchmark.

with database.connect() as session:
    benchmark = session.query(database.Benchmarks).get(benchmark_id)
Exemplo n.º 5
0
"""

# Add options to pick a particular structure.
# Add options to pick given structure (i.e 1-500 index) or lowest scoring.
# Add options to show logs for jobs that died.
# Default: only benchmark id required.  Default structure is the lowest energy
# model for the first PDB tag sorted alphabetically.

from libraries import settings
from libraries import database
from libraries import docopt

arguments = docopt.docopt(__doc__.format(**locals()))
benchmark_id = arguments['<benchmark_id>']

settings.load(arguments)

with database.connect() as session:
    query = session.query(database.TracerLogs).\
            filter_by(benchmark_id=benchmark_id)

    if arguments['--pdb']:
        print "This filter is not yet supported."
        raise SystemExit

    if arguments['--broken']:
        query = query.filter_by(protocol_id=0)

    tracer_log = query.first()

    if tracer_log is None:
Exemplo n.º 6
0
"""

import os, re, glob, subprocess
from libraries import settings, docopt

arguments = docopt.docopt(__doc__.format(**locals()))
script_path = os.path.abspath(arguments['<script>'])
pdb_path = os.path.abspath(arguments['<pdb>'] or 'input/structures/1srp.pdb')
pdb_tag = os.path.splitext(os.path.basename(pdb_path))[0]
loop_path = re.sub('\.pdb(\.gz)?$', '.loop', pdb_path)
flags_path = arguments['--flags']
fragments_path = arguments['--fragments']
output_dir = arguments['--output'] or 'sandbox'

settings.load(arguments)

rosetta_path = settings.rosetta
if os.path.isabs(rosetta_path): pass
elif os.path.isabs(os.path.expanduser(rosetta_path)): # e.g. ~/some/path
    rosetta_path = os.path.expanduser(rosetta_path)
else:
    rosetta_path = os.path.abspath(rosetta_path)
rosetta_path = os.path.normpath(rosetta_path)

rosetta_scripts = os.path.join(rosetta_path, 'source', 'bin', 'rosetta_scripts')
rosetta_database = os.path.join(rosetta_path, 'database')

if not os.path.exists(rosetta_scripts):
    raise Exception('The RosettaScripts binary %(rosetta_scripts)s does not exist. By default, Rosetta executables are named after the operating system and build type e.g. rosetta_scripts.linuxgccrelease. Either: i) rename an appropriate binary to %(rosetta_scripts)s; or ii) use a symbolic link.' % locals())
Exemplo n.º 7
0
# Copyright (c) 2015 Kale Kundert
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

"""\
Pull the latest changes to the rosetta checkout being benchmarked.
"""

import os, subprocess
from libraries import settings

settings.load()
os.chdir(settings.rosetta)
subprocess.check_call(('git', 'pull'))