B-cell and T-cell Adaptive Immune Receptor Repertoire (AIRR) sequencing analysis pipeline using the Immcantation framework

public public 1yr ago Version: 3.1.0 0 bookmarks

Introduction

** nf-core/airrflow ** is a bioinformatics best-practice pipeline to analyze B-cell or T-cell repertoire sequencing data. It makes use of the Immcantation toolset. The input data can be targeted amplicon bulk sequencing data of the V, D, J and C regions of the B/T-cell receptor with multiplex PCR or 5' RACE protocol, or assembled reads (bulk or single cell).

nf-core/airrflow overview

The pipeline is built using Nextflow , a workflow tool to run tasks across multiple compute infrastructures in a very portable manner. It uses Docker/Singularity containers making installation trivial and results highly reproducible. The Nextflow DSL2 implementation of this pipeline uses one container per process which makes it much easier to maintain and update software dependencies. Where possible, these processes have been submitted to and installed from nf-core/modules in order to make them available to all nf-core pipelines, and to everyone within the Nextflow community!

On release, automated continuous integration tests run the pipeline on a full-sized dataset on the AWS cloud infrastructure. This ensures that the pipeline runs on AWS, has sensible resource allocation defaults set to run on real-world datasets, and permits the persistent storage of results to benchmark between pipeline releases and other analysis sources. The results obtained from the full-sized test can be viewed on the nf-core website .

Pipeline summary

nf-core/airrflow allows the end-to-end processing of BCR and TCR bulk and single cell targeted sequencing data. Several protocols are supported, please see the usage documenation for more details on the supported protocols.

nf-core/airrflow overview

  1. QC and sequence assembly (bulk only)
  • Raw read quality control, adapter trimming and clipping ( Fastp ).

  • Filter sequences by base quality ( pRESTO FilterSeq ).

  • Mask amplicon primers ( pRESTO MaskPrimers ).

  • Pair read mates ( pRESTO PairSeq ).

  • For UMI-based sequencing:

    • Cluster sequences according to similarity (optional for insufficient UMI diversity) ( pRESTO ClusterSets ).

    • Build consensus of sequences with the same UMI barcode ( pRESTO BuildConsensus ).

  • Assemble R1 and R2 read mates ( pRESTO AssemblePairs ).

  • Remove and annotate read duplicates ( pRESTO CollapseSeq ).

  • Filter out sequences that do not have at least 2 duplicates ( pRESTO SplitSeq ).

  1. V(D)J annotation and filtering (bulk and single-cell)
  • Assign gene segments with IgBlast using the IMGT database ( Change-O AssignGenes ).

  • Annotate alignments in AIRR format ( Change-O MakeDB )

  • Filter by alignment quality (locus matching v_call chain, min 200 informative positions, max 10% N nucleotides)

  • Filter productive sequences ( Change-O ParseDB split )

  • Filter junction length multiple of 3

  • Annotate metadata ( EnchantR )

  1. QC filtering (bulk and single-cell)
  • Bulk sequencing filtering:

    • Remove chimeric sequences (optional) ( SHazaM , EnchantR )

    • Detect cross-contamination (optional) ( EnchantR )

    • Collapse duplicates ( Alakazam , EnchantR )

  • Single-cell QC filtering ( EnchantR )

    • Remove cells without heavy chains.

    • Remove cells with multiple heavy chains.

    • Remove sequences in different samples that share the same cell_id and nucleotide sequence.

    • Modify cell_id s to ensure they are unique in the project.

  1. Clonal analysis (bulk and single-cell)
  • Find threshold for clone definition ( SHazaM , EnchantR ).

  • Create germlines and define clones, repertoire analysis ( Change-O , EnchantR ).

  • Build lineage trees ( SCOPer , IgphyML , EnchantR ).

  1. Repertoire analysis and reporting
  • Custom repertoire analysis pipeline report ( Alakazam ).

  • Aggregate QC reports ( MultiQC ).

Usage

Note If you are new to Nextflow and nf-core, please refer to this page on how to set-up Nextflow. Make sure to test your setup with -profile test before running the workflow on actual data.

First, ensure that the pipeline tests run on your infrastructure:

nextflow run nf-core/airrflow -profile test,<docker/singularity/podman/shifter/charliecloud/conda/institute> --outdir <OUTDIR>

To run on your data, prepare a tab-separated samplesheet with your input data. Depending on the input data type (bulk or single-cell, raw reads or assembled reads) the input samplesheet will vary. Please follow the documentation on samplesheets for more details. An example samplesheet for running the pipeline on raw BCR / TCR sequencing data looks as follows:

sample_id filename_R1 filename_R2 filename_I1 subject_id species pcr_target_locus tissue sex age biomaterial_provider single_cell intervention collection_time_point_relative cell_subset
sample01 sample1_S8_L001_R1_001.fastq.gz sample1_S8_L001_R2_001.fastq.gz sample1_S8_L001_I1_001.fastq.gz Subject02 human IG blood NA 53 sequencing_facility FALSE Drug_treatment Baseline plasmablasts
sample02 sample2_S8_L001_R1_001.fastq.gz sample2_S8_L001_R2_001.fastq.gz sample2_S8_L001_I1_001.fastq.gz Subject02 human TR blood female 78 sequencing_facility FALSE Drug_treatment Baseline plasmablasts

Each row represents a sample with fastq files (paired-end).

A typical command to run the pipeline is:

nextflow run nf-core/airrflow \
-profile <docker/singularity/podman/shifter/charliecloud/conda/institute> \
--input samplesheet.tsv \
--library_generation_method specific_pcr_umi \
--cprimers CPrimers.fasta \
--vprimers VPrimers.fasta \
--umi_length 12 \
--max_memory 8.GB \
--max_cpus 8 \
--outdir ./results

Warning: Please provide pipeline parameters via the CLI or Nextflow -params-file option. Custom config files including those provided by the -c Nextflow option can be used to provide any configuration except for parameters ; see docs .

For more details, please refer to the usage documentation and the parameter documentation .

Pipeline output

To see the the results of a test run with a full size dataset refer to the results tab on the nf-core website pipeline page. For more details about the output files and reports, please refer to the output documentation .

Credits

nf-core/airrflow was written by Gisela Gabernet , Susanna Marquez , Alexander Peltzer and Simon Heumos .

Further contributors to the pipeline are:

Contributions and Support

If you would like to contribute to this pipeline, please see the contributing guidelines .

For further information or help, don't hesitate to get in touch on the Slack #airrflow channel (you can join with this invite ).

Citations

If you use nf-core/airrflow for your analysis, please cite it using the following DOI: 10.5281/zenodo.2642009

An extensive list of references for the tools used by the pipeline can be found in the CITATIONS.md file.

You can cite the nf-core publication as follows:

The nf-core framework for community-curated bioinformatics pipelines.

Philip Ewels, Alexander Peltzer, Sven Fillinger, Harshil Patel, Johannes Alneberg, Andreas Wilm, Maxime Ulysse Garcia, Paolo Di Tommaso & Sven Nahnsen.

Nat Biotechnol. 2020 Feb 13. doi: 10.1038/s41587-020-0439-x .

Code Snippets

27
28
29
30
31
32
33
34
35
36
37
38
39
"""
execute_report.R --report_file ${repertoire_report}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    alakazam: \$(Rscript -e "library(alakazam); cat(paste(packageVersion('alakazam'), collapse='.'))")
    shazam: \$(Rscript -e "library(shazam); cat(paste(packageVersion('shazam'), collapse='.'))")
    stringr: \$(Rscript -e "library(stringr); cat(paste(packageVersion('stringr'), collapse='.'))")
    dplyr: \$(Rscript -e "library(dplyr); cat(paste(packageVersion('dplyr'), collapse='.'))")
    knitr: \$(Rscript -e "library(knitr); cat(paste(packageVersion('knitr'), collapse='.'))")
    R: \$(echo \$(R --version 2>&1) | awk -F' '  '{print \$3}')
END_VERSIONS
"""
23
24
25
26
27
28
29
30
31
"""
AssignGenes.py igblast -s $reads -b $igblast --organism $meta.species --loci ${meta.locus.toLowerCase()} $args --nproc $task.cpus --outname $meta.id > ${meta.id}_changeo_assigngenes_command_log.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    igblastn: \$( igblastn -version | grep -o "igblast[0-9\\. ]\\+" | grep -o "[0-9\\. ]\\+" )
    changeo: \$( AssignGenes.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
22
23
24
25
26
27
28
29
30
"""
ConvertDb.py fasta -d $tab $args > ${meta.id}_convertdb_command_log.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    igblastn: \$( igblastn -version | grep -o "igblast[0-9\\. ]\\+" | grep -o "[0-9\\. ]\\+" )
    changeo: \$( ConvertDb.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
23
24
25
26
27
28
29
30
31
32
33
34
35
"""
CreateGermlines.py -d ${tab} \\
-r ${imgt_base}/${meta.species}/vdj/ \\
-g dmask --format airr \\
--log ${meta.id}.log --outname ${meta.id} $args > ${meta.id}_create-germlines_command_log.txt
ParseLog.py -l ${meta.id}.log -f ID V_CALL D_CALL J_CALL

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    igblastn: \$( igblastn -version | grep -o "igblast[0-9\\. ]\\+" | grep -o "[0-9\\. ]\\+" )
    changeo: \$( CreateGermlines.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
24
25
26
27
28
29
30
31
32
33
34
35
"""
MakeDb.py igblast -i $igblast -s $reads -r \\
${imgt_base}/${meta.species.toLowerCase()}/vdj/ \\
$args \\
--outname ${meta.id} > ${meta.id}_makedb_command_log.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    igblastn: \$( igblastn -version | grep -o "igblast[0-9\\. ]\\+" | grep -o "[0-9\\. ]\\+" )
    changeo: \$( MakeDb.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
21
22
23
24
25
26
27
28
"""
ParseDb.py split -d $tab -f productive --outname ${meta.id} > ${meta.id}_split_command_log.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    changeo: \$( ParseDb.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""
echo "${tabs.join('\n')}" > tabs.txt
Rscript -e "enchantr::enchantr_report('collapse_duplicates', \\
    report_params=list('input'='tabs.txt',\\
    'collapseby'='${params.collapseby}',\\
    'outdir'=getwd(),\\
    'nproc'=${task.cpus},\\
    'outname'='${meta.id}',\\
    'log'='${meta.id}_collapse_command_log'))"

echo "${task.process}": > versions.yml
Rscript -e "cat(paste0('  enchantr: ',packageVersion('enchantr'),'\n'))" >> versions.yml

mv enchantr ${meta.id}_collapse_report
"""
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""
Rscript -e "enchantr::enchantr_report('define_clones', \\
                                    report_params=list('input'='${tabs.join(',')}', \\
                                    'imgt_db'='${imgt_base}', \\
                                    'cloneby'='${params.cloneby}', \\
                                    'force'=FALSE, \\
                                    'threshold'=${thr}, \\
                                    'singlecell'='${params.singlecell}','outdir'=getwd(), \\
                                    'nproc'=${task.cpus},\\
                                    'log'='${meta.id}_clone_command_log' ${args}))"

echo "${task.process}": > versions.yml
Rscript -e "cat(paste0('  enchantr: ',packageVersion('enchantr'),'\n'))" >> versions.yml

mv enchantr '${meta.id}_clone_report'
"""
23
24
25
26
27
28
29
30
31
32
33
34
"""
echo "${tabs.join('\n')}" > tabs.txt
Rscript -e "enchantr::enchantr_report('contamination', \\
    report_params=list('input'='tabs.txt',\\
    'input_id'='id','outdir'=getwd(), \\
    'outname'='cont-flag', \\
    'log'='all_reps_contamination_command_log'))"

