Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow SuperStar calculations to be run in parallel #1

Closed
Cradoux opened this issue Feb 23, 2018 · 1 comment
Closed

Allow SuperStar calculations to be run in parallel #1

Cradoux opened this issue Feb 23, 2018 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@Cradoux
Copy link
Collaborator

Cradoux commented Feb 23, 2018

Superstar calculations are the slowest part of the process, so we should give the option to use a pool of processes to run in parallel

@Cradoux Cradoux added the enhancement New feature or request label Feb 23, 2018
@prcurran prcurran self-assigned this Feb 28, 2018
@prcurran
Copy link
Owner

This has been implemented using concurrent.futures

run_ss method now contains the map call. SuperstarResult class has been changed so that the temp working dir is the same for all superstar runs avoiding confusion on where the superstar results are held.

def _run_ss(self, centroid=None):
    """
    initiates a SuperStar run for a given protein and probe

    :param prot: a :class:`ccdc.protein.Protein` instance
    :param out_dir: str, output directory
    :param centroid: tup, coordinates of cavity origin
    :param charged_probes: bool, if True 'positive' and 'negative' probes will be used
    :return: a :class:`SuperstarResult` instance
    """

    if self.charged_probes:
        self.probe_dict = dict(
            apolar='AROMATIC CH CARBON',
            donor='UNCHARGED NH NITROGEN',
            acceptor='CARBONYL OXYGEN',
            positive='CHARGED NH NITROGEN',
            negative='CHLORIDE ANION'
        )
    else:
        self.probe_dict = dict(
            apolar='AROMATIC CH CARBON',
            donor='UNCHARGED NH NITROGEN',
            acceptor='CARBONYL OXYGEN')

    wrk_dir = _test_output_dir()
    args = [(k, self.probe_dict[k], centroid, self.prot, self.out_dir, wrk_dir) for k in self.probe_dict.keys()]
    print(args)

    ex = futures.ThreadPoolExecutor(max_workers=5)
    results = ex.map(self._superstar_job, args)
    return list(results)

This should speed up the calculation time significantly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants