Skip to main content

Protein structure prediction

This guide details how to perform best-practice analysis for protein 3D structure prediction on an AWS Batch compute environment in Platform. It includes:

  • Creating AWS Batch compute environments to run your pipeline and downstream analysis
  • Adding the nf-core/proteinfold pipeline to your workspace
  • Importing your pipeline input data
  • Launching the pipeline and monitoring execution from your workspace
  • Setting up a custom analysis environment with Studios
Prerequisites

You will need the following to get started:

  • Admin permissions in an existing organization workspace. See Set up your workspace to create an organization and workspace from scratch.
  • An existing AWS cloud account with access to the AWS Batch service.
  • Existing access credentials with permissions to create and manage resources in your AWS account. See IAM for guidance to set up IAM permissions for Platform.

Compute environment​

The compute and storage requirements for protein structure prediction depend on the number and length of protein sequences being analyzed and the size of the database used for prediction by the deep learning models, such as AlphaFold2 and ColabFold. Input sequences typically range from a few kilobytes for single proteins to several megabytes for large datasets, and reference databases can be extremely large, from 100 GB to several TB. Protein folding pipelines generate intermediate files during execution, such as for alignments and feature representations, the sizes of which vary based on the number of sequences and the complexity of the analysis.

Given the data sizes and computational intensity, production pipelines perform best with NVIDIA A10 or larger GPUs and low-latency, high-throughput cloud storage file handling.

GPUs​

The nf-core/proteinfold pipeline performs protein folding prediction using one of three deep learning models: AlphaFold2, ColabFold, or ESMFold. The computationally intensive tasks for protein structure prediction perform better on GPUs due to their ability to handle large matrix operations efficiently and perform parallel computations. GPUs can dramatically reduce the time required for protein structure predictions, making it feasible to analyze larger datasets or perform more complex simulations.

Platform supports the allocation of both CPUs and GPUs in the same compute environment. For example, specify m6id, c6id, r6id, g5, p3 instance families in the Instance types field when creating your AWS Batch compute environment. See Create compute environment below.

When you launch nf-core/proteinfold in Platform, enable use_gpu to instruct Nextflow to run GPU-compatible pipeline processes on GPU instances. See Launch pipeline below.

Fusion file system​

The Fusion file system enables seamless read and write operations to cloud object stores, leading to simpler pipeline logic and faster, more efficient execution. While Fusion is not required to run nf-core/proteinfold, it significantly enhances I/O-intensive tasks and eliminates the need for intermediate data copies, which is particularly beneficial when working with the large databases used by deep learning models for prediction.

Fusion works best with AWS NVMe instances (fast instance storage) as this delivers the fastest performance when compared to environments using only AWS EBS (Elastic Block Store). Batch Forge selects instances automatically based on your compute environment configuration, but you can optionally specify instance types. To enable fast instance storage, you must select EC2 instances with NVMe SSD storage (g4dn, g5, or P3 families or greater).

note

Fusion requires a license for use in Seqera Platform compute environments or directly in Nextflow. See Fusion licensing for more information.

Create compute environment​

info

The same compute environment can be used for pipeline execution and running your Studios notebook environment, but Studios does not support AWS Fargate. To use this compute environment for both nf-core/proteinfold execution and your Studio, leave Enable Fargate for head job disabled and include a CPU-based EC2 instance family (c6id, r6id, etc.) in your Instance types.

Alternatively, create a second basic AWS Batch compute environment and a Studio with at least 2 CPUs and 8192 MB of RAM.

From the Compute Environments tab in your organization workspace, select Add compute environment and complete the following fields:

