Nextflow 사용하기

Nextflow



작동한 장소


  • Mac
  • Linux
  • Windows WSL 1에서도 작동

  • Nextflow syntax highlighter



    아톰


  • language-nextflow

  • VSCode


  • Nextflow - Visual Studio Marketplace



  • 기타



    nextflow는 groovy의 파생 때문에
    nextflow 구문 하이라이터가없는 환경에서는,
    groovy 하이라이터를 사용하는 손도 있다.

    nextflow를 사용해 봅시다.



    설치 등


  • Nextflow - A DSL for parallel and scalable computational pipelines
  • Java 8 이상을 넣어 둔다
  • curl -s https://get.nextflow.io | bash
  • ./nextflow run hello

  • 다운로드할 때의 로그 등



    다운로드하면,
    의존하는 java 라이브러리를 다운로드하는 것 같은 로그가 나옵니다.
    궁극적으로 움직이는 환경이 있습니다.

    다양한 데이터는 ~/.nextflow에 들어가는 것 같습니다.

    설치가 끝나면 로그
    CAPSULE: Downloading dependency commons-codec:commons-codec:jar:1.10
    
    N E X T F L O W
    version 19.04.1 build 5072
    last modified 03-05-2019 12:29 UTC (21:29 JDT)
    cite doi:10.1038/nbt.3820
    http://nextflow.io
    
    
    Nextflow installation completed. Please note:
    - the executable file `nextflow` has been created in the folder: /Users/manabu/work/nextflow
    - you may complete the installation by moving it to a directory in your $PATH
    

    처음 명령 실행


    $ ./nextflow run hello
    N E X T F L O W  ~  version 19.04.1
    Pulling nextflow-io/hello ...
    downloaded from https://github.com/nextflow-io/hello.git
    Launching `nextflow-io/hello` [high_mayer] - revision: a9012339ce [master]
    [warm up] executor > local
    executor >  local (4)
    [27/9839a3] process > sayHello [100%] 4 of 4 ✔
    Ciao world!
    
    Bonjour world!
    
    Hola world!
    
    Hello world!
    
    Completed at: 28-Jun-2019 11:11:33
    Duration    : 1.1s
    CPU hours   : (a few seconds)
    Succeeded   : 4
    
    $  nextflow file nextflow
    nextflow: Bourne-Again shell script text executable, ASCII text
    
  • Nextflow - Basic pipeline

  • 샘플을 example1.nf로 저장
    $  nextflow ./nextflow example1.nf
    N E X T F L O W  ~  version 19.04.1
    Launching `example1` [suspicious_yalow] - revision: 3c1734c90b
    [warm up] executor > local
    executor >  local (1)
    [ab/9776d1] process > splitSequences [  0%] 0 of 1
    ERROR ~ Error executing process > 'splitSequences'
    
    executor >  local (1)
    [ab/9776d1] process > splitSequences [100%] 1 of 1, failed: 1 ✘
    ERROR ~ Error executing process > 'splitSequences'
    
    Caused by:
      Process `splitSequences` terminated with an error exit status (1)
    
    Command executed:
    
      awk '/^>/{f="seq_"++d} {print > f}' < input.fa
    
    Command exit status:
      1
    
    Command output:
      (empty)
    
    Command error:
      .command.sh: line 2: input.fa: No such file or directory
    
    Work dir:
      /Users/manabu/work/nextflow/work/ab/9776d1a5bb20bbd2415b237cfda7d7
    
    Tip: view the complete command output by changing to the process work dir and entering the command `cat .command.out`
    
     -- Check '.nextflow.log' file for details
    

    FASTA - Wikipedia
    >gi|5524211|gb|AAD44166.1| cytochrome b [Elephas maximus maximus]
    LCLYTHIGRNIYYGSYLYSETWNTGIMLLLITMATAFMGYVLPWGQMSFWGATVITNLFSAIPYIGTNLV
    EWIWGGFSVDKATLNRFFAFHFILPFTMVALAGVHLTFLHETGSNNPLGLTSDSDKIPFHPYYTIKDFLG
    LLILILLLLLLALLSPDMLGDPDNHMPADPLNTPLHIKPEWYFLFAYAILRSVPNKLGGVLALFLSIVIL
    GLMPFLHTSKHRSMMLRPLSQALFWTLTMDLLTLTWIGSQPVEYPYTIIGQMASILYFSIILAFLPIAGX
    IENY
    

    실패했을 때의 오류

    입력 파일을 기본값에 맞추기
    $ mv data/input.fa data/sample.fa
    

    실행합니다.
    - 분해(split)한 것은 파일에 출력되어
    - 반전시킨 것은 표준출력으로 출력된다
    $  ./nextflow example1.nf
    N E X T F L O W  ~  version 19.04.1
    Launching `example1` [nauseous_mirzakhani] - revision: 3c1734c90b
    [warm up] executor > local
    executor >  local (2)
    [43/3398fe] process > splitSequences [100%] 1 of 1 ✔
    [3b/5a7487] process > reverse        [  0%] 0 of 1
    ]sumixam sumixam sahpelE[ b emorhcotyc |1.66144DAA|bg|1124255|ig>
    VLNTGIYPIASFLNTIVTAGWFSMQGWPLVYGMFATAMTILLLMIGTNWTESYLYSGYYINRGIHTYLCL
    GLFDKITYYPHFPIKDSDSTLGLPNNSGTEHLFTLHVGALAVMTFPLIFHFAFFRNLTAKDVSFGGWIWE
    LIVISLFLALVGGLKNPVSRLIAYAFLFYWEPKIHLPTNLPDAPMHNDPDGLMDPSLLALLLLLLILILL
    executor >  local (2)
    [43/3398fe] process > splitSequences [100%] 1 of 1 ✔
    [3b/5a7487] process > reverse        [100%] 1 of 1 ✔
    Completed at: 28-Jun-2019 11:20:22
    Duration    : 1.1s
    CPU hours   : (a few seconds)
    Succeeded   : 2
    
    $ ./nextflow example1.nf
    N E X T F L O W  ~  version 19.04.1
    Launching `example1` [maniac_poisson] - revision: 3c1734c90b
    [warm up] executor > local
    executor >  local (2)
    [ac/3e7150] process > splitSequences [100%] 1 of 1 ✔
    [c4/de9f8e] process > reverse        [  0%] 0 of 1
    ]sumixam sumixam sahpelE[ b emorhcotyc |1.66144DAA|bg|1124255|ig>
    VLNTGIYPIASFLNTIVTAGWFSMQGWPLVYGMFATAMTILLLMIGTNWTESYLYSGYYINRGIHTYLCL
    GLFDKITYYPHFPIKDSDSTLGLPNNSGTEHLFTLHVGALAVMTFPLIFHFAFFRNLTAKDVSFGGWIWE
    LIVISLFLALVGGLKNPVSRLIAYAFLFYWEPKIHLPTNLPDAPMHNDPDGLMDPSLLALLLLLLILILL
    executor >  local (2)
    [ac/3e7150] process > splitSequences [100%] 1 of 1 ✔
    [c4/de9f8e] process > reverse        [100%] 1 of 1 ✔
    Completed at: 28-Jun-2019 11:21:10
    Duration    : 1.1s
    CPU hours   : (a few seconds)
    Succeeded   : 2
    

    FASTA format - Wikipedia
    따라서 다음 배열을 data/sample2.fa로 저장
    >MCHU - Calmodulin - Human, rabbit, bovine, rat, and chicken
    ADQLTEEQIAEFKEAFSLFDKDGDGTITTKELGTVMRSLGQNPTEAELQDMINEVDADGNGTID
    FPEFLTMMARKMKDTDSEEEIREAFRVFDKDGNGYISAAELRHVMTNLGEKLTDEEVDEMIREA
    DIDGDGQVNYEEFVQMMTAK*
    
    >gi|5524211|gb|AAD44166.1| cytochrome b [Elephas maximus maximus]
    LCLYTHIGRNIYYGSYLYSETWNTGIMLLLITMATAFMGYVLPWGQMSFWGATVITNLFSAIPYIGTNLV
    EWIWGGFSVDKATLNRFFAFHFILPFTMVALAGVHLTFLHETGSNNPLGLTSDSDKIPFHPYYTIKDFLG
    LLILILLLLLLALLSPDMLGDPDNHMPADPLNTPLHIKPEWYFLFAYAILRSVPNKLGGVLALFLSIVIL
    GLMPFLHTSKHRSMMLRPLSQALFWTLTMDLLTLTWIGSQPVEYPYTIIGQMASILYFSIILAFLPIAGX
    IENY
    

    입력 파일 변경하기
    $ ./nextflow example1.nf --in=data/sample2.fa
    

    work 아래에 데이터가 나와 있습니다.
    seq-1
    seq-2
    

    좋은 웹페이지 즐겨찾기