Skip to content
This repository was archived by the owner on Aug 9, 2023. It is now read-only.

Commit 6670a82

Browse files
authored
Merge pull request #23 from wleepang/sfn-example
Add sfn example
2 parents 2443580 + 64db9f8 commit 6670a82

24 files changed

+1121
-2
lines changed
398 KB
Loading
43.1 KB
Loading
189 KB
Loading
221 KB
Loading
18.5 KB
Loading
50.7 KB
Loading

docs/orchestration/step-functions/step-functions-overview.md

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@ In the context of genomics workflows, the combination of AWS Step Functions with
88

99
## Full Stack Deployment (TL;DR)
1010

11-
If you need something up and running in a hurry, a fully automated setup process
12-
is provided at this GitHub repository:
11+
If you need something up and running in a hurry, the follwoing CloudFormation template will create everything you need to run an example genomics workflow using `bwa-mem`, `samtools`, and `bcftools`.
12+
13+
| Name | Description | Source | Launch Stack |
14+
| -- | -- | :--: | :--: |
15+
{{ cfn_stack_row("AWS Step Functions All-in-One Example", "AWSGenomicsWorkflow", "step-functions/sfn-aio.template.yaml", "Create all resources needed to run a genomics workflow with Step Functions: an S3 Bucket, AWS Batch Environment, State Machine, Batch Job Definitions, and container images") }}
16+
17+
Another example that uses a scripted setup process is provided at this GitHub repository:
1318

1419
[AWS Batch Genomics](https://github.com/aws-samples/aws-batch-genomics)
1520

21+
1622
If you are interested in creating your own solution with AWS Step Functions and AWS Batch,
1723
read through the rest of this page.
1824

@@ -219,3 +225,39 @@ Inputs to a state machine that uses the above `BwaMemTask` would look like this:
219225
```
220226

221227
When the Task state completes Step Functions will add information to a new `status` key under `bwa-mem` in the JSON object. The complete object will be passed on to the next state in the workflow.
228+
229+
## Example state machine
230+
231+
All of the above is created by the following CloudFormation template.
232+
233+
| Name | Description | Source | Launch Stack |
234+
| -- | -- | :--: | :--: |
235+
{{ cfn_stack_row("AWS Step Functions Example", "SfnExample", "step-functions/sfn-example.template.yaml", "Create a Step Functions State Machine, Batch Job Definitions, and container images to run an example genomics workflow") }}
236+
237+
!!! note
238+
The stack above needs to create several IAM Roles. You must have administrative privileges in your AWS Account for this to succeed.
239+
240+
### Running the workflow
241+
242+
When the stack above completes, go to the outputs tab and copy the JSON string provided in `StateMachineInput`.
243+
244+
![cloud formation output tab](./images/cfn-stack-outputs-tab.png)
245+
![example state-machine input](./images/cfn-stack-outputs-statemachineinput.png)
246+
247+
Next head to the AWS Step Functions console and select the state-machine that was created.
248+
249+
![select state-machine](./images/sfn-console-statemachine.png)
250+
251+
Click the "Start Execution" button.
252+
253+
![start execution](./images/sfn-console-start-execution.png)
254+
255+
In the dialog that appears, paste the input JSON into the "Input" field, and click the "Start Execution" button. (A unique execution ID will be automatically generated).
256+
257+
![start execution dialog](./images/sfn-console-start-execution-dialog.png)
258+
259+
You will then be taken to the execution tracking page where you can monitor the progress of your workflow.
260+
261+
![execution tracking](./images/sfn-console-execution-inprogress.png)
262+
263+
The workflow takes approximately 5-6hrs to complete on `r4.2xlarge` SPOT instances.

docs/tldr.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Below are the stand-alone CloudFormation templates for each of the sub-stacks. T
6060

6161
| Name | Description | Source | Launch Stack |
6262
| -- | -- | :--: | :--: |
63+
{{ cfn_stack_row("AWS Step Functions Example", "SfnExample", "step-functions/sfn-example.template.yaml", "Create a Step Functions State Machine, Batch Job Definitions, and container images to run an example genomics workflow") }}
6364
{{ cfn_stack_row("Cromwell Server", "CromwellServer", "cromwell/cromwell-server.template.yaml", "Create an EC2 instance and an IAM instance profile to run Cromwell") }}
6465
{{ cfn_stack_row("Nextflow Resources", "NextflowResources", "nextflow/nextflow-resources.template.yaml", "Create Nextflow specific resources needed to run on AWS: an S3 Bucket for nextflow config and workflows, AWS Batch Job Definition for a Nextflow head node, and an IAM role for the nextflow head node job") }}
6566

src/containers/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
push.sh
2+
job-definition.json

src/containers/bcftools/Dockerfile

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
FROM ubuntu:18.04 AS build
2+
3+
ARG VERSION=1.9
4+
5+
# Metadata
6+
LABEL container.base.image="ubuntu:18.04"
7+
LABEL software.name="BCFtools"
8+
LABEL software.version=${VERSION}
9+
LABEL software.description="Utilities for variant calling and manipulating files in the Variant Call Format (VCF) and its binary counterpart BCF"
10+
LABEL software.website="http://www.htslib.org"
11+
LABEL software.documentation="http://www.htslib.org/doc/bcftools.html"
12+
LABEL software.license="MIT/Expat"
13+
LABEL tags="Genomics"
14+
15+
# System and library dependencies
16+
RUN apt-get -y update && \
17+
apt-get -y install \
18+
autoconf \
19+
automake \
20+
make \
21+
gcc \
22+
perl \
23+
zlib1g-dev \
24+
libbz2-dev \
25+
liblzma-dev \
26+
libcurl4-gnutls-dev \
27+
libssl-dev \
28+
libncurses5-dev \
29+
wget && \
30+
apt-get clean
31+
32+
# Application installation
33+
RUN wget -O /bcftools-${VERSION}.tar.bz2 \
34+
https://github.com/samtools/bcftools/releases/download/${VERSION}/bcftools-${VERSION}.tar.bz2 && \
35+
tar xvjf /bcftools-${VERSION}.tar.bz2 && rm /bcftools-${VERSION}.tar.bz2
36+
37+
WORKDIR /bcftools-${VERSION}
38+
RUN ./configure && make
39+
40+
FROM ubuntu:18.04 AS final
41+
COPY --from=build /bcftools-*/bcftools /usr/local/bin
42+
43+
RUN apt-get -y update && \
44+
apt-get -y install \
45+
libcurl3-gnutls && \
46+
apt-get clean
47+
48+
ENTRYPOINT ["bcftools"]

0 commit comments

Comments
 (0)