File size: 1,502 Bytes
24599ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import pytest
from bbflow.deployment.bbflow import BBFlow
from pathlib import Path

@pytest.fixture(scope="module")
def bbflow_sampler():
    """
    Fixture to set up the BBFlow model for testing.
    This will download the model.
    """
    bbflow_sampler_ = BBFlow.from_tag('bbflow-mini-0.1', force_download=True)
    
    return bbflow_sampler_

def test_run(bbflow_sampler):
    """
    Run a mini model to test the BBFlow functionality. This is essentially the inference_example.py script for a short backbone.
    """
    rootdir = Path(__file__).parent.parent
    # Load the BBFlow model

    pdb_path = rootdir/'test_data/test_pdbs/short_equilibrium.pdb'
    outpath = rootdir/'test_data/test_pdbs/test_samples.pdb'

    if outpath.exists():
        outpath.unlink()

    bbflow_sampler.sample(
        input_path=pdb_path, output_path=outpath,
        num_samples=2, batch_size=1
    )

# slow test:
@pytest.mark.slow
def test_run_all():
    for tag in ['bbflow-multimer-0.2', 'bbflow-0.1']:
        bbflow_sampler_ = BBFlow.from_tag(tag=tag, force_download=True)
        
        rootdir = Path(__file__).parent.parent
        # Load the BBFlow model

        pdb_path = rootdir/'test_data/test_pdbs/short_equilibrium.pdb'
        outpath = rootdir/f'test_data/test_pdbs/test_samples_{tag}.pdb'

        if outpath.exists():
            outpath.unlink()

        bbflow_sampler_.sample(
            input_path=pdb_path, output_path=outpath,
            num_samples=2, batch_size=1
        )