コード例 #1
0
    def submit_project(self, request, claims):
        """
        Submit a Haddock project to the Haddock server
        """

        project = load_project(request['project_id'])
        result = {'project_id': None}
        if not project.empty():

            # Get username and password
            username, password = resolve_credentials(request)

            webformat = write_web(project)
            root = project.get_root()
            xmlrpc = HaddockXmlrpcInterface(server_url=self.component_config.settings['haddock_server_url'],
                                        username=username, password=password)
            response = xmlrpc.launch_project(webformat, root.runname.value)
            result['project_id'] = response

            if response != root.runname.value:
                self.log.error('Unable to submit project {0} to Haddock server'.format(request['project_id']))
        else:
            self.log.error('Unable to load project {0}'.format(request['project_id']))

        return result
コード例 #2
0
    def tearDownClass(cls):
        """
        When we are done, test export of the project
        """

        runname = cls.project.query_nodes(key='runname')
        output_web_file = os.path.join(cls.files, '{0}.web'.format(runname.value))
        with open(output_web_file, 'w') as wf:
            wf.write(write_web(cls.project))
コード例 #3
0
    def test_format_export(self):
        """
        Test export of format
        """

        graph = read_web(self.web_file)

        # Export graph as .web to file
        web = write_web(graph)
        outfile = os.path.join(FILEPATH, 'test_export.web')
        with open(outfile, 'w') as otf:
            otf.write(web)
            self.tempfiles.append(outfile)

        self.assertTrue(os.path.isfile(outfile))

        # Import again and compare source graph
        graph1 = read_web(outfile)
        self.assertEqual(len(graph), len(graph1))
        self.assertEqual(len(graph.edges), len(graph1.edges))
コード例 #4
0
    'pdb': {
        'mode': 'submit',
        'chain': 'B',
        'code': None,
        'pdbdata': open('1ckaB.pdb').read()
    },
    'r': {
        'activereslist': [1, 2, 3, 4, 5, 6, 7, 8, 9]
    }
}
block_id, params = new_parameter_block(project,
                                       'haddock-partner-request.v1',
                                       'HaddockPartnerParameters',
                                       max_mult=5)
edit_parameter_block(project, block_id, partner2)

# Add fully-flexible segments to first partner
block_id, params = new_parameter_block(
    project,
    'haddock-flexrange-request.v1',
    'Range',
    attach='{0}.fullyflex.segments'.format(block_id))
edit_parameter_block(project, block_id, {'start': 1, 'end': 9})

# Set username
edit_parameter_block(project, 'project', {'username': '******'})

# Run final validation
project.getnodes(project.root).validate()
print(write_web(project))