echo "${task.process}": > versions.yml
Rscript -e "cat(paste0('  enchantr: ',packageVersion('enchantr'),'\n'))" >> versions.yml
mv enchantr all_reps_cont_report
"""
41
42
43
44
45
46
47
48
49
50
51
52
53
"""
Rscript -e "enchantr::enchantr_report('dowser_lineage', \\
                                    report_params=list('input'='${tabs}', \\
                                    'exec'='${params.igphyml}', \\
                                    'outdir'=getwd(), \\
                                    'nproc'=${task.cpus},\\
                                    'log'='${id_name}_dowser_command_log' ${args}))"

echo "${task.process}": > versions.yml
Rscript -e "cat(paste0('  enchantr: ',packageVersion('enchantr'),'\n'))" >> versions.yml

mv enchantr '${id_name}_dowser_report'
"""
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""
Rscript -e "enchantr::enchantr_report('find_threshold', \\
    report_params=list('input'='${tab.join(',')}',\\
        'cloneby'='${params.cloneby}',\\
        'crossby'='${params.crossby}',\\
        'singlecell'='${params.singlecell}',\\
        'outdir'=getwd(),\\
        'nproc'=${task.cpus},\\
        'outname'='all_reps',\\
        'log'='all_reps_threshold_command_log',\\
        'logo'='${logo}' ${args}))"

echo "${task.process}": > versions.yml
Rscript -e "cat(paste0('  enchantr: ',packageVersion('enchantr'),'\n'))" >> versions.yml
mv enchantr all_reps_dist_report
"""
25
26
27
28
29
30
31
32
33
34
35
36
37
"""
Rscript -e "enchantr:::enchantr_report('chimera_analysis', \\
    report_params=list('input'='${tab}',\\
    'outdir'=getwd(), \\
    'nproc'=${task.cpus},\\
    'outname'='${meta.id}', \\
    'log'='${meta.id}_chimeric_command_log'))"

echo "\"${task.process}\":" > versions.yml
Rscript -e "cat(paste0('  enchantr: ',packageVersion('enchantr'),'\n'))" >> versions.yml

mv enchantr ${meta.id}_chimera_report
"""
24
25
26
27
28
29
30
31
32
33
34
"""
echo "${logs.join('\n')}" > logs.txt
Rscript -e "enchantr::enchantr_report('file_size', \\
    report_params=list('input'='logs.txt', 'metadata'='${metadata}',\\
    'outdir'=getwd()))"

echo "\"${task.process}\":" > versions.yml
Rscript -e "cat(paste0('  enchantr: ',packageVersion('enchantr'),'\n'))" >> versions.yml

mv enchantr file_size_report
"""
39
40
41
42
43
44
45
46
47
48
49
50
"""
echo "${tabs.join('\n')}" > tabs.txt
Rscript -e "enchantr::enchantr_report('single_cell_qc', \\
    report_params=list('input'='tabs.txt',\\
    'outdir'=getwd(), \\
    'log'='all_reps_scqc_command_log'  ${args} ))"

echo "${task.process}": > versions.yml
Rscript -e "cat(paste0('  enchantr: ',packageVersion('enchantr'),'\n'))" >> versions.yml

mv enchantr all_reps_scqc_report
"""
26
27
28
29
30
31
"""
Rscript -e "enchantr:::enchantr_report('validate_input', report_params=list('input'='${samplesheet}','collapseby'='${collapseby}','cloneby'='${cloneby}','reassign'='${params.reassign}','miairr'='${miairr}','outdir'=getwd()))"

echo "\"${task.process}\":" > versions.yml
Rscript -e "cat(paste0('  enchantr: ',packageVersion('enchantr'),'\n'))" >> versions.yml
"""
22
23
24
25
26
27
28
29
30
"""
[ ! -f  ${prefix}.fastq ] && ln -s $reads ${prefix}_ASSEMBLED.fastq
fastqc $args --threads $task.cpus ${prefix}_ASSEMBLED.fastq

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    fastqc: \$( fastqc --version | sed -e "s/FastQC v//g" )
END_VERSIONS
"""
23
24
25
26
27
28
29
30
31
32
"""
fetch_databases.sh

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    IMGT download date: \$( echo \$(date "+%F") )
    igblastn: \$( igblastn -version | grep -o "igblast[0-9\\. ]\\+" | grep -o "[0-9\\. ]\\+" )
    changeo: \$( AssignGenes.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
18
19
20
21
22
23
24
25
26
"""
gunzip -f "${R1}"
gunzip -f "${R2}"

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    gunzip: \$(echo \$(gunzip --version 2>&1) | sed 's/^.*(gzip) //; s/ Copyright.*\$//')
END_VERSIONS
"""
NextFlow From line 18 of local/gunzip.nf
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
"""
igblastn \
    -germline_db_V igblast_base/database/imgt_${meta.species}_${meta.locus.toLowerCase()}_v \
    -germline_db_D igblast_base/database/imgt_${meta.species}_${meta.locus.toLowerCase()}_d \
    -germline_db_J igblast_base/database/imgt_${meta.species}_${meta.locus.toLowerCase()}_j \
    -auxiliary_data igblast_base/optional_file/${meta.species}_gl.aux \
    -organism ${meta.species} \
    $args \
    -query $reads \
    -out ${meta.id}_db-pass.tsv

