Skip to content

Commit 75ded6e

Browse files
Merge pull request #1590 from nf-core/add_sentieon_star
Add sentieon star
2 parents 00364d0 + f228324 commit 75ded6e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+8638
-139
lines changed

.github/actions/nf-test/action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,20 @@ runs:
5454
conda-solver: libmamba
5555
conda-remove-defaults: true
5656

57+
# Set up secrets
58+
- name: Set up Nextflow secrets
59+
if: env.SENTIEON_ENCRYPTION_KEY != '' && env.SENTIEON_LICENSE_MESSAGE != ''
60+
shell: bash
61+
run: |
62+
python -m pip install cryptography
63+
nextflow secrets set SENTIEON_AUTH_DATA $(python3 .github/actions/nf-test/license_message.py encrypt --key "$SENTIEON_ENCRYPTION_KEY" --message "$SENTIEON_LICENSE_MESSAGE")
64+
5765
- name: Run nf-test
5866
shell: bash
5967
env:
6068
NFT_WORKDIR: ${{ env.NFT_WORKDIR }}
69+
SENTIEON_LICSRVR_IP: ${{ env.SENTIEON_LICSRVR_IP }}
70+
SENTIEON_AUTH_MECH: "GitHub Actions - token"
6171
run: |
6272
nf-test test \
6373
--profile=+${{ inputs.profile }} \
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
#!/usr/bin/env python3
2+
3+
#########################################
4+
# Author: [DonFreed](https://github.com/DonFreed)
5+
# File: license_message.py
6+
# Source: https://github.com/DonFreed/docker-actions-test/blob/main/.github/scripts/license_message.py
7+
# Source+commit: https://github.com/DonFreed/docker-actions-test/blob/aa1051a9f53b3a1e801953748d062cad74dca9a9/.github/scripts/license_message.py
8+
# Download Date: 2023-07-04, commit: aa1051a
9+
# This source code is licensed under the BSD 2-Clause license
10+
#########################################
11+
12+
"""
13+
Functions for generating and sending license messages
14+
"""
15+
16+
# Modified from - https://stackoverflow.com/a/59835994
17+
18+
import argparse
19+
import base64
20+
import calendar
21+
import re
22+
import secrets
23+
import sys
24+
25+
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
26+
from datetime import datetime as dt
27+
28+
MESSAGE_TIMEOUT = 60 * 60 * 24 # Messages are valid for 1 day
29+
NONCE_BYTES = 12
30+
31+
32+
class DecryptionTimeout(Exception):
33+
# Decrypting a message that is too old
34+
pass
35+
36+
37+
def generate_key():
38+
key = secrets.token_bytes(32)
39+
return key
40+
41+
42+
def handle_generate_key(args):
43+
key = generate_key()
44+
key_b64 = base64.b64encode(key)
45+
print(key_b64.decode("utf-8"), file=args.outfile)
46+
47+
48+
def encrypt_message(key, message):
49+
nonce = secrets.token_bytes(NONCE_BYTES)
50+
timestamp = calendar.timegm(dt.now().utctimetuple())
51+
data = timestamp.to_bytes(10, byteorder="big") + b"__" + message
52+
ciphertext = nonce + AESGCM(key).encrypt(nonce, data, b"")
53+
return ciphertext
54+
55+
56+
def handle_encrypt_message(args):
57+
key = base64.b64decode(args.key.encode("utf-8"))
58+
message = args.message.encode("utf-8")
59+
ciphertext = encrypt_message(key, message)
60+
ciphertext_b64 = base64.b64encode(ciphertext)
61+
print(ciphertext_b64.decode("utf-8"), file=args.outfile)
62+
63+
64+
def decrypt_message(key, ciphertext, timeout=MESSAGE_TIMEOUT):
65+
nonce, ciphertext = ciphertext[:NONCE_BYTES], ciphertext[NONCE_BYTES:]
66+
message = AESGCM(key).decrypt(nonce, ciphertext, b"")
67+
68+
msg_timestamp, message = re.split(b"__", message, maxsplit=1)
69+
msg_timestamp = int.from_bytes(msg_timestamp, byteorder="big")
70+
timestamp = calendar.timegm(dt.now().utctimetuple())
71+
if (timestamp - msg_timestamp) > timeout:
72+
raise DecryptionTimeout("The message has an expired timeout")
73+
return message.decode("utf-8")
74+
75+
76+
def handle_decrypt_message(args):
77+
key = base64.b64decode(args.key.encode("utf-8"))
78+
ciphertext = base64.b64decode(args.message.encode("utf-8"))
79+
message = decrypt_message(key, ciphertext, timeout=args.timeout)
80+
print(str(message), file=args.outfile)
81+
82+
83+
def parse_args(argv=None):
84+
parser = argparse.ArgumentParser(description=__doc__)
85+
parser.add_argument("--outfile", default=sys.stdout, type=argparse.FileType("w"), help="The output file")
86+
87+
subparsers = parser.add_subparsers(help="Available sub-commands")
88+
89+
gen_parser = subparsers.add_parser("generate_key", help="Generate a random key string")
90+
gen_parser.set_defaults(func=handle_generate_key)
91+
92+
encrypt_parser = subparsers.add_parser("encrypt", help="Encrypt a message")
93+
encrypt_parser.add_argument("--key", required=True, help="The encryption key")
94+
encrypt_parser.add_argument("--message", required=True, help="Message to encrypt")
95+
encrypt_parser.set_defaults(func=handle_encrypt_message)
96+
97+
decrypt_parser = subparsers.add_parser("decrypt", help="Decyrpt a message")
98+
decrypt_parser.add_argument("--key", required=True, help="The encryption key")
99+
decrypt_parser.add_argument("--message", required=True, help="Message to decrypt")
100+
decrypt_parser.add_argument(
101+
"--timeout",
102+
default=MESSAGE_TIMEOUT,
103+
type=int,
104+
help="A message timeout. Decryption will fail for older messages",
105+
)
106+
decrypt_parser.set_defaults(func=handle_decrypt_message)
107+
108+
return parser.parse_args(argv)
109+
110+
111+
if __name__ == "__main__":
112+
args = parse_args()
113+
args.func(args)

