ãã®èšäºã¯ èªåã§Nextflowã¹ã¯ãªãããæžããã人ã®èšäºã§ããäŸãã°RNA-Seqãããããå Žåãèªåã§ã¹ã¯ãªãããæžããããnf-core/rnaseq ã®äœ¿ãæ¹ã調ã¹ãŸãããã
Nextflowãšã¯
- ã¯ãŒã¯ãããŒèšèªã®äžã€ãAWS, GCP, Azureãªã©ã®èšç®è³æºãã·ã§ã«ã¹ã¯ãªããã®ããã«äœ¿ãã
- ãã®äžèº«ã¯Groovyã®DSLãGroovyã¯ãJavaãã©ãããã©ãŒã äžã§åãèšèªãRubyã®åœ±é¿ã匷ãã
- Groovyã¯ãGithubãã¬ã³ãã§ã¯ãGradleãšNextflowã«äœ¿ãããŠãããGradleã¯ãã«ãèªååããŒã«ã§ãNextflowãšäŒŒãŠãããGroovyèšèªã¯ããããã®ãåŸæã¿ããã
- ã¹ãã€ã³ã®Paolo Di Tommasoãããããã«ã»ããã®Seqera Labs瀟ãäžå¿ã«éçºã
- EUåã®äººãå€ãå©çšããŠããå°è±¡ã§ãšãŒãããè²ã匷ãïŒâ ã¢ã¡ãªã«ïŒã
ãªãéã§ããããšã¯å€§åãªã®ã
å®ç§ã«ããããšãããšããªããªãäžéããªããNextflowã¯äž»ã«ã¯ã©ãŠãã§äœ¿ãããããããªããªãéã«ããããšãé£ãããããã§æå³çã«ãéãã«æ¯ã£ãŠãè©Šè¡åæ°ãå¢ããæ¹æ³ããããã
ã³ãã¥ããã£
- Slack - 掻çºã ããäž»ã«nf-coreã®äººãã¡ãå€ãã®ã§ãNextflowãAWSçšã®ã·ã§ã«ã¹ã¯ãªãããšããŠäœ¿ããã人ãã¡ã«ã¯ããŸãåèã«ãªããªãå°è±¡ãããã
Nextflow Tower
䟿å©ãªãŠã§ãã¢ããªããããããããNextflowã䜿ã£ãŠãããGUIã§AWSã«åŠçãæããããã
ãã«ãã«ãAWSãGCPãªã©ã®èšå®ã®æ¹æ³ãæžãããŠããŸãã説ææžã¯è±èªã§ãããGoogle翻蚳ã䜿ãã°ãªããšãç解ã§ãããå人çã«ã¯ /fusion/s3/
ããæå¹ã«ããŠããã
GithubãGitlabãžãªããžããªãäœæ
Nextflow Tower ã¯GithubãGitlabã®ãã©ã€ããŒããªããžããªãããœãŒã¹ã³ãŒããå®è¡ã§ãããã¢ã¯ã»ã¹ããŒã¯ã³ãå¿ èŠã
æ°ããprocessãè¿œå ããããªã£ãããã©ã³ããåã£ãŠãAWSã§å®è¡ããããããã ã£ãã main ãã©ã³ãã«è¿œå ãããšãããããªäœ¿ãæ¹ããããšããŒã«ã«PCã«è¿ãæèŠã§AWSã䜿ãããšãã§ããããã ããã¹ã¯ãªãããå€æŽããŠããTowerããLaunchããŠããå®éã«AWSã§å®è¡ãããŸã§ã«ã10åã20åãããã®åŸ ã¡æéããããã®ã§ãçæéã«éçºã®ãµã€ã¯ã«ãåãããšã¯ã§ããªãã
Webãšãã£ã¿ã®å©çš
Nextflowã®ã¹ã¯ãªããã¯AWSãªã©ã¯ã©ãŠãäžã§å®è¡ããã®ã§ãããŒã«ã«ç°å¢ã®ãšãã£ã¿ã§ç·šéãããããWebãšãã£ã¿ãå©çšããæ¹ã楜ãªæ°ããããã©ã£ã¡ã§ãããã
Dockerã€ã¡ãŒãžã®äœæ
Nextflowãå®è¡ããã«ã¯ä»®æ³ç°å¢ãå¿ èŠã§ãDockerãSinglarityãPodmanãªã©ããµããŒããããŠãããç¹ã«ãã ããã¯ãªãã®ã§Dockerã䜿ãããã€ãªã€ã³ãã©ã®ããŒã«ã®ã€ã³ã¹ããŒã«ã¯minicondaã䜿ããDockerçéã§ã¯ãã¬ã€ã€ãŒã¯èããã°èãæ¹ããããšèšãããŠããããå人ãNextflowã䜿ãã±ãŒã¹ã§ã¯ãäœåãå®è¡ãããã®ã§ã¯ãªãã®ã§ãæ°ã«ããå¿ èŠã¯ãªããšæãããã
Dockerfileã®äœæã«ã¯ããããã©ãããããã€ãããã
# Miniconda3
FROM continuumio/miniconda3
LABEL maintainer="someone@mail.com"
RUN apt update -y --allow-releaseinfo-change && \ # (1)
apt upgrade -y && \
apt install -y procps && \ # (2)
conda config --add channels bioconda && \
conda update -n base conda && \
conda install samtools=1.12 && \ # (3)
conda install bwa-mem2
CMD ["/bin/bash"]
-
--allow-releaseinfo-change
ãããå¿ èŠã -
procps
ãããå¿ é ã§ãããªããšps
ã³ãã³ãã䜿ããªããšããŠãNextflowãç°åžžçµäºããã - Dockerfile ã«éããªãããšã§ãããBiocondaã¯ããŒãžã§ã³ãæå®ããªããšããŒã«ãæ£ããã€ã³ã¹ããŒã«ããŠãããªãå ŽåããããããèŠæ³šæã
Docker Hub ã«ã€ã¡ãŒãžãã¢ããããŒããã
æéããããã®ã§ãGithub ActionsãGitlab CI/CDãªã©ãå©çšããŠèªåã§ã€ã¡ãŒãžããã«ãããŠDockerhubã«ã¢ããããŒããããããã«ãããšè¯ããšæãã
ã¡ãªã¿ã«ãDockerã€ã¡ãŒãžã§ã¯ãªããDockerfileãæå®ã§ããããã«ãããšããææ¡ã¯ãªãžã§ã¯ããããŠããããä»åŸãå®çŸããå¯èœæ§ã¯é«ããªããšæãããŸãã
AWS S3 (ãªã³ã©ã€ã³ã¹ãã¬ãŒãž)ã«ããŒã¿ãã¢ããããŒããã
ããŒã¿ã®IOã¯ããã«ããã¯ã«ãªãããããããŠã³ããŒããã¢ããããŒãã«ã¯æéãããããŸããå人çã«ã¯NASã®ã¯ã©ãŠãã·ã³ã¯æ©èœã䜿çšããŠããŸãããã¡ã€ã«ã®ãªã¹ããCSV圢åŒã§äœæããŠã¢ããããŒãããŠãããŸãã
æå°éã®Nextflowã¹ã¯ãªãã
ãããªæãã®ã¹ã¯ãªããããéå§ããŸãã(ç䌌ã³ãŒãçã«é©åœã«æžããŠãããå®éã«åãããŠããªãã®ã§åäœããªãå¯èœæ§ããããŸãïŒ
ID, path1, path2 ã®CSVãã¡ã€ã«ããå§ããã®ããã€ã³ãã ãšæããŸãã
#!/usr/bin/env nextflow
nextflow.enable.dsl=2
params.input = ''
params.outdir = ''
params.ref = ''
Channel
.fromPath(params.input)
.splitCsv(header:true)
.map{ row-> tuple(row.id, file(row.f1), file(row.f2)) }
.view()
.set{ input_ch }
process BWA2 {
publishDir "$params.outdir/$id", mode: 'copy', overwrite: true
input:
tuple val(id), path(f1), path(f2)
output:
path 'ïŒid.sam'
script:
"""
bwa-mem2 mem $params.ref $f1 $f2 > $id.sam
"""
}
workflow {
BWA2(input_ch)
}
ããã ãã ãšãããã¡ã¢ãªäžè¶³ã§ã³ã±ããããŸãããããããã»ã¹ã§ã¯å¥ã®ã³ã³ããã䜿ããããšããå ŽåããããããšæããŸãã®ã§ã
cpus 8
memory "32 GB"
container 'kojix2/hogefuga:latest'
ãããã»ã¹ããšã«èšå®ããŠãããŸããå
šäœã®èšå®ã¯ãnextflow.config
ãšãããã¡ã€ã«ãçšæããŠã
process {
container = "kojix2/lo9leev2ho"
cpus = 2
memory = '8 GB'
}
ãšããããšãã§ããŸãããšããã§ããã® nextflow.config
ãäœã®ãã¡ã€ã«åœ¢åŒãªã®ã調ã¹ãŸãããããããŸããã§ãããNextflowã¹ã¯ãªããã®DSLã£ãœãã§ãã
ãã©ã³ããåã£ãŠå®è¡ãã
ã³ãã³ãããå®è¡ããããšãã§ããã®ã§ãããããç§ã¯Towerçµç±ã§GUIã§å®è¡ããŠããŸãã
Rubyã®ã¹ã¯ãªãããæžããšãã¯ããŸããã©ã³ããåããªãã®ã§ãããNextflowã§ã¯Gitã®ãã©ã³ãæ©èœã¯æ¬åœã«äŸ¿å©ã ãªãšæããŸããããã©ã³ããåããªããããã»ã¹ãã©ãã©ãè¿œå ããŠããã©ã³ãå
ã§ã³ããããç¹°ãè¿ããŠä¿®æ£ãã倧äžå€«ããã ã£ããã¡ã€ã³ã«ããŒãžãããšããããšãç¹°ãè¿ããŸãããããŠå®éã«ã©ã®ããã»ã¹ãå®è¡ããã㯠workflow
ã®äžã§èª¿ç¯ããŸãã
ãã ãããã©ã³ããåã£ãŠã«ãªã¹ã«ãªããªãããã«ãã¡ãããšãã©ã³ãã«ã¯æå³ã®ããååãã€ããŸãããâŠã
Nextflow REPL Console
Nextflowã®æžãæ¹ãããããããªãå Žåã¯ããªãã¡ã¬ã³ã¹ãèŠãã ãã§ãªãREPLã§å®è¡ããããªããŸãã
Nextflowã®å
èšèªã®Groovyã«ã¯ Groovy Console ãšããã®ããããŸãããããNextflowã§äœ¿ããããã«ãã Nextflow Console ãšãããã®ããããŸããããã¯åã« nextflow console
ãšæã¡èŸŒããšèµ·åããŸãã
Hello Worldãå®è¡ããŠããã«ãã€ã³ã®å€æ° nextflow
ãåŒã³åºãããšããã
詳ããã¯å ¬åŒããã°èšäºãã芧ãã ããã
å®è¡ã«å€±æããã - ãã©ãã«ã·ã¥ãŒãã£ã³ã°
ãããšãããããšããã§å€±æããŸããNextflowãäžåå®è¡ãããšãããŸã§ãã©ãã€ããŸããã
DockerãS3ã®ãã©ãã«
ãã£ãŠã¿ãŠæããã®ã¯ãNextflowãšã¯é¢ä¿ãªãéšåã§ã®å€±æãããªãå€ãããšã§ããå ·äœçã«ã¯ã
- Dockerã®ã€ã¡ãŒãžã®äœæãã¹
- Docker Hubãžã®ã¢ããããŒããå¿ã
- S3 ã®ã¢ãã¬ã¹ã®æå®ãã¹
- S3 ã«ããŒã¿ãååšããªã
ã¡ã¢ãªäžè¶³
ã¡ã¢ãªãŒäžè¶³ã¯é »ç¹ã«çºçããŸããJavaã®ã¡ã¢ãªå²åœãäžè¶³ããŠã¹ãããããããšããããããŸãã140çªãšã150çªå°ã®ããããããªããšã©ãŒãçºçããŠããŠããå Žåã¯ãçã£å ã«ã¡ã¢ãªäžè¶³ãçãã¹ãã§ãã
ã¡ã¢ãªäžè¶³ã¯ãã»ãšãã©ã®ãã¡ã€ã«ã§çºçãããããäžéšã®äŸå€çã«å€§ããªãµã€ãºã®ãã¡ã€ã«ãåŠçããæã ãçºçããããšããããŸãããããªæã®ããã«ãèªåçã«ã¡ã¢ãªã®ãµã€ãºãïŒåã«ãªãã©ã€ããŠãããæžãæ¹ãååšããŸãã
process foo {
memory { 2.GB * task.attempt }
time { 1.hour * task.attempt }
errorStrategy 'retry'
script:
<your job here>
}
ããã©ã«ãã§ã¯ãªãã©ã€åæ°ã¯ïŒåã§ãããªã®ã§ãç¡éã«ã¡ã¢ãªãå¢ããç¶ããããšã¯ãããŸããããããã次ã®èšè¿°ãå ããŠãªãã©ã€åæ°ãå¢ããããšãã§ããŸãã
maxRetries 3
Nextflow Towerã®è¯ããªããšããã¯ããã°ã«å€§éæãªæ
å ±ãã衚瀺ãããªãããšã§ãã
å®è¡æã®æšæºåºåã®ãã°ãªã©ã¯ãèªåã§AWS CLIãªã©ã䜿ã£ãŠããŠã³ããŒãããŠèŠ³å¯ããªããã°ãªããªãå ŽåããããŸãããšã©ãŒã¡ãã»ãŒãžã®æåŸã«ãæšæºåºåãžã®ãªã³ã¯ã衚瀺ãããŸãã®ã§ããããããŠã³ããŒãããŠèŠ³å¯ããŸããããããããšã§åå ããããå ŽåããããŸãã
ãšã©ãŒã®åå ãã©ãããŠãããããªãå Žåã¯ãæçµçã«ã¯AWSã«ãã°ã€ã³ããŠèª¿æ»ãããããªãã§ããããã®ãããã¯ãŸã äœãããããªãã®ã§è©Šè¡é¯èª€ã§ãã
ã«ã¬ã³ããã£ã¬ã¯ããªã§ã¯ãªãå Žæã®ãã¡ã€ã«ãæäœããã³ãã³ãã«ã¯èŠæ³šæ
äŸãã°ãgzip 解åã®ããã«ãã¹å ã®ãã¡ã€ã«ãæäœããã³ãã³ãã¯ãã©ãã«ãèµ·ãããããã§ããNextflowã¯ã€ã³ãããã«æå®ããªããã¡ã€ã«ã¯ã³ããŒããªãã§çŽæ¥åŠçããããããã«ã¬ã³ããã£ã¬ã¯ããªã®æäœã ãã§çµçµãããšããããã©ããå ãã¹å ã®ãã¡ã€ã«ãæäœãããšãã©ãã«ã«ãªããã¡ãå ·äœçã«ã¯ã解åããå¿ èŠã®ãªãå§çž®ãã¡ã€ã«ã解åãããŠããŸã£ãããã€ã³ããã¯ã¹ãäœæãããšãã«ãå ãã¡ã€ã«ã«ã€ã³ããã¯ã¹ãäœæããããæ°ãä»ããªããã¡ã«ããŒã«ãäœæãããã¡ã€ã«ããæ®ã£ãŠããŸããªã©ã®ããšãèµ·ããã
å°ããå®è¡ãã
Nextflowã¯Towerããäžåå®è¡åœä»€ãåºããšãHello World ã®ãããªç°¡åãªãã®ã§ã15åãããããããïŒæéã«æ倧ã§ã3-4åããè©Šè¡ã§ããªãããšã«ãªããŸããæ®æ®µPCã®çŒã®åã®ã¿ãŒããã«ã§ç¡æ°ã®ãšã©ãŒãåºããªãããå¿ èŠããã°ä¿®æ£ãããã°ãããšããçºæ³ã§éçºãããŠãããšããã®ããšã¯å€§å€ã¹ãã¬ã¹ã«æããããŸããããŸãè¯ã察çæ¹æ³ã¯ãªããããªæ°ãããŸãããå®è¡ãµã³ãã«ã1åã2åã«æžãããŠããããããŸããããŸã§åãç¶ãããšããæãã«ãªãããšæããŸãã
çµæã®ãã¡ã€ã«ãã³ããŒããã¹ããã©ãã
ãããããããã£ãŠãªããã§ããã©ãããã©ã«ãã§ã¯ãªã³ã¯ãçæãããããã«ãªã£ãŠããããã§ããèªåã®å Žåã¯æåŸãŸã§å®è¡ãããWorkãã£ã¬ã¯ããªããµã¯ãµã¯æ¶ããŠããŸãã®ã§ãä¿åããå¿ èŠãããäžéãã¡ã€ã«ããæçµç£ç©ã¯å¿ ãã³ããŒããŠä¿åããããã«ããŠããŸãâŠã
nf-core ã®ã¹ã¯ãªãããåèã«ããªãïŒæ¹ããããšæãïŒ
ã³ãã¥ããã£ãšããŠã®nf-coreã¯ãããããããŒã«ãšããŠã®nf-coreã®ã¯ãŒã¯ãããŒçŸ€ã¯å¿«é©ã§äŸ¿å©ã ãªãšæã£ãŠããŸãããåã¯Rubyè²ã¡ãªã®ã§ããœãŒã¹ã³ãŒããšããŠã®nf-coreã«ã¯éåæãæã£ãŠããŸããnf-coreã®ã¹ã¯ãªããã¯è€éã§ãã£ããããããŠãŠé£ããã
ããã«nf-coreã®å²åŠã¯ããªãªãžãã«ã®Nextflowã®å²åŠãšå°ãè·é¢ãããã®ã§ã¯ãªãããšæã£ãŠããŸãã
Nextflowã®ã¡ã€ã³ã®éçºè ã¯ãPaolo Di Tommaso ãããšããã¹ãã€ã³åšäœã®æ¹ã§ããNextflowèšèªã®ã³ãããå±¥æŽãèŠãŸããšãNextflowèšèªã¯ãPaolo Di Tommaso ãããã»ãšãã©ç¬åã§éçºãããŠããããšãããããŸãã
ã³ããããã°ãèŠãŠããšããã®ãããžã§ã¯ãã¯ã¡ãã£ãšå±ãããªãšæãããããããŸãããäžäººã®å€©æç人ç©ã«çããããŠãããããžã§ã¯ãã¯ãOSSã®äžçã«ã¯ãããããããŸããããããéçºäœå¶ãšããŠã¯äž»åžéçºè ãäœããã®çç±ã§æãããšããããžã§ã¯ããåæ»ããå±éºæ§ããããŸãã
ãããªNextflowã®äœè ã® Paolo Di Tommaso ãããèªåã§äœã£ãŠããã¯ãŒã¯ãããŒããããŸããããã°Nextflowäœè å ¬åŒã®ã¯ãŒã¯ãããŒãšãã£ãŠãããã§ãããã
åã¯ã³ã¬ã®ã¯ãŒã¯ãããŒã«ç®ãéããããšãããã®ã§ãããããïŒãnf-coreãã®ã¯ãŒã¯ãããŒãšã¯ãªãã ãéåé°å²æ°ãéããªïŒããšæããŸãããCalliNGS-NFã¯ãnf-coreãšéã£ãŠç°¡æœã§ãRubyã®ã¹ã¯ãªãããæžã人éããã¿ãŠããããã颚ã§ãã£ãŠã»ãããªããšããçŽåŸæãããããããªæ°ãããŸãããæ ¹æ ã®ãªãå人ã®ææ³ã§ãããå®éã«ç§ã¯CalliNGS-NFã«ããã€ããã«ãªã¯ãšã¹ããéã£ãŠããŒãžãããŠããŸãã®ã§ãææ³ãè¿°ã¹ããããã¯èš±ãããã§ãããã
ã³ã³ãã¥ãŒã¿ã®æè¡ã§ãããïŒãªãã§ãããããªã£ãŠãããã ããïŒãã£ãŠæãããšããã¯ãå€ãã®å Žåã¯æè¡çãªãºã¬ããããç®çæèã®ãºã¬ããçºçããŠããããšãå€ããnf-coreãããããå¿ èŠãšããŠãã人ã®ç«å Žã«ç«ã£ãŠèŠããšç®çã«åèŽããæ§æãšãªã£ãŠããã®ã ãšæããŸãããã ãããã®åçæ§ã¯Nextflowã®ãªãªãžãã«ãªåºçºç¹ãšãéããã®ã«ãªã£ãŠããæ°ãããŸãã
ããããæå³ã§ã¯ nf-core ã®ã»ã«ã³ãã·ã¹ãã çå矀ã¯å¿é ã§ãããããæ¬åœã«æç¶çã«ã¡ã³ããã³ã¹ã§ããã®ãã¯å°ã çåã«æã£ãŠããŸãã
ããããæžããŸããããå人ã解æã«AWSãå©çšããç®çã§äœ¿ãæšãŠã®Nextflowã®ã¹ã¯ãªãããèªåã§äœæããå Žåã¯ãnf-coreã¯åèã«ããªãã»ãããã®ã§ã¯ãªãããšããã®ãç§ã®æèŠã§ãã
ããŒã±ãã£ã³ã°ããã¯è·é¢ã眮ã
ããäžã€ãã¯ãŒã¯ãããŒèšèªçéå šäœã§ç§ãå¥åŠã ãšæããŠãããšããããããŸããããã¯ç¡çãããã€ã±ãŠãæããåºãããšããåŸåããããšããã§ããJVMèšèªãGroovyãDSLã£ãŠãè¯ãæå³ã§æ¯ããçµã¿åããã ãšæãã®ã§ãããNextflowã®ããŒã±ãã£ã³ã°çã¯ã€ã±ãŠãæãåºãããã¿ããã§ããããã®åæ©ããªã«ããèãããšãç§ã¯ãã®æèŠã奜ãã«ãªããŸããã
Nextflowã«éãããã¯ãŒã¯ãããŒçéã¯ããããé°å²æ°ããããŸãã倧æã¯ã©ã©ãŠãæ¥è ã®è³éãèæ¯ã«çãäžãããèŠããŠããŸãããå¿ èŠä»¥äžã®å®£äŒãæ¥ãã§ããåŸåãæããŸãããThe Biostar Handbookãããªãã§ããããããã£ããã®ããã¯å°ã身ãåŒããŠæ§ããã®ãäžè¬çãªæ 床ã ãšæããŸãã
Nextflowã¯ãTowerã®UIã®äœã蟌ã¿ãšããã¯ã©ãŠãç°å¢ãšã®èŠªåæ§ã®é«ããšããæ°éäŒæ¥ãéçºããŠããããšã®ã¡ãªãããçºæ®ãããŠããŸãããäžæ¹ã§ãç§åŠçãªæ¢ç©¶å¿ããæ代ãè¶ ããæ®éçãªäŸ¡å€ã®è¿œæ±ã«ãããŠãããé Œããªãé¢ããããããããŸããã
ãŸãšã
Nextflowã¯èšç®è³æºããªãç°å¢ã«ãããŠããã¯ã©ãŠãäºæ¥è ã«èª²éããããã°ãå人ã§ãã£ãŠã最沢ãªèšç®è³æºã䜿ããã¯ãŒã¯ãããŒèšèªã§ããããã®ç®çãéæããããã«ã¯å€§å€äŸ¿å©ãªããŒã«ã§ãã
ãã®èšäºã¯ä»¥äžã§ãã