echo "START> AssignGenes" > ${meta.id}_changeo_assigngenes_command_log.txt
echo "COMMAND> igblast" >> ${meta.id}_changeo_assigngenes_command_log.txt
echo "VERSION> \$( igblastn -version | grep -o "igblast[0-9\\. ]\\+" | grep -o "[0-9\\. ]\\+" )" >> ${meta.id}_changeo_assigngenes_command_log.txt
echo "FILE> ${reads}" >> ${meta.id}_changeo_assigngenes_command_log.txt
echo "ORGANISM> ${meta.species}" >> ${meta.id}_changeo_assigngenes_command_log.txt
echo "LOCI> ${meta.locus.toLowerCase()}" >> ${meta.id}_changeo_assigngenes_command_log.txt
echo "NPROC> ${task.cpus}\n" >> ${meta.id}_changeo_assigngenes_command_log.txt
echo "PROGRESS> ...Done \n" >> ${meta.id}_changeo_assigngenes_command_log.txt
echo "PASS> \$(tail -n +2 ${meta.id}_db-pass.tsv | wc -l )" >> ${meta.id}_changeo_assigngenes_command_log.txt
echo "OUTPUT> ${meta.id}_igblast.fmt7" >> ${meta.id}_changeo_assigngenes_command_log.txt
echo "END> AssignGenes" >> ${meta.id}_changeo_assigngenes_command_log.txt