FieldDescription
NameA unique name for the compute environment.
PlatformAWS Batch
CredentialsSelect existing credentials, or + to create new credentials.
Access KeyAWS access key ID.
Secret KeyAWS secret access key.
RegionThe target execution region.
Work directoryAn S3 bucket path in the same execution region.
Wave containersUse the Wave containers service to provision containers.
FusionAccess your S3-hosted data via the Fusion file system. Requires Wave containers.
Fast instance storageUse NVMe instance storage to speed up I/O and disk access. Requires Fusion.
Config modeBatch Forge
Provisioning modelChoose between Spot and On-demand instances.
Max CPUsSensible values for production use range between 2000 and 5000.
Enable Fargate for head jobRun the Nextflow head job using the Fargate container service to speed up pipeline launch. Requires Fusion and the Spot provisioning model. Do not enable for Studios compute environments.
Use Amazon-recommended GPU-optimized ECS AMIWhen enabled, Batch Forge specifies the most current AWS-recommended GPU-optimized ECS AMI as the EC2 fleet AMI when creating the compute environment.
Additional S3 bucketsAdditional S3 buckets or paths to be granted read-write permission for this compute environment. For the purposes of this guide, add s3://proteinfold-dataset to grant compute environment access to the DB and params used for prediction by AlphaFold2 and ColabFold.
Instance typesSpecify the instance types to be used for computation. You must include GPU-enabled instance types (g4dn, g5) when the Amazon-recommended GPU-optimized ECS AMI is in use. Include CPU-based instance families for Studios compute environments.
Resource labelsname=value pairs to tag the AWS resources created by this compute environment.

Add pipeline to Platform​

info

The nf-core/proteinfold pipeline is a bioinformatics best-practice analysis pipeline for Protein 3D structure prediction.

nf-core/proteinfold subway map

Seqera Pipelines is a curated collection of quality open source pipelines that can be imported directly to your workspace Launchpad in Platform. Each pipeline includes a curated test dataset to use in a test run to confirm compute environment compatibility in just a few steps.

To use Seqera Pipelines to import the nf-core/proteinfold pipeline to your workspace:

  1. Search for nf-core/proteinfold, then select Launch next to the pipeline name.
  2. On the Cloud tab, select Login to get started and sign in with your Seqera account.
  3. Select your Platform Organization, Workspace, and Compute Environment for the imported pipeline.
  4. (Optional) Customize the Pipeline Name and Pipeline Description.
  5. Select Add pipeline to your Seqera account.
info

To add a custom pipeline not listed in Seqera Pipelines to your Platform workspace, see Add pipelines for manual Launchpad instructions.

Pipeline input data​

The nf-core/proteinfold pipeline works with input datasets (samplesheets) containing sequence names and FASTA file locations (paths to FASTA files in cloud or local storage). The pipeline includes an example samplesheet that looks like this:

nf-core/proteinfold example samplesheet

In Platform, samplesheets and other data can be made easily accessible in one of two ways:

  • Use Data Explorer to browse and interact with remote data from AWS S3, Azure Blob Storage, and Google Cloud Storage repositories, directly in your organization workspace.
  • Use Datasets to upload structured data to your workspace in CSV (Comma-Separated Values) or TSV (Tab-Separated Values) format.
Add a cloud bucket via Data Explorer

Private cloud storage buckets accessible with the credentials in your workspace are added to Data Explorer automatically by default. However, you can also add custom directory paths within buckets to your workspace to simplify direct access.

For example, to add the proteinfold open database to your workspace:

  1. From the Data Explorer tab, select Add data repository.
  2. Specify the bucket details:
    • The cloud Provider: AWS
    • An existing Data repository path: s3://proteinfold-dataset
    • A unique Name for the bucket: "proteinfold-dataset"
    • The Credentials used to access the bucket: select Public.
    • An optional bucket Description.
  3. Select Add.

You can now select data directly from this bucket as input when launching your pipeline, without the need to interact with cloud consoles or CLI tools.

Add a dataset

From the Datasets tab, select Add dataset, then select Upload file.

Specify the following dataset details:

  • A Name for the dataset, such as proteinfold_samplesheet.
  • A Description for the dataset.
  • Drag your CSV or TSV samplesheet into the upload area, or select Upload file.
  • Select Set first row as header so that Platform doesn't parse the header row of the samplesheet as sample data.
  • Select Add.

The dataset is now listed in your organization workspace datasets and can be selected as input when launching your pipeline.

