# ============================================================================
# Config file for RNA-seq
#
# ==================[ Sections for the users ]================================
#
# One of input_directory, input_pattern and input_samples must be provided
# If input_directory provided, use it otherwise if input_pattern provided,
# use it, otherwise use input_samples.
# If input_extension provided, use it otherwise assume fastq.gz
# ============================================================================
input_directory: "%(input_directory)s"
input_readtag: "%(input_readtag)s"
input_pattern: "%(input_pattern)s"
input_extension: "%(input_extension)s"
# =========================================== Sections for the users

# list of your input file
input_samples:
    file1: "%(file1)s"
    file2: "%(file2)s"

# if files are required for a pipeline and are within sequana or should
# be downloaded before the pipeline provide them in this section
# Note that sequana and url fields are followed by itemised files or links
# using the front dashes
requirements:
    - phiX174.fa
    - Institut_Pasteur.png



##################################################################
# sequencing information. These informations will be inserted as
# read group in BAM files
#
# :Parameters:
#
# - platform: Name of the sequencing platform
# - instrument: name ot the instrument type
# - flowcell: flowcell ID

sequencing:
    platform: "Illumina"
    instrument: "Hiseq2500"
    flowcell: "H35CTBCXY"

#############################################################################
# Indexing section: if checked, all index for bowtie (1&2), star, etc... will be produced in dir
#
# :Parameters:
#
# - do: if unchecked, this rule is ignored
# - dir: directory where all indexed are written
# - name: name of prefix use in all mapping rules
# - fasta: path to Reference Genome in fasta format
# - gff: path to GFF annotation file. Be carefull: chromosome names must me concordant with Fasta file
# - rRNA_fasta: path to fasta file for ribosomal RNA if provided
# - rRNA_feature: if rRNA_fasta not provided, ribosomal RNA will be extract from GFF using this feature
#
genome:
  do: yes
  genome_directory: /pasteur/projets/specific/PF2_ngs/protected/Genomes/hg19
  name: "hg19" #path to index name
  fasta_file: /pasteur/projets/specific/PF2_ngs/protected/Genomes/hg19/hg19.fa
  gff_file: /pasteur/projets/specific/PF2_ngs/protected/Genomes/hg19/hg19.gff
  rRNA_file:
  rRNA_feature: "rRNA"

#################################################################
# FastQC section
#
# :Parameters:
#
# - options: string with any valid FastQC options
#
fastqc:
    options: "--nogroup"


#######################################################################
# Quality trimming and adapter removal
#
# If a design_file is provided the forward and reverse complement adapters
# are automatically extracted from this file (given the sample name contained
# in the filenames). In such case, the fwd and rev fields are ignored.
#
# If there is no design_file, the fwd and rev fields are used. It can be a
# string, or a filename. If a filename, it must be prefixed with "file:" to
# specify that it is a file and not a string. If the tool is cutadapt, the empty
# fwd and rev fields means that no adapters are to be used.
#
# :Parameters:
#
# - adapter_type: can only be one of PCRFree, Nextera, Rubicon, TruSeq.
#   Only used if design_file is provided.
# - design_file: a valid CSV file with mapping of index and sample name
# - fwd: a string or file (prefixed with *file:*)
# - m: 20 means discard trimmed reads that are shorter than 20.
#         must be > 0
# - quality: 0 means no trimming, 30 means keep base with quality
#        above 30
# - mode: must be set to one of
#     - g for 5'
#     - a for 3'
#     - b for both 5'/3'
# - rev: a string or file (prefixed with *file:*)
# - tool: only cutadapt supported for now
# - threads: number of threads to use (atropos only)
# - options: See cutadapt documentation for details on
#            cutadapt.readthedocs.io. We change the default value
#            of -O to 6 (at least 6 bases are required to match before
#            trimming of an adapter)
#
# :Note: If design_file is provided, fwd and rev are ignored
#
#   ref: http://cutadapt.readthedocs.io/
# adapter_choice__ = ["", "PCRFree", "Rubicon", "Nextera", "TruSeq"]
# tool_choice__ = ["atropos", "cutadapt", "clean_ngs"]
cutadapt:
    do: yes
    tool_choice: cutadapt
    adapter_choice:
    design_file:
    fwd:
    rev:
    m: 20                       # {"strict_min": 0}
    mode: "b"                   # {"values": ["b","g","a"]}
    options: "-O 6 --trim-n"
    quality: 30                 # {"range": [0,40]}
    threads: 4


#############################################################################
# fastq_screen used to align reads against genomes file contain in conf file with bowtie2
#
# :Parameters:
#
# - do: if unchecked, this rule is ignored
# - conf: the name of the configuration file
# - pf2_report: allows to plot a specific PF2 report
#
fastq_screen:
    do: no
    conf: "/pasteur/projets/specific/PF2_ngs/protected/bowtie2_genomes/fastq_screen.conf"
    options: "--subset 200000  --aligner bowtie2"
    pf2_report: yes

#############################################################################
# bowtie1_mapping_rna used to align reads against ribosomal RNA
#
# :Parameters:
#
# - do: if unchecked, this rule is ignored
# - options: any options recognised by bowtie1 tool
# - threads: number of threads to be used
#
bowtie1_mapping_rna:
    do: yes
    options: ""
    threads: 4