echo "START> MakeDB" > ${meta.id}_makedb_command_log.txt
echo "COMMAND> igblast" >> ${meta.id}_makedb_command_log.txt
echo "ALIGNER_FILE> ${meta.id}_igblast.fmt7" >> ${meta.id}_makedb_command_log.txt
echo "SEQ_FILE> ${reads}" >> ${meta.id}_makedb_command_log.txt
echo "ASIS_ID> False" >> ${meta.id}_makedb_command_log.txt
echo "ASIS_CALLS> False" >> ${meta.id}_makedb_command_log.txt
echo "VALIDATE> strict" >> ${meta.id}_makedb_command_log.txt
echo "EXTENDED> True" >> ${meta.id}_makedb_command_log.txt
echo "INFER_JUNCTION> False\n" >> ${meta.id}_makedb_command_log.txt
echo "PROGRESS> ...\n" >> ${meta.id}_makedb_command_log.txt
echo "PROGRESS> ... Done\n" >> ${meta.id}_makedb_command_log.txt
echo "OUTPUT> ${meta.id}_db-pass.tsv" >> ${meta.id}_makedb_command_log.txt
echo "PASS> \$(tail -n +2 ${meta.id}_db-pass.tsv | wc -l )" >> ${meta.id}_makedb_command_log.txt
echo "FAIL> 0" >> ${meta.id}_makedb_command_log.txt
echo "END> MakeDB" >> ${meta.id}_makedb_command_log.txt

echo "\"${task.process}\":" > versions.yml
echo "   igblastn: \$( igblastn -version | grep -o "igblast[0-9\\. ]\\+" | grep -o "[0-9\\. ]\\+" )" >> versions.yml
"""
19
20
21
22
23
24
25
26
27
28
29
"""
merge_R1_umi.py -R1 "${R1}" -I1 "${I1}" -o UMI_R1.fastq.gz --umi_start $params.umi_start --umi_length $params.umi_length
mv "UMI_R1.fastq.gz" "${meta.id}_UMI_R1.fastq.gz"
mv "${R2}" "${meta.id}_R2.fastq.gz"

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    python: \$( echo \$(python --version | grep -o "[0-9\\. ]\\+") )
    biopython: \$(echo \$(python -c "import pkg_resources; print(pkg_resources.get_distribution('biopython').version)"))
END_VERSIONS
"""
31
32
33
34
35
36
37
38
39
"""
log_parsing_no-umi.py

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    python: \$( echo \$(python --version | grep -o "[0-9\\. ]\\+") )
    pandas: \$(echo \$(python -c "import pkg_resources; print(pkg_resources.get_distribution('pandas').version)"))
END_VERSIONS
"""
42
43
44
45
46
47
48
49
50
"""
log_parsing.py $clustersets

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    python: \$( echo \$(python --version | grep -o "[0-9\\. ]\\+") )
    pandas: \$(echo \$(python -c "import pkg_resources; print(pkg_resources.get_distribution('pandas').version)"))
END_VERSIONS
"""
24
25
26
27
28
29
30
31
32
33
34
"""
AssemblePairs.py align -1 $R1 -2 $R2 --nproc ${task.cpus} \\
    $args \\
    --outname ${meta.id} --log ${meta.id}.log > ${meta.id}_command_log.txt