info

Platform does not store the data used for analysis in pipelines. The dataset must specify the locations of data stored on your own infrastructure.

Launch pipeline​

note

This guide is based on version 1.1.1 of the nf-core/proteinfold pipeline. Launch form parameters and tools may differ in other versions.

With your compute environment created, nf-core/proteinfold added to your workspace Launchpad, and your samplesheet accessible in Platform, you are ready to launch your pipeline. Navigate to the Launchpad and select Launch next to nf-core-proteinfold to open the launch form.

The launch form has four steps: General config, Run parameters, Advanced settings, and Summary. To move between steps, select a step name at the top of the form, or select Previous and Next.

General config​

Check the following fields in General config:

  • Pipeline to launch: The pipeline Git repository name or URL: https://github.com/nf-core/proteinfold. For saved pipelines, this is prefilled and cannot be edited.
  • Revision: A valid repository commit ID, tag, or branch name: 1.1.1. For saved pipelines, this is prefilled and cannot be edited.
  • Config profiles: One or more configuration profile names to use for the execution. Config profiles must be defined in the nextflow.config file in the pipeline repository. Benchmarking runs for this guide used nf-core profiles with included test datasets — test_full_alphafold2_multimer for Alphafold2 and test_full_alphafold2_multimer for Colabfold.
  • Workflow run name: An optional identifier for the run. If you leave it blank, Platform generates a random name at launch.
  • Labels: Assign new or existing labels to the run.
  • Compute environment: Your AWS Batch compute environment.
  • Work directory: The cloud storage path where pipeline scratch data is stored. Platform will create a scratch sub-folder if only a cloud bucket location is specified.
    note

    The credentials associated with the compute environment must have access to the work directory.

Run parameters​

There are three ways to enter Run parameters prior to launch:

  • The Input form view displays form fields to enter text or select attributes from lists, and browse input and output locations with Data Explorer.
  • The Params file view displays raw parameters that you can edit directly. Select JSON or YAML format from the View as list.
  • Upload params file allows you to upload a JSON or YAML file with run parameters.

Platform uses the nextflow_schema.json file in the root of the pipeline repository to dynamically create a form with the necessary pipeline parameters.

Specify your pipeline input and output and modify other pipeline parameters as needed.

input

Use Browse to select your pipeline input data:

  • In the Datasets tab, search for and select your existing dataset.
  • In the Data Explorer tab, open the data repository that contains your samplesheet, browse to the samplesheet file, then select Select next to it.
outdir

Use the outdir parameter to specify where the pipeline outputs are published. outdir must be unique for each pipeline run. Otherwise, your results will be overwritten.

Browse and copy cloud storage directory paths using Data Explorer, or enter a path manually.

  • The mode menu allows you to select the deep learning model used for structure prediction (alphafold2, colabfold, or esmfold).
  • Enable use_gpu to run GPU-compatible tasks on GPUs. This requires Use Amazon-recommended GPU-optimized ECS AMI to be enabled and GPU-enabled instances to be specified under Instance types in your compute environment.
info

For the purposes of this guide, run the pipeline in both alphafold2 and colabfold modes. Specify unique directory paths for the outdir parameter (such as "Alphafold2" and "ColabFold") to ensure output data is kept separate and not overwritten. Predicted protein structures for each model will be visualized side-by-side in the Interactive analysis section.

Advanced settings​

The Advanced settings section is optional:

  • Use resource labels to tag the computing resources created during the workflow execution. While resource labels for the run are inherited from the compute environment and pipeline, workspace admins can override them from the launch form. Applied resource label names must be unique.
  • Pipeline secrets store keys and tokens used by workflow tasks to interact with external systems. Enter the names of any stored user or workspace secrets required for the workflow execution.
  • See Advanced options for more details.

After you fill in the launch details, select Summary to review them, then select Launch. Platform opens the Runs page, with your new run at the top of the list in a Submitted status. Select the run name to open its run details page.

Run monitoring