.github/workflows/nf-test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ jobs:
9797
continue-on-error: ${{ matrix.NXF_VER == 'latest-everything' }}
9898
env:
9999
NFT_WORKDIR: ${{ env.NFT_WORKDIR }}
100+
SENTIEON_AUTH_MECH: "GitHub Actions - token"
101+
SENTIEON_ENCRYPTION_KEY: ${{ secrets.SENTIEON_ENCRYPTION_KEY }}
102+
SENTIEON_LICENSE_MESSAGE: ${{ secrets.SENTIEON_LICENSE_MESSAGE }}
103+
SENTIEON_LICSRVR_IP: ${{ secrets.SENTIEON_LICSRVR_IP }}
100104
with:
101105
profile: ${{ matrix.profile }}
102106
shard: ${{ matrix.shard }}

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Special thanks to the following for their contributions to the release:
1111

1212
- [Jonathan Manning](https://github.com/pinin4fjords)
1313
- [Maxime Garcia](https://github.com/maxulysse)
14+
- [Friederike Hanssen](https://github.com/friederikehanssen)
1415
- [Ido Tamir](https://github.com/idot)
1516
- [Usman Rashid](https://github.com/GallVp)
1617

@@ -21,12 +22,14 @@ Special thanks to the following for their contributions to the release:
2122
- [PR #1573](https://github.com/nf-core/rnaseq/pull/1573) - Fix salmon.merged.SummarizedExperiment.rds name collision
2223
- [PR #1585](https://github.com/nf-core/rnaseq/pull/1585) - Update awsfulltest.yml to restore aligner-wise outputs
2324
- [PR #1580](https://github.com/nf-core/rnaseq/pull/1580) - Template update for nf-core/tools v3.3.2
25+
- [PR #1590](https://github.com/nf-core/rnaseq/pull/1590) - Addition of Sentieon STAR
2426

2527
### Software dependencies
2628

2729
| Dependency | Old version | New version |
2830
| ---------- | ----------- | ----------- |
2931
| `MultiQC` | 1.29 | 1.30 |
32+
| `Sentieon` | | 202503.01 |
3033

3134
## [[3.19.0](https://github.com/nf-core/rnaseq/releases/tag/3.19.0)] - 2025-06-10
3235

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
5. Adapter and quality trimming ([`Trim Galore!`](https://www.bioinformatics.babraham.ac.uk/projects/trim_galore/))
3434
6. Removal of genome contaminants ([`BBSplit`](http://seqanswers.com/forums/showthread.php?t=41288))
3535
7. Removal of ribosomal RNA ([`SortMeRNA`](https://github.com/biocore/sortmerna))
36-
8. Choice of multiple alignment and quantification routes:
36+
8. Choice of multiple alignment and quantification routes (_For `STAR` the sentieon implementation can be chosen_):
3737
1. [`STAR`](https://github.com/alexdobin/STAR) -> [`Salmon`](https://combine-lab.github.io/salmon/)
3838
2. [`STAR`](https://github.com/alexdobin/STAR) -> [`RSEM`](https://github.com/deweylab/RSEM)
3939
3. [`HiSAT2`](https://ccb.jhu.edu/software/hisat2/index.shtml) -> **NO QUANTIFICATION**

conf/test.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ params {
4545

4646
// When using RSEM, remove warning from STAR whilst building tiny indices
4747
process {
48-
withName: 'RSEM_PREPAREREFERENCE_GENOME' {
48+
withName: 'RSEM_PREPAREREFERENCE_GENOME|SENTIEON_RSEMPREPAREREFERENCE_GENOME' {
4949
ext.args2 = "--genomeSAindexNbases 7"
5050
}
5151
}

docs/usage.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,34 @@ You can use `--skip_alignment --skip_pseudo_alignment` if you only want to run t
139139

140140
Note that `--skip_alignment` and `--skip_pseudo_alignment` prevent both the execution of alignment/pseudoalignment steps and the building of their corresponding indices. For example, using `--skip_alignment` with `--aligner star_salmon` will skip both STAR alignment and index building.
141141

142+
### Sentieon acceleration for STAR
143+
144+
The STAR aligner can be accelerated through its Sentieon implemention using the parameter `--use_sentieon_star`.
145+
146+
Sentieon is a commercial solution to process genomics data, requiring a paid license. Sentieon's tooling contains an accelerated version of the [`STAR` aligner](https://support.sentieon.com/manual/usages/general/?highlight=star#star-binary), which nf-core/rnaseq supports. In order to use those functions, the user will need to supply a license for Sentieon.
147+
148+
Sentieon supply license in the form of a string-value (a url) or a file. It should be base64-encoded and stored in a nextflow secret named `SENTIEON_LICENSE_BASE64`. If a license string (url) is supplied, then the nextflow secret should be set like this:
149+
150+
```bash
151+
nextflow secrets set SENTIEON_LICENSE_BASE64 $(echo -n <sentieon_license_string> | base64 -w 0)
152+
```
153+
154+
:::note
155+
<sentieon_license_string> is formatted as `IP:Port` for example: `12.12.12.12:8990`
156+
:::
157+
158+
If a license file is supplied, then the nextflow secret should be set like this:
159+
160+
```bash
161+
nextflow secrets set SENTIEON_LICENSE_BASE64 \$(cat <sentieon_license_file.lic> | base64 -w 0)
162+
```
163+
164+
:::note
165+
If you're looking for documentation on how the nf-core Sentieon GitHub Actions and Sentieon License Server are set up: [Here be dragons.](https://github.com/nf-core/ops/blob/main/pulumi/sentieon_license_server/README.md)
166+
167+
For detailed instructions on how to test the modules and subworkflows separately, see [here](https://github.com/nf-core/modules/blob/master/modules/nf-core/sentieon/README.md).
168+
:::
169+
142170
## Quantification options
143171

144172
The current options align with STAR and quantify using either Salmon (`--aligner star_salmon`) / RSEM (`--aligner star_rsem`). You also have the option to pseudoalign and quantify your data with Salmon or Kallisto by providing the `--pseudo_aligner salmon` or `--pseudo_aligner kallisto` parameter, respectively.

main.nf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ workflow NFCORE_RNASEQ {
8484
params.skip_bbsplit,
8585
!params.remove_ribo_rna,
8686
params.skip_alignment,
87-
params.skip_pseudo_alignment
87+
params.skip_pseudo_alignment,
88+
params.use_sentieon_star
8889
)
8990
ch_versions = ch_versions.mix(PREPARE_GENOME.out.versions)
9091

modules.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,21 @@
217217
"git_sha": "05954dab2ff481bcb999f24455da29a5828af08d",
218218
"installed_by": ["bam_stats_samtools"]
219219
},
220+
"sentieon/rsemcalculateexpression": {
221+
"branch": "master",
222+
"git_sha": "2779d18605e9923332155d671f45ed37fa185ff4",
223+
"installed_by": ["modules"]
224+
},
225+
"sentieon/rsempreparereference": {
226+
"branch": "master",
227+
"git_sha": "2779d18605e9923332155d671f45ed37fa185ff4",
228+
"installed_by": ["modules"]
229+
},
230+
"sentieon/staralign": {
231+
"branch": "master",
232+
"git_sha": "73d3ab1ac411843ae643b5bc310a4aec9ae7ab3a",
233+
"installed_by": ["modules"]
234+
},
220235
"sortmerna": {
221236
"branch": "master",
222237
"git_sha": "d4a425ce59fc803a11e520f16680ede9af09761f",

modules/nf-core/sentieon/rsemcalculateexpression/environment.yml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)