#############################################################################
# star_mapping used to align reads against genome file
#
# :Parameters:
#
# - do: if unchecked, this rule is ignored
# - options: any options recognised by rna-star tool
# - threads: number of threads to be used
#
star_mapping:
    do: no
    options: "--outFilterMismatchNoverLmax 0.05 --outSAMunmapped Within "
    threads: 4

#############################################################################
# bowtie1_mapping_ref used to align reads against genome file
#
# :Parameters:
#
# - do: if unchecked, this rule is ignored
# - options: any options recognised by bowtie1 tool
# - threads: number of threads to be used
#
bowtie1_mapping_ref:
    do: yes
    options: "--chunkmbs 400 -m 1 "
    threads: 4

#############################################################################
# bowtie2_mapping used to align reads against genome file
#
# :Parameters:
#
# - do: if unchecked, this rule is ignored
# - options: any options recognised by bowtie2 tool
# - threads: number of threads to be used
#
bowtie2_mapping:
    do: no
    #options: "--dovetail --no-mixed --no-discordant " for paired-end data
    options: ""
    threads: 4


#############################################################################
# feature_counts used to count reads against features
#
# :Parameters:
#
# - do: if unchecked, this rule is ignored
# - options: any options recognised by feature_counts tool
# - threads: number of threads to be used
#
feature_counts:
    do: yes
    #options: "-t exon -g gene_id"
    options: "-t gene -g ID" ## if exon/CDS is used, put -O option
    threads: 2


#############################################################################
# bamCoverage write file in bigwig format from BAM files.
# This tool takes an alignment of reads or fragments as input (BAM file) and
# generates a coverage track (bigWig or bedGraph) as output. The coverage is
# calculated as the number of reads per bin, where bins are short consecutive
# counting windows of a defined size. It is possible to extended the length of
# the reads to better reflect the actual fragment length. *bamCoverage* offers
# normalization by scaling factor, Reads Per Kilobase per Million mapped reads
# (RPKM), and 1x depth (reads per genome coverage, RPGC).
#
# :Parameters:
#
# - do: if unchecked, this rule is ignored
# - binSize: Size of the bins, in bases, for the output of the
#            bigwig/bedgraph file. (default: 50)
# - genomeSize: Report read coverage normalized to 1x sequencing depth
#                        (also known as Reads Per Genomic Content (RPGC)).
#                        Sequencing depth is defined as: (total number of
#                        mapped reads * fragment length) / effective genome
#                        size. The scaling factor used is the inverse of the
#                        sequencing depth computed for the sample to match the
#                        1x coverage. To use this option, the effective genome
#                        size has to be indicated after the option. The
#                        effective genome size is the portion of the genome
#                        that is mappable.
# - extendReads: This parameter allows the extension of reads to
#                fragment size.
# - minFragmentLength: The minimum fragment length needed for read/pair
#                      inclusion. Note that a value other than 0 will exclude
#                      all single-end reads.
# - maxFragmentLength: The maximum fragment length needed for read/pair
#                      inclusion. A value of 0 disables filtering and is
#                      needed for including single-end and orphan reads.
# - threads: number of threads to be used
# - chromSize: path to index of reference genome obtain by samtools faidx


coverage:
    do: no
    binSize: 10
    genomeSize : 2150570000 ##mm10
    extendReads: 65
    minFragmentLength: 0 #Note that a value other than 0 will exclude all single-end reads.
    maxFragmentLength: 0 #A value of 0 disables filtering and is needed for including single-end and orphan reads.
    threads: 4
    chromSize_file: /pasteur/projets/specific/PF2_ngs/protected/fasta_genomes/hg19.chrom.sizes




#############################################################################
# mark_duplicates (picard-tools) allows to mark PCR duplicate in BAM files
#
# :Parameters:
#
# - do: if unchecked, this rule is ignored. Mandatory for RNA-SeQC tool.
# - remove: If true do not write duplicates to the output file instead of writing them with
#            appropriate flags set.  Default value: false. This option can be set to 'null' to clear
#            the default value. Possible values: {true, false}
# - tmpdir: write tempory file on this directory (default TMP_DIR=/tmp/)
#
mark_duplicates:
    do: no
    remove: 'False' ## may be False
    tmpdir: "TMP_DIR=/local/scratch/" # Path to the temporary directory on your cluster, may be "TMP_DIR=/tmp" also
    threads: 4


#############################################################################
# RNA-SeQC allows to compute a series of quality control metrics for RNA-seq data
#
# :Parameters:
#
# - do: if unchecked, this rule is ignored
# - ref: Reference Genome in fasta format
# - gtf: GTF File defining transcripts (must end in '.gtf')
# - BWArRNA: Use an on the fly BWA alignment for estimating
#            rRNA content. The value should be the rRNA
#            reference fasta.
# - options: any options recognised by RNA-seQC tool

RNAseQC:
     do: no
     gtf_file: /pasteur/projets/specific/PF2_ngs/protected/annotation/gtf/hg19.gtf
     BWArRNA_file: /pasteur/projets/specific/PF2_ngs/protected/Genomes/human_rRNA/human_all_rRNA.fasta
     options: ""


#############################################################################
#   MultiQC aggregates results from bioinformatics analyses across many
#   samples into a single report.
#
# :Parameters:
#
# - options: any options recognised by multiqc
# - output-directory: Create report in the specified output directory
#
multiqc:
    options: "-c multiqc_config.yaml -f -x *_init_* -x *left_kept_reads* -x *report_rnaseq* -e htseq -e slamdunk"
    output-directory: "multiqc"
