https://github.com/awslabs/aws-healthomics-tools
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.6%) to scientific vocabulary
Keywords from Contributors
Repository
Basic Info
- Host: GitHub
- Owner: awslabs
- License: apache-2.0
- Language: Python
- Default Branch: main
- Size: 824 KB
Statistics
- Stars: 36
- Watchers: 9
- Forks: 11
- Open Issues: 7
- Releases: 0
Metadata Files
README.md
AWS HealthOmics Tools
SDK and CLI Tools for working with the AWS HealthOmics Service.
Installation
AWS HealthOmics Tools is available through pypi. To install, type:
bash
pip install aws-healthomics-tools
Install from source
Installing from source requires that your machine has the following prerequisites installed:
- python3.10 or above
- poetry package manager
- make build tool
git clone https://github.com/awslabs/aws-healthomics-tools.git
cd ./aws-healthomics-tools
make install
SDK Tools
HealthOmics Transfer Manager
Basic Usage
The TransferManager class makes it easy to download files from a AWS HealthOmics reference or read set. By default the files are saved to the current directory, or you can specify a custom location with the directory parameter.
```python import boto3 from omics.common.omicsfiletypes import ReadSetFileName, ReferenceFileName, ReadSetFileType from omics.transfer.manager import TransferManager from omics.transfer.config import TransferConfig
REFERENCESTOREID = "
client = boto3.client("omics") manager = TransferManager(client)
Download all files for a reference.
manager.downloadreference(REFERENCESTORE_ID, "
Download all files for a read set to a custom directory.
manager.downloadreadset(SEQUENCESTOREID, "
Download specific files
Specific files can be downloaded via the download_reference_file and download_read_set_file methods.
The client_fileobj parameter can be either the name of a local file to create for storing the data, or a TextIO or BinaryIO object that supports write methods.
```python
Download a specific reference file.
manager.downloadreferencefile(
REFERENCESTOREID,
"
Download a specific read set file with a custom filename.
manager.downloadreadsetfile(
SEQUENCESTORE_ID,
"
Upload specific files
Specific files can be uploaded via the upload_read_set method.
The fileobjs parameter can be either the name of a local file, or a TextIO or BinaryIO object that supports read methods.
For paired end reads, you can define fileobjs as a list of files.
```python
Upload a specific read set file.
readsetid = manager.uploadreadset(
"my-sequence-data/read-set-file.bam",
SEQUENCESTOREID,
"BAM",
"name",
"subject-id",
"sample-id",
"
Upload paired end read set files.
readsetid = manager.uploadreadset(
["my-sequence-data/read-set-file1.fastq.gz", "my-sequence-data/read-set-file2.fastq.gz"],
SEQUENCESTOREID,
"FASTQ",
"name",
"subject-id",
"sample-id",
"
Subscribe to events
Transfer events: on_queued, on_progress, and on_done can be observed by defining a subclass of OmicsTransferSubscriber and passing in an object which can receive events.
```python class ProgressReporter(OmicsTransferSubscriber): def onqueued(self, **kwargs): future: OmicsTransferFuture = kwargs["future"] print(f"Download queued: {future.meta.callargs.fileobj}")
def on_done(self, **kwargs):
print("Download complete")
manager.downloadreadset(SEQUENCESTOREID, "
Threads
Transfer operations use threads to implement concurrency. Thread use can be disabled by setting the use_threads attribute to False.
If thread use is disabled, transfer concurrency does not occur. Accordingly, the value of the max_request_concurrency attribute is ignored.
```python
Disable thread use/transfer concurrency
config = TransferConfig(usethreads=False)
manager = TransferManager(client, config)
manager.downloadreadset(SEQUENCESTORE_ID, "
HealthOmics URI Parser
The OmicsUriParser class makes it easy to parse AWS HealthOmics readset and reference URIs to extract fields relevant for calling
AWS HealthOmics APIs.
Readset file URI:
Readset file URIs come in the following format:
text
omics://<AWS_ACCOUNT_ID>.storage.<AWS_REGION>.amazonaws.com/<SEQUENCE_STORE_ID>/readSet/<READSET_ID>/<SOURCE1/SOURCE2>
For example:
text
omics://123412341234.storage.us-east-1.amazonaws.com/5432154321/readSet/5346184667/source1
omics://123412341234.storage.us-east-1.amazonaws.com/5432154321/readSet/5346184667/source2
Reference file URI:
Reference file URIs come in the following format:
text
omics://<AWS_ACCOUNT_ID>.storage.<AWS_REGION>.amazonaws.com/<REFERENCE_STORE_ID>/reference/<REFERENCE_ID>/source
For example:
text
omics://123412341234.storage.us-east-1.amazonaws.com/5432154321/reference/5346184667/source
To handle both HealthOmics URI types, you would use code like the following:
```python import boto3 from omics.uriparse.uri_parse import OmicsUriParser, OmicsUri
READSETURISTRING = "omics://123412341234.storage.us-east-1.amazonaws.com/5432154321/readSet/5346184667/source1" REFERENCEURISTRING = "omics://123412341234.storage.us-east-1.amazonaws.com/5432154321/reference/5346184667/source"
client = boto3.client("omics")
readset = OmicsUriParser(READSETURISTRING).parse() reference = OmicsUriParser(REFERENCEURISTRING).parse()
use the parsed fields from the URIs to call AWS HealthOmics APIs:
manager = TransferManager(client)
Download all files for a reference.
manager.downloadreference(reference.storeid, reference.resource_id)
Download all files for a read set to a custom directory.
manager.downloadreadset(readset.storeid, readset.resourceid, readset.file_name)
Download a specific read set file with a custom filename.
manager.downloadreadsetfile( readset.storeid, readset.resourceid, readset.filename, "my-sequence-data/read-set-index" ) ```
CLI Tools
CLI tools are modules in this package that can be invoked from the command line with:
bash
python -m omics.cli.<TOOL-NAME>
HealthOmics Rerun
The rerun tool makes it easy to start a new run execution from a CloudWatch Logs manifest.
For an overview of what it does and available options run:
bash
aws-healthomics-tools rerun -h
List runs from manifest
The following example lists all workflow run ids which were completed on July 1st (UTC time):
bash
aws-healthomics-tools rerun -s 2023-07-01T00:00:00 -e 2023-07-02T00:00:00
this returns something like:
text
1234567 (2023-07-01T12:00:00.000)
2345678 (2023-07-01T13:00:00.000)
Rerun a previously-executed run
To rerun a previously-executed run, specify the run id you would like to rerun:
bash
aws-healthomics-tools rerun 1234567
this returns something like:
text
StartRun request:
{
"workflowId": "4974161",
"workflowType": "READY2RUN",
"roleArn": "arn:aws:iam::123412341234:role/MyRole",
"parameters": {
"inputFASTQ_2": "s3://omics-us-west-2/sample-inputs/4974161/HG002-NA24385-pFDA_S2_L002_R2_001-5x.fastq.gz",
"inputFASTQ_1": "s3://omics-us-west-2/sample-inputs/4974161/HG002-NA24385-pFDA_S2_L002_R1_001-5x.fastq.gz"
},
"outputUri": "s3://my-bucket/my-path"
}
StartRun response:
{
"arn": "arn:aws:omics:us-west-2:123412341234:run/3456789",
"id": "3456789",
"status": "PENDING",
"tags": {}
}
It is possible to override a request parameter from the original run. The following example tags the new run, which is particularly useful as tags are not propagated from the original run.
```bash aws-healthomics-tools rerun 1234567 --tag=myKey=myValue
```
this returns something like:
text
StartRun request:
{
"workflowId": "4974161",
"workflowType": "READY2RUN",
"roleArn": "arn:aws:iam::123412341234:role/MyRole",
"parameters": {
"inputFASTQ_2": "s3://omics-us-west-2/sample-inputs/4974161/HG002-NA24385-pFDA_S2_L002_R2_001-5x.fastq.gz",
"inputFASTQ_1": "s3://omics-us-west-2/sample-inputs/4974161/HG002-NA24385-pFDA_S2_L002_R1_001-5x.fastq.gz"
},
"outputUri": "s3://my-bucket/my-path",
"tags": {
"myKey": "myValue"
}
}
StartRun response:
{
"arn": "arn:aws:omics:us-west-2:123412341234:run/4567890",
"id": "4567890",
"status": "PENDING",
"tags": {
"myKey": "myValue"
}
}
Before submitting a rerun request, it is possible to dry-run to view the new StartRun request:
bash
aws-healthomics-tools rerun -d 1234567
this returns something like:
text
StartRun request:
{
"workflowId": "4974161",
"workflowType": "READY2RUN",
"roleArn": "arn:aws:iam::123412341234:role/MyRole",
"parameters": {
"inputFASTQ_2": "s3://omics-us-west-2/sample-inputs/4974161/HG002-NA24385-pFDA_S2_L002_R2_001-5x.fastq.gz",
"inputFASTQ_1": "s3://omics-us-west-2/sample-inputs/4974161/HG002-NA24385-pFDA_S2_L002_R1_001-5x.fastq.gz"
},
"outputUri": "s3://my-bucket/my-path"
}
HealthOmics Run Analyzer
The run_analyzer tool retrieves a workflow run manifest from CloudWatchLogs and generates statistics for the run, including CPU and memory utilization for each workflow task.
For an overview of what it does and available options run:
bash
aws-healthomics-tools run_analyzer -h
List completed runs
The following example lists all workflow runs completed in the past 5 days:
bash
aws-healthomics-tools run_analyzer -t5d
this returns something like:
text
Workflow run IDs (<completionTime> <UUID>):
1234567 (2024-02-01T12:00:00 12345678-1234-5678-9abc-123456789012)
2345678 (2024-02-03T13:00:00 12345678-1234-5678-9abc-123456789012)
Analyze a specific workflow run
bash
aws-healthomics-tools run_analyzer 1234567 -o run-1234567.csv
Providing a UUID
If a run ID is ambiguous, you can provide a UUID along with the run ID in the following way:
bash
aws-healthomics-tools run_analyzer 1234567:2eca9876-ac33-98cd-0298-11cc59c05273 -o run-1234567.csv
this returns something like:
text
omics-run-analyzer: wrote run-1234567.csv
Output Columns
The CSV output by the command above includes the following columns:
- uuid : Globally unique identifier to identify runs across accounts and regions
- arn : Unique workflow run or task identifier
- type : Resource type (run or task)
- name : Workflow run or task name
- startTime : Start timestamp for the workflow run or task (UTC time)
- stopTime : Stop timestamp for the workflow run or task (UTC time)
- runningSeconds : Approximate workflow run or task runtime (in seconds)
- cpusRequested : The number of vCPU requested by the workflow task
- gpusRequested : The number of GPUs requested by the workflow task
- memoryRequestedGiB : Gibibytes of memory requested by the workflow task
- omicsInstanceTypeReserved : Requested HealthOmics instance type for each task
- omicsInstanceTypeMinimum : Minimum HealthOmics instance type that could run each task.
- recommendedCpus: The number of CPUs recommended for this task (corresponding to the number of CPUs in the omicsInstanceTypeMinimum)
- recommendedMemoryGiB: The amount of GiB of memory recommended for this task (corresponding to the number of CPUs in the omicsInstanceTypeMinimum)
- estimatedUSD : Estimated HealthOmics charges (USD) for the workflow based on sizeReserved and runningSeconds
- minimumUSD : Estimated HealthOmics charges (USD) for the workflow based on the recommended omicsInstanceTypeMinimum and runningSeconds
- cpuUtilizationRatio : CPU utilization (cpusMaximum / cpusReserved) for workflow task(s)
- memoryUtilizationRatio : Memory utilization (memoryMaximumGiB / memoryReservedGiB) for the workflow task(s)
- storageUtilizationRatio : Storage utilization (storageMaximumGiB / storageReservedGiB) for the workflow run
- cpusReserved : vCPUs reserved for workflow task(s)
- cpusMaximum : Maximum vCPUs used during a single 1-minute interval
- cpusAverage : Average vCPUs used by workflow task(s)
- gpusReserved : GPUs reserved for workflow task(s)
- memoryReservedGiB : Gibibytes of memory reserved for workflow task(s)
- memoryMaximumGiB : Maximum gibibytes of memory used during a single 1-minute interval
- memoryAverageGiB : Average gibibytes of memory used by workflow task(s)
- storageReservedGiB : Gibibytes of storage reserved for the workflow run
- storageMaximumGiB : Maximum gibibytes of storage used during a single 1-minute interval
- storageAverageGiB : Average gibibytes of storage used by the workflow run
For rows that are a task type, the maximums, averages and reserved columns refer to the maximum, average or reserved amounts of the respective resource used by that task. These values can be used to guide the resources that should be requested for that task. For rows that are a run type the maximums, averages and reserved columns refer to the maximum, average or reserved amounts of the respective resource used concurrently by that run. These values can be used to determine if the accounts HealthOmics active CPUs/memory limits are being reached which might indicate the run is constrained by these limits.
[!WARNING]
At this time AWS HealthOmics does not report the average or maximum storage used by runs that use "DYNAMIC" storage that run for under two hours. Because of this limitation thestorageMaximumGiBandstorageAverageGiBare set to zero and will not be included in the estimate run cost.
Run Optimization and Estimated Cost Reduction
Based on the metrics observed and calculated for a run, the application will recommend the smallest instance type that could be used for each task in the run. The type is reported in the omicsInstanceTypeMinimum column. To obtain this type for a task you can set the task CPU and memory requested for the task to the values of recommendedCpus and recommendedMemoryGiB in you workflow definition. Based on this change each task would be estimated to
reduce the cost of the run by estimatedUSD minus minimumUSD. The total potential cost reduction for the entire run can be estimated by subtracting the minimumUSD value from the estimatedUSD value in the row where the type is "run".
[!WARNING] Cost estimates are based on the AWS list price at the time the run analysis is performed. In the event prices have changed these may not reflect the price you were charged at the time of the run. Further, the run analyzer does not account for any discounts, credits or price agreements you may have. Price estimates for recommended instance sizes (
minimumUSD) assume that the runtime of the task will remain the same on the recommended instance. Actual costs will be determined based on the actual runtime.
Add headroom to recommendations
Sometimes you will see variance in the amount of memory and CPU used in a run task, especially if you expect to run workflows with larger input files than were used in the analyzed run. For this reason you might want to allow add some headroom to the recommendations produced by the the run analyzer.
The -H or --headroom flag can be use to add an additional 0.0 to 1.0 times the max CPU or memory used by a task to the calculation used to determine
the omicsInstanceTypeMinimum recommendation. For example if a task used a max of 3.6 GiB of memory and the headroom value is 0.5 then 6 GiB of memory - math.ceil(3.6 * (1 + 0.5)) - will be used to determine the minimum instance type that should be used.
If your analyzed run is already close to optimal then adding headroom might result in the recommended minimum instance being larger than the instance used in the run which will also cause the "minimumUSD" to be larger than the "estimatedUSD".
Produce a timeline plot for a run
The RunAnalyzer tool can produce an interative timeline plot of a workflow. The plots allow you to visualize how individual tasks ran over the course of the run.
bash
aws-healthomics-tools run_analyzer -P plots/ 7113639

Output workflow run manifest in JSON format
bash
aws-healthomics-tools run_analyzer 1234567 -s -o run-1234567.json
this returns something like:
text
omics-run-analyzer: wrote run-1234567.json
Output optimized configuration
[!WARNING] Currently this feature only supports Nextflow workflows.
The --write-config option will write a new configuration file with the recommendedCpus and recommendedMemoryGiB as the resource requirements. This will take the maximum values if the task is run multiple times with different inputs.
bash
aws-healthomics-tools run_analyzer 123456 --write-config=optimized.config
Aggregate scattered tasks and multiple runs (batch mode)
[!NOTE] This feature is currently experimental and the output may change in future versions. We encourage feedback on which aggregations are useful and which are not.
The --batch option can be used with a single run to aggregate all scattered tasks into one summarized task report. Non scattered tasks are also aggregated but will have a count of 1.
bash
aws-healthomics-tools run_analyzer 1234567 --batch
The option may also be used with multiple runs to aggregate all tasks including scattered tasks.
bash
aws-healthomics-tools run_analyzer 1234567 2345678 3456789 --batch
These statics are reported in CSV format:
- "type": The type of row (currently always task),
- "name": The base name of the task with any scatter suffix removed
- "count": The number of times the named task has been observed in the runs
- "meanRunningSeconds": The average runtime in seconds for the named tasks
- "maximumRunningSeconds": The longest runtime in seconds for the named task
- "stdDevRunningSeconds": The standard deviation of runtimes for the named task
- "maximumCpuUtilizationRatio": The highest CPU utilization ratio seen for any of the named tasks
- "meanCpuUtilizationRation": The average CPU utilization ratio for the named task
- "maximumMemoryUtilizationRatio": The highest memory utilization ratio seen for any of the named tasks
- "meanMemoryUtilizationRation": The average memory utilization ratio for the named task
- "maximumGpusReserved": The largest number of GPUs reserved for the named tasks
- "meanGpusReserved": The average number of GPUs reserved for the named task
- "recommendedCpus": The recommended number of Cpus that would accommodate all observed instances of a task (including any headroom factor)
- "recommendedMemoryGiB": The recommended GiBs of memory that would accommodate all observed instances of a task (including and headroom factor)
- "recommendOmicsInstanceType": The recommended omics instance type that would accomodate all observed instances of a task
- "maximumEstimatedUSD": The largest estimated cost observed for the named task.
- "meanEstimatedUSD": The average estimated cost observed for the named task.
Security
See CONTRIBUTING for more information.
License
This project is licensed under the Apache-2.0 License.
Owner
- Name: Amazon Web Services - Labs
- Login: awslabs
- Kind: organization
- Location: Seattle, WA
- Website: http://amazon.com/aws/
- Repositories: 914
- Profile: https://github.com/awslabs
AWS Labs
GitHub Events
Total
- Watch event: 11
- Delete event: 25
- Issue comment event: 32
- Push event: 61
- Pull request review comment event: 5
- Pull request review event: 33
- Pull request event: 65
- Fork event: 4
- Create event: 31
Last Year
- Watch event: 11
- Delete event: 25
- Issue comment event: 32
- Push event: 61
- Pull request review comment event: 5
- Pull request review event: 33
- Pull request event: 65
- Fork event: 4
- Create event: 31
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Mark Schreiber | m****e@a****m | 42 |
| dependabot[bot] | 4****] | 20 |
| Vidul Mahendru | m****l@a****m | 7 |
| W. Lee Pang | w****g@g****m | 6 |
| Kevin Sayers | s****t@g****m | 5 |
| Ryan Forsyth | r****f@a****m | 5 |
| Andy Henroid | a****d@a****m | 4 |
| Mike Hemesath | h****h@a****m | 4 |
| Avinash Gogineni | 3****a | 3 |
| Taylor | t****y | 3 |
| duongwilAWS | 1****S | 2 |
| Hyunmin Kim (Brandon) | h****m | 2 |
| Amazon GitHub Automation | 5****o | 1 |
| Eduardo Calleja | m****n@g****m | 1 |
| Matt Pawelczyk | m****k@a****m | 1 |
| Ziyang Li | z****i@a****m | 1 |
| Ziyang Li | 6****D | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 0
- Total pull requests: 40
- Average time to close issues: N/A
- Average time to close pull requests: 4 days
- Total issue authors: 0
- Total pull request authors: 4
- Average comments per issue: 0
- Average comments per pull request: 1.05
- Merged pull requests: 33
- Bot issues: 0
- Bot pull requests: 28
Past Year
- Issues: 0
- Pull requests: 40
- Average time to close issues: N/A
- Average time to close pull requests: 4 days
- Issue authors: 0
- Pull request authors: 4
- Average comments per issue: 0
- Average comments per pull request: 1.05
- Merged pull requests: 33
- Bot issues: 0
- Bot pull requests: 28
Top Authors
Issue Authors
Pull Request Authors
- dependabot[bot] (26)
- markjschreiber (7)
- goginea (2)
- KevinSayers (2)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- actions/checkout v3 composite
- trufflesecurity/trufflehog main composite
- CacheControl 0.12.11 develop
- GitPython 3.1.29 develop
- PyYAML 6.0 develop
- Pygments 2.13.0 develop
- attrs 22.1.0 develop
- bandit 1.7.4 develop
- black 22.10.0 develop
- certifi 2022.9.24 develop
- charset-normalizer 2.1.1 develop
- click 8.1.3 develop
- colorama 0.4.6 develop
- commonmark 0.9.1 develop
- coverage 6.5.0 develop
- cyclonedx-python-lib 3.1.1 develop
- exceptiongroup 1.0.4 develop
- flake8 5.0.4 develop
- flake8-docstrings 1.6.0 develop
- gitdb 4.0.10 develop
- html5lib 1.1 develop
- idna 3.4 develop
- iniconfig 1.1.1 develop
- isort 5.10.1 develop
- lockfile 0.12.2 develop
- mccabe 0.7.0 develop
- msgpack 1.0.4 develop
- mypy 0.971 develop
- mypy-extensions 0.4.3 develop
- packageurl-python 0.10.4 develop
- packaging 21.3 develop
- pathspec 0.10.2 develop
- pbr 5.11.0 develop
- pip 22.3.1 develop
- pip-api 0.0.30 develop
- pip-audit 2.4.7 develop
- pip-requirements-parser 31.2.0 develop
- platformdirs 2.5.4 develop
- pluggy 1.0.0 develop
- pycodestyle 2.9.1 develop
- pydocstyle 6.1.1 develop
- pyflakes 2.5.0 develop
- pyparsing 3.0.9 develop
- pytest 7.2.0 develop
- pytest-cov 4.0.0 develop
- pytest-rerunfailures 10.3 develop
- requests 2.28.1 develop
- resolvelib 0.9.0 develop
- rich 12.6.0 develop
- setuptools 65.6.3 develop
- smmap 5.0.0 develop
- snowballstemmer 2.2.0 develop
- sortedcontainers 2.4.0 develop
- stevedore 4.1.1 develop
- toml 0.10.2 develop
- tomli 2.0.1 develop
- types-awscrt 0.15.3 develop
- types-s3transfer 0.6.0.post5 develop
- types-setuptools 65.6.0.1 develop
- webencodings 0.5.1 develop
- boto3 1.26.19
- botocore 1.29.19
- jmespath 1.0.1
- mypy-boto3-omics 1.26.19
- python-dateutil 2.8.2
- s3transfer 0.6.0
- six 1.16.0
- typing-extensions 4.4.0
- urllib3 1.26.13
- boto3 ^1.26.19
- mypy-boto3-omics ^1.26.19
- python ^3.10
- s3transfer ^0.6.0
- actions/checkout v3 composite
- actions/setup-python v4 composite