ParseLog.py -l ${meta.id}.log $args2

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    presto: \$( AssemblePairs.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
24
25
26
27
28
29
30
31
32
33
"""
BuildConsensus.py -s $R1 --bf ${barcode_field} --nproc ${task.cpus} --pf PRIMER --prcons $params.primer_consensus --maxerror $params.buildconsensus_maxerror --maxgap $params.buildconsensus_maxgap --outname ${meta.id}_R1 --log ${meta.id}_R1.log > ${meta.id}_command_log.txt
BuildConsensus.py -s $R2 --bf ${barcode_field} --nproc ${task.cpus} --pf PRIMER --prcons $params.primer_consensus --maxerror $params.buildconsensus_maxerror --maxgap $params.buildconsensus_maxgap --outname ${meta.id}_R2 --log ${meta.id}_R2.log >> ${meta.id}_command_log.txt
ParseLog.py -l ${meta.id}_R1.log ${meta.id}_R2.log -f ID BARCODE SEQCOUNT PRIMER PRCOUNT PRCONS PRFREQ CONSCOUNT

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    presto: \$( BuildConsensus.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
22
23
24
25
26
27
28
29
30
31
32
"""
ClusterSets.py set --nproc ${task.cpus} -s $R1 --outname ${meta.id}_R1 --exec vsearch --log ${meta.id}_R1.log > ${meta.id}_command_log.txt
ClusterSets.py set --nproc ${task.cpus} -s $R2 --outname ${meta.id}_R2 --exec vsearch --log ${meta.id}_R2.log >> ${meta.id}_command_log.txt
ParseLog.py -l ${meta.id}_R1.log ${meta.id}_R2.log -f ID BARCODE SEQCOUNT CLUSTERS

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    presto: \$( ClusterSets.py --version | awk -F' '  '{print \$2}' )
    vsearch: \$( vsearch --version &> vsearch.txt; cat vsearch.txt | head -n 1 | grep -o 'v[0-9\\.]\\+' )
END_VERSIONS
"""
26
27
28
29
30
31
32
33
34
"""
CollapseSeq.py -s $reads $args --outname ${meta.id} --log ${meta.id}.log > ${meta.id}_command_log.txt
ParseLog.py -l ${meta.id}.log $args2

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    presto: \$( CollapseSeq.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
23
24
25
26
27
28
29
30
31
32
"""
FilterSeq.py quality -s $R1 -q ${params.filterseq_q} --outname ${meta.id}_R1 --log ${R1.baseName}_R1.log --nproc ${task.cpus} > ${meta.id}_command_log.txt
FilterSeq.py quality -s $R2 -q ${params.filterseq_q} --outname ${meta.id}_R2 --log ${R2.baseName}_R2.log --nproc ${task.cpus} >> ${meta.id}_command_log.txt
ParseLog.py -l ${R1.baseName}_R1.log ${R2.baseName}_R2.log -f ID QUALITY

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    presto: \$( FilterSeq.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
22
23
24
25
26
27
28
29
30
"""
FilterSeq.py quality -s $reads -q ${params.filterseq_q} --outname ${meta.id} --log ${reads.baseName}.log --nproc ${task.cpus} > ${meta.id}_command_log.txt
ParseLog.py -l ${reads.baseName}.log -f ID QUALITY

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    presto: \$( FilterSeq.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
30
31
32
33
34
35
36
37
38
39
"""
MaskPrimers.py score --nproc ${task.cpus} -s $R1 -p ${cprimers} $primer_start_R1 $revpr --maxerror ${params.primer_maxerror} --mode ${params.primer_mask_mode} --outname ${meta.id}_R1 --log ${meta.id}_R1.log > ${meta.id}_command_log.txt
MaskPrimers.py score --nproc ${task.cpus} -s $R2 -p ${vprimers} $primer_start_R2 $revpr --maxerror ${params.primer_maxerror} --mode ${params.primer_mask_mode} --outname ${meta.id}_R2 --log ${meta.id}_R2.log >> ${meta.id}_command_log.txt
ParseLog.py -l ${meta.id}_R1.log ${meta.id}_R2.log -f ID PRIMER ERROR

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    presto: \$( MaskPrimers.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
43
44
45
46
47
48
49
50
51
52
"""
MaskPrimers.py score --nproc ${task.cpus} -s $R1 -p ${vprimers} $primer_start_R1 $revpr --maxerror ${params.primer_maxerror} --mode ${params.primer_mask_mode} --outname ${meta.id}_R1 --log ${meta.id}_R1.log > ${meta.id}_command_log.txt
MaskPrimers.py score --nproc ${task.cpus} -s $R2 -p ${cprimers} $primer_start_R2 $revpr --maxerror ${params.primer_maxerror} --mode ${params.primer_mask_mode} --outname ${meta.id}_R2 --log ${meta.id}_R2.log >> ${meta.id}_command_log.txt
ParseLog.py -l "${meta.id}_R1.log" "${meta.id}_R2.log" -f ID PRIMER ERROR

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    presto: \$( MaskPrimers.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""
MaskPrimers.py score --nproc ${task.cpus} -s $reads -p ${cprimers} --start ${params.cprimer_start} --maxerror ${params.primer_maxerror} \
    --mode ${params.primer_mask_mode} --outname ${meta.id}-FWD \
    --log ${meta.id}-FWD.log > ${meta.id}_command_log.txt
MaskPrimers.py score --nproc ${task.cpus} -s ${meta.id}-FWD_primers-pass.fastq -p ${vprimers} --start ${params.vprimer_start} --maxerror ${params.primer_maxerror} \
    --mode ${params.primer_mask_mode} --outname ${meta.id}-REV $revpr \
    --log ${meta.id}-REV.log >> ${meta.id}_command_log.txt
ParseLog.py -l ${meta.id}-FWD.log ${meta.id}-REV.log -f ID PRIMER ERROR

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    presto: \$( MaskPrimers.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""
MaskPrimers.py score --nproc ${task.cpus} -s $reads -p ${vprimers} --start ${params.cprimer_start} --maxerror ${params.primer_maxerror} \
    --mode ${params.primer_mask_mode} --outname ${meta.id}-FWD \
    --log ${meta.id}-FWD.log > ${meta.id}_command_log.txt
MaskPrimers.py score --nproc ${task.cpus} -s ${meta.id}-FWD_primers-pass.fastq -p ${cprimers} --start ${params.vprimer_start} --maxerror ${params.primer_maxerror} \
    --mode ${params.primer_mask_mode} --outname ${meta.id}-REV $revpr \
    --log ${meta.id}-REV.log >> ${meta.id}_command_log.txt
ParseLog.py -l ${meta.id}-FWD.log ${meta.id}-REV.log -f ID PRIMER ERROR

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    presto: \$( MaskPrimers.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
21
22
23
24
25
26
27
28
"""
PairSeq.py -1 ${meta.id}_R1.fastq -2 ${meta.id}_R2.fastq $copyfield --coord illumina > ${meta.id}_command_log.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    presto: \$( PairSeq.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
21
22
23
24
25
26
27
28
29
"""
ParseHeaders.py copy -s $R1 -f BARCODE -k CLUSTER --act cat > ${meta.id}_command_log.txt
ParseHeaders.py copy -s $R2 -f BARCODE -k CLUSTER --act cat >> ${meta.id}_command_log.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    presto: \$( ParseHeaders.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
20
21
22
23
24
25
26
27
"""
ParseHeaders.py add -s $reads -o ${reads.baseName}_reheader-pass.fastq $args -u ${meta.id} ${meta.subject_id} ${meta.species} ${meta.locus}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    presto: \$( ParseHeaders.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
21
22
23
24
25
26
27
28
"""
ParseHeaders.py $subcommand -s $reads -o ${reads.baseName}_reheader-pass.fastq $args

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    presto: \$( ParseHeaders.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
21
22
23
24
25
26
27
28
"""
ParseHeaders.py copy -s $reads -o ${reads.baseName}_reheader-pass.fastq -f $args --act first last -k C_PRIMER V_PRIMER

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    presto: \$( ParseHeaders.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
30
31
32
33
34
35
36
37
"""
ParseHeaders.py copy -s $reads -o ${reads.baseName}_reheader-pass.fastq -f $args --act first last -k V_PRIMER C_PRIMER

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    presto: \$( ParseHeaders.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
20
21
22
23
24
25
26
27
"""
PairSeq.py -1 ${meta.id}_R1.fastq -2 ${meta.id}_R2.fastq --coord presto > ${meta.id}_command_log.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    presto: \$( PairSeq.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
21
22
23
24
25
26
27
28
29
30
31
"""
SplitSeq.py group -s $reads \\
$args \\
--outname ${meta.id} \\
--fasta > ${meta.id}_command_log.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    presto: \$( SplitSeq.py --version | awk -F' '  '{print \$2}' )
END_VERSIONS
"""
18
19
20
21
"""
mv "${R1}" "${meta.id}_R1.fastq.gz"
mv "${R2}" "${meta.id}_R2.fastq.gz"
"""
23
24
25
26
27
28
29
30
31
32
"""
reveal_add_metadata.R --repertoire ${tab} --metadata ${validated_input} --input_id ${meta.id} --outname ${meta.id} > ${meta.id}_add-meta_command_log.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    dplyr: \$(Rscript -e "library(dplyr); cat(paste(packageVersion('dplyr'), collapse='.'))")
    optparse: \$(Rscript -e "library(optparse); cat(paste(packageVersion('optparse'), collapse='.'))")
    R: \$(echo \$(R --version 2>&1) | awk -F' '  '{print \$3}')
END_VERSIONS
"""
20
21
22
23
24
25
26
27
28
29
30
"""
reveal_mod_3_junction.R --repertoire $tab --outname ${meta.id} > ${meta.id}_jmod3_command_log.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    alakazam: \$(Rscript -e "library(alakazam); cat(paste(packageVersion('alakazam'), collapse='.'))")
    optparse: \$(Rscript -e "library(optparse); cat(paste(packageVersion('optparse'), collapse='.'))")
    airr: \$(Rscript -e "library(airr); cat(paste(packageVersion('airr'), collapse='.'))")
    R: \$(echo \$(R --version 2>&1) | awk -F' '  '{print \$3}')
END_VERSIONS
"""
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""
reveal_filter_quality.R --repertoire $tab --outname ${meta.id} > ${meta.id}_fq_command_log.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    alakazam: \$(Rscript -e "library(alakazam); cat(paste(packageVersion('alakazam'), collapse='.'))")
    optparse: \$(Rscript -e "library(optparse); cat(paste(packageVersion('optparse'), collapse='.'))")
    stringi: \$(Rscript -e "library(stringi); cat(paste(packageVersion('stringi'), collapse='.'))")
    dplyr: \$(Rscript -e "library(dplyr); cat(paste(packageVersion('dplyr'), collapse='.'))")
    airr: \$(Rscript -e "library(airr); cat(paste(packageVersion('airr'), collapse='.'))")
    DT: \$(Rscript -e "library(DT); cat(paste(packageVersion('DT'), collapse='.'))")
    R: \$(echo \$(R --version 2>&1) | awk -F' '  '{print \$3}')
END_VERSIONS
"""
21
22
23
24
25
26
27
28
29
30
"""
check_samplesheet.py $samplesheet
cp $samplesheet samplesheet.valid.tsv

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    python: \$( echo \$(python --version | grep -o "[0-9\\. ]\\+") )
    pandas: \$(echo \$(python -c "import pkg_resources; print(pkg_resources.get_distribution('pandas').version)"))
END_VERSIONS
"""
19
20
21
22
23
24
25
26
"""
unzip $archive

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    unzip: \$(echo \$(unzip -help 2>&1) | sed 's/^.*UnZip //; s/ of.*\$//')
END_VERSIONS
"""
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""
[ ! -f  ${prefix}.fastq.gz ] && ln -sf $reads ${prefix}.fastq.gz

fastp \\
    --stdout \\
    --in1 ${prefix}.fastq.gz \\
    --thread $task.cpus \\
    --json ${prefix}.fastp.json \\
    --html ${prefix}.fastp.html \\
    $adapter_list \\
    $fail_fastq \\
    $args \\
    2> ${prefix}.fastp.log \\
| gzip -c > ${prefix}.fastp.fastq.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    fastp: \$(fastp --version 2>&1 | sed -e "s/fastp //g")
END_VERSIONS
"""
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
"""
[ ! -f  ${prefix}.fastq.gz ] && ln -sf $reads ${prefix}.fastq.gz

fastp \\
    --in1 ${prefix}.fastq.gz \\
    --out1  ${prefix}.fastp.fastq.gz \\
    --thread $task.cpus \\
    --json ${prefix}.fastp.json \\
    --html ${prefix}.fastp.html \\
    $adapter_list \\
    $fail_fastq \\
    $args \\
    2> ${prefix}.fastp.log

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    fastp: \$(fastp --version 2>&1 | sed -e "s/fastp //g")
END_VERSIONS
"""
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
"""
[ ! -f  ${prefix}_1.fastq.gz ] && ln -sf ${reads[0]} ${prefix}_1.fastq.gz
[ ! -f  ${prefix}_2.fastq.gz ] && ln -sf ${reads[1]} ${prefix}_2.fastq.gz
fastp \\
    --in1 ${prefix}_1.fastq.gz \\
    --in2 ${prefix}_2.fastq.gz \\
    --out1 ${prefix}_1.fastp.fastq.gz \\
    --out2 ${prefix}_2.fastp.fastq.gz \\
    --json ${prefix}.fastp.json \\
    --html ${prefix}.fastp.html \\
    $adapter_list \\
    $fail_fastq \\
    $merge_fastq \\
    --thread $task.cpus \\
    --detect_adapter_for_pe \\
    $args \\
    2> ${prefix}.fastp.log

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    fastp: \$(fastp --version 2>&1 | sed -e "s/fastp //g")
END_VERSIONS
"""
26
27
28
29
30
31
32
33
34
"""
[ ! -f  ${prefix}.fastq.gz ] && ln -s $reads ${prefix}.fastq.gz
fastqc $args --threads $task.cpus ${prefix}.fastq.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    fastqc: \$( fastqc --version | sed -e "s/FastQC v//g" )
END_VERSIONS
"""
36
37
38
39
40
41
42
43
44
45
"""
[ ! -f  ${prefix}_1.fastq.gz ] && ln -s ${reads[0]} ${prefix}_1.fastq.gz
[ ! -f  ${prefix}_2.fastq.gz ] && ln -s ${reads[1]} ${prefix}_2.fastq.gz
fastqc $args --threads $task.cpus ${prefix}_1.fastq.gz ${prefix}_2.fastq.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    fastqc: \$( fastqc --version | sed -e "s/FastQC v//g" )
END_VERSIONS
"""
50
51
52
53
54
55
56
57
58
"""
touch ${prefix}.html
touch ${prefix}.zip

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    fastqc: \$( fastqc --version | sed -e "s/FastQC v//g" )
END_VERSIONS
"""
28
29
30
31
32
33
34
35
36
37
38
39
40
"""
multiqc \\
    --force \\
    $args \\
    $config \\
    $extra_config \\
    .

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    multiqc: \$( multiqc --version | sed -e "s/multiqc, version //g" )
END_VERSIONS
"""
43
44
45
46
47
48
49
50
51
52
"""
touch multiqc_data
touch multiqc_plots
touch multiqc_report.html

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    multiqc: \$( multiqc --version | sed -e "s/multiqc, version //g" )
END_VERSIONS
"""
ShowHide 43 more snippets with no or duplicated tags.

Login to post a comment if you would like to share your experience with this workflow.

Do you know this workflow well? If so, you can request seller status , and start supporting this workflow.

Free

Created: 1yr ago
Updated: 1yr ago
Maitainers: public
URL: https://nf-co.re/airrflow
Name: airrflow
Version: 3.1.0
Badge:
workflow icon

Insert copied code into your website to add a link to this workflow.

Downloaded: 0
Copyright: Public Domain
License: None
  • Future updates

Related Workflows

cellranger-snakemake-gke
snakemake workflow to run cellranger on a given bucket using gke.
A Snakemake workflow for running cellranger on a given bucket using Google Kubernetes Engine. The usage of this workflow ...