Example #1
0
def test_layout():
    resource_folder = 'tests/test_files/'
    pdb_folder = resource_folder + 'pdb/'

    bio_explorer = BioExplorer('localhost:5000')
    bio_explorer.reset()
    print('BioExplorer version ' + bio_explorer.version())

    # Suspend image streaming
    bio_explorer.core_api().set_application_parameters(image_stream_fps=0)

    # Camera
    brayns = bio_explorer.core_api()
    brayns.set_camera(
        current='orthographic',
        orientation=[0.0, 0.0, 0.0, 1.0],
        position=[23.927943790322814, 24.84577580212592, 260.43975983632527],
        target=[23.927943790322814, 24.84577580212592, 39.93749999999999])
    params = brayns.OrthographicCameraParams()
    params.height = 55
    brayns.set_camera_params(params)

    # ACE2 Receptor
    ace2_receptor = Protein(sources=[pdb_folder + '6m1d.pdb'])
    bio_explorer.add_protein('ACE2 receptor',
                             ace2_receptor,
                             rotation=Quaternion(0.5, 0.5, 1.0, 0.0))

    # Restore image streaming
    bio_explorer.core_api().set_application_parameters(image_stream_fps=20)
def test_layout():
    resource_folder = 'tests/test_files/'
    pdb_folder = resource_folder + 'pdb/'

    bio_explorer = BioExplorer('localhost:5000')
    bio_explorer.reset()
    print('BioExplorer version ' + bio_explorer.version())

    # Suspend image streaming
    bio_explorer.core_api().set_application_parameters(image_stream_fps=0)

    # Resources

    protein_representation = BioExplorer.REPRESENTATION_ATOMS_AND_STICKS
    protein_radius_multiplier = 1.0
    glycan_representation = BioExplorer.REPRESENTATION_ATOMS_AND_STICKS
    glycan_radius_multiplier = 1.0

    # M Protein
    source = pdb_folder + 'QHD43419a.pdb'

    m_protein = Protein(sources=[source],
                        load_hydrogen=False,
                        load_non_polymer_chemicals=False)

    name = bio_explorer.NAME_PROTEIN_M
    bio_explorer.add_protein(name=name,
                             protein=m_protein,
                             atom_radius_multiplier=protein_radius_multiplier,
                             representation=protein_representation)

    # Glycans
    glycan_folder = pdb_folder + 'glycans/'
    high_mannose_paths = [
        glycan_folder + 'high-mannose/1.pdb',
        glycan_folder + 'high-mannose/2.pdb',
        glycan_folder + 'high-mannose/3.pdb',
        glycan_folder + 'high-mannose/4.pdb'
    ]

    # High-mannose glycans on Protein M
    indices = [5]
    high_mannose_glycans = Sugars(
        rotation=Quaternion(0.707, 0.0, 0.0, 0.707),
        assembly_name=name,
        name=bio_explorer.NAME_GLYCAN_HIGH_MANNOSE,
        protein_name=name,
        source=high_mannose_paths[0],
        site_indices=indices,
        representation=glycan_representation,
        atom_radius_multiplier=glycan_radius_multiplier)
    bio_explorer.add_glycans(high_mannose_glycans)

    # Materials
    bio_explorer.apply_default_color_scheme(
        shading_mode=bio_explorer.SHADING_MODE_BASIC)

    # Restore image streaming
    bio_explorer.core_api().set_application_parameters(image_stream_fps=20)
Example #3
0
def test_layout():
    resource_folder = 'tests/test_files/'
    pdb_folder = resource_folder + 'pdb/'

    bio_explorer = BioExplorer('localhost:5000')
    bio_explorer.reset()
    print('BioExplorer version ' + bio_explorer.version())

    # Suspend image streaming
    bio_explorer.core_api().set_application_parameters(image_stream_fps=0)

    line_surfactant = 5
    line_virus = 25
    line_defense = 45

    # Camera
    brayns = bio_explorer.core_api()
    brayns.set_camera(
        current='orthographic',
        orientation=[0.0, 0.0, 0.0, 1.0],
        position=[23.927943790322814, 24.84577580212592, 260.43975983632527],
        target=[23.927943790322814, 24.84577580212592, 39.93749999999999])
    params = brayns.OrthographicCameraParams()
    params.height = 55
    brayns.set_camera_params(params)

    # Grid
    bio_explorer.add_grid(min_value=0,
                          max_value=100,
                          interval=1,
                          radius=0.005,
                          colored=False,
                          position=Vector3(-10.0, -10.0, -10.0))

    # Layout
    virus_protein_s = Protein(sources=[
        pdb_folder + '6vyb.pdb',  # Open conformation
        pdb_folder + 'sars-cov-2-v1.pdb'  # Closed conformation
    ])

    bio_explorer.add_protein(name='Protein S (open)',
                             protein=virus_protein_s,
                             conformation_index=0,
                             position=Vector3(5.0, line_virus, 0.0),
                             rotation=Quaternion(0.0, 0.0, 1.0, 0.0))
    bio_explorer.add_protein(name='Protein S (closed)',
                             protein=virus_protein_s,
                             conformation_index=1,
                             position=Vector3(20.0, line_virus, 0.0),
                             rotation=Quaternion(0.0, 0.0, 1.0, 0.0))

    # Protein M (QHD43419)
    virus_protein_m = Protein(sources=[pdb_folder + 'QHD43419a.pdb'])
    bio_explorer.add_protein(name='Protein M',
                             protein=virus_protein_m,
                             position=Vector3(35.0, line_virus, 0.0))

    # Protein E (QHD43418 P0DTC4)
    virus_protein_e = Protein(sources=[pdb_folder + 'QHD43418a.pdb'])
    bio_explorer.add_protein(name='Protein E',
                             protein=virus_protein_e,
                             position=Vector3(45.0, line_virus, 0.0))

    # Lactoferrin
    lactoferrin = Protein(sources=[pdb_folder + 'immune/1b0l.pdb'])
    bio_explorer.add_protein(name='Lactoferrin',
                             protein=lactoferrin,
                             position=Vector3(5.0, line_defense, 0.0))

    # Defensin
    defensin = Protein(sources=[pdb_folder + 'immune/1ijv.pdb'])
    bio_explorer.add_protein(name='Defensin',
                             protein=defensin,
                             position=Vector3(20.0, line_defense, 0.0))

    # Glucose
    glucose = Protein(sources=[pdb_folder + 'glucose.pdb'],
                      load_non_polymer_chemicals=True)
    bio_explorer.add_protein(name='Glucose',
                             protein=glucose,
                             position=Vector3(30.0, line_defense, 0.0),
                             rotation=Quaternion(0.0, 0.0, 0.707, 0.707))

    # ACE2 Receptor
    ace2_receptor = Protein(sources=[pdb_folder + '6m18.pdb'])
    bio_explorer.add_protein(name='ACE2 receptor',
                             protein=ace2_receptor,
                             position=Vector3(45.0, line_defense - 2.5, 0.0),
                             rotation=Quaternion(0.5, 0.5, 1.0, 0.0))

    # Surfactant
    head_source = pdb_folder + 'surfactant/1pw9.pdb'
    branch_source = pdb_folder + 'surfactant/1k6f.pdb'
    surfactant_d = Surfactant(
        name='Surfactant',
        surfactant_protein=bio_explorer.SURFACTANT_BRANCH,
        head_source=head_source,
        branch_source=branch_source)

    bio_explorer.add_surfactant(surfactant=surfactant_d,
                                position=Vector3(5.0, line_surfactant, 0.0))

    # Restore image streaming
    bio_explorer.core_api().set_application_parameters(image_stream_fps=20)