Select your run in the Runs list to open its run details page. The header shows key details, such as the run ID, pipeline, work directory, and compute environment. The page has the following tabs:

  • Tasks: Task status counts, the execution timeline, and a table of every task in the run. This tab opens by default.
  • Logs: The Nextflow execution log for the run.
  • Metrics: Total wall time, CPU time, memory, and estimated cost, with resource usage charts.
  • Configuration: The config profiles, launch command, and resolved Nextflow configuration.
  • Inputs: The parameters the run used, and any datasets.
  • Outputs: The files the run published, and its reports.
  • Containers: The containers Wave provisioned for the run.
  • Run Info: Who launched the run and when, the pipeline version and Git commit, and where it ran.

View reports​

Most Nextflow pipelines generate reports or output files which are useful to inspect at the end of the pipeline execution. Reports can contain quality control (QC) metrics that are important to assess the integrity of the results. The Reports section of the Outputs tab lists each report.

The paths to report files point to a location in cloud storage (in the outdir directory specified during launch), but you can view the contents directly and download each file without navigating to the cloud or a remote filesystem.

info

See Reports for more information.

Task details​

Select a task in the Tasks table to open the Task details dialog. The dialog has five tabs:

  • About: Task execution details, such as the status, exit code, command, and work directory.
  • Metrics: Execution times, and the resources the task requested and used.
  • Execution log: A real-time log of the task's execution. Download task logs, such as stdout and stderr, while they remain in your compute environment.
  • Data Explorer: The task's work directory.
  • Container: The container the task ran in.

Nextflow hash-addresses each task of the pipeline and creates unique directories based on these hashes. Data Explorer allows you to view the log files and output files generated for each task in its working directory, directly within Platform. You can view, download, and retrieve the link for these intermediate files in cloud storage from the Data Explorer tab to simplify troubleshooting.

Interactive analysis with Studios​

Studios streamlines the process of creating interactive analysis environments. With built-in templates for Jupyter, R-IDE, and VS Code, creating a Studio is as simple as adding and sharing pipelines or datasets. You can also share the Studio URL with any user with the Connect role for real-time access and collaboration.

For the purposes of this guide, a Jupyter notebook environment will be used for interactive visualization of the predicted protein structures, optionally comparing AlphaFold2 and Colabfold structures for the same sequence data.

Create a Jupyter Notebook studio​

From the Studios tab, select Add Studio and complete the following:

  • Under Studio environment:

    • Select Provided container template, then select the Recommended Jupyter image from the Template list.
    • Expand More settings, select Install Conda packages, and paste the following Conda environment YAML snippet:
    channels:
    - bioconda
    - conda-forge
    dependencies:
    - python=3.10
    - conda-forge::biopython=1.84
    - conda-forge::nglview=3.1.2
    - conda-forge::ipywidgets=8.1.5
  • Under Data, select Mount data, then select the S3 bucket or directory path that contains the output of your proteinfold runs.

  • Under Compute, select your AWS Batch compute environment. Optionally, change CPUs allocated and Maximum memory allocated. The defaults are 2 CPUs and 8192 MiB of memory.

    info

    The same compute environment can be used for pipeline execution and running your Studio, but Studios does not support AWS Fargate and Studio sessions must run on CPUs. To use one compute environment for both nf-core/proteinfold execution and your Studio, leave Enable Fargate for head job disabled and include at least one CPU-based EC2 instance family (c6id, r6id, etc.) in your Instance types.

    Alternatively, create a second basic AWS Batch compute environment with at least 2 CPUs and 8192 MiB of memory for your Studio.

  • Under Details, optionally change the Name, and expand More settings to add a Description.

  • Select Add and start. To create the Studio without starting it, select Add, then start it later from its options menu.

  • When the Studio is running, select Connect from its options menu.

Visualize protein structures​

The Jupyter environment can be configured with the packages and scripts you need for interactive analysis. For the purposes of this guide, run the following scripts in individual code cells to install the necessary packages and perform visualization:

  1. Import libraries and check versions:

    import sys
    import jupyter_core
    import nglview
    import ipywidgets
    import Bio

    print(f"Python version: {sys.version}")
    print(f"Jupyter version: {jupyter_core.__version__}")
    print(f"nglview version: {nglview.__version__}")
    print(f"ipywidgets version: {ipywidgets.__version__}")
    print(f"Biopython version: {Bio.__version__}")
    print(f"Operating system: {sys.platform}")
    print("All required libraries imported successfully.")
  2. Define visualization functions:

    import os
    import ipywidgets as widgets
    from IPython.display import display, HTML

    def visualize_protein(pdb_file, width='400px', height='400px'):
    view = nglview.show_structure_file(pdb_file)
    view.add_representation('cartoon', selection='protein', color='residueindex')
    view.add_representation('ball+stick', selection='hetero')
    view._remote_call('setSize', target='Widget', args=[width, height])

    # Set initial view
    view._remote_call('autoView')
    view._remote_call('centerView')

    # Adjust zoom level (you may need to adjust this value)
    view._remote_call('zoom', target='stage', args=[0.8])

    return view

    def compare_proteins(pdb_files):
    views = []
    for method, file_path in pdb_files.items():
    if os.path.exists(file_path):
    view = visualize_protein(file_path)
    label = widgets.Label(method)
    views.append(widgets.VBox([label, view]))
    return widgets.HBox(views, layout=widgets.Layout(width='100%'))

    print("Visualization functions defined successfully.")
  3. Set up file paths and create file dictionary:

    # Replace with the actual paths to your AlphaFold2 and ColabFold PDB files
    alphafold_pdb = "data/path/to/your/alphafold/output.pdb"
    colabfold_pdb = "data/path/to/your/colabfold/output.pdb"

    # Create a dictionary of files
    pdb_files = {
    "AlphaFold": alphafold_pdb,
    "ColabFold": colabfold_pdb
    }

    print("File paths set up successfully.")
  4. Display file information:

    display(HTML("<h3>Protein Structure Prediction Output Files:</h3>"))
    for method, file_path in pdb_files.items():
    if os.path.exists(file_path):
    display(HTML(f"<p><strong>{method}:</strong> {file_path}</p>"))
    else:
    display(HTML(f"<p><strong>{method}:</strong> File not found at {file_path}</p>"))
  5. Visualize structures:

    valid_pdb_files = {method: file_path for method, file_path in pdb_files.items() if os.path.exists(file_path)}

    if valid_pdb_files:
    display(HTML("<h3>Protein Structure Visualization:</h3>"))
    comparison = compare_proteins(valid_pdb_files)
    display(comparison)
    else:
    display(HTML("<p>No valid PDB files found. Please check the file paths and ensure that the files exist.</p>"))
  6. Add interactive elements:

    if valid_pdb_files:
    method_drop-down = widgets.Drop-down(
    options=[method for method, file in valid_pdb_files.items()],
    description='Select method:',
    disabled=False,
    )

    info_output = widgets.Output()

    def on_change(change):
    with info_output:
    info_output.clear_output()
    selected_method = change['new']
    selected_file = valid_pdb_files[selected_method]
    print(f"Selected method: {selected_method}")
    print(f"File path: {selected_file}")
    print(f"File size: {os.path.getsize(selected_file) / 1024:.2f} KB")

    method_drop-down.observe(on_change, names='value')

    display(HTML("<h3>Structure Information:</h3>"))
    display(widgets.VBox([method_drop-down, info_output]))
  7. Display usage instructions:

    display(HTML("""
    <h3>How to use this visualization:</h3>
    <ul>
    <li>The protein structures from AlphaFold and ColabFold are shown side-by-side above.</li>
    <li>You can interact with each structure independently:</li>
    <ul>
    <li>Click and drag to rotate the structure.</li>
    <li>Scroll to zoom in and out.</li>
    <li>Right-click and drag to translate the structure.</li>
    </ul>
    <li>Use the drop-down to select a specific method and view its file information.</li>
    </ul>
    """))