TITLE: Protocol for a reproducible circRNA analysis using Docker4Circ
AUTHORS: Giulio Ferrero, Nicola Licheri, Lucia Coscujuela Tarrero, Carlo De Intinis, Valentina Miano, Raffaele Adolfo Calogero, Francesca Cordero, Marco Beccuti, Michele De Bortoli

[DESCRIPTION]
<div class = "text-blocks"><div class = "text-block">Despite many computational tools were developed to predict circular RNAs (circRNAs), a limited number of work-flows exists to fully analyse a circRNA set ensuring the computational reproducibility of the whole analysis.</div><div class = "text-block">For this purpose, we designed Docker4Circ, a computational work-flow for a comprehensive circRNAs analysis of a circRNAs composed of four modules: the circRNAs prediction (module 1), the circRNAs classification and annotation (module 2), the circRNAs sequence analysis (module 3),  and circRNAs expression analysis (module 4).</div><div class = "text-block"><span>To ensure reproducibility each function of Docker4Circ was embeded into a docker image following guideline provided by Reproducible Bioinformatics Project (RBP, </span><a href="http://reproducible-bioinformatics.org/).//" style = "text-decoration:underline;color:blue;cursor:pointer;"><span style = ":;">http://reproducible-bioinformatics.org/)</span></a><span>. Each function is included in the Docker4Seq R package which already includes different solutions for reproducible bioinformatic analyses.</span></div><div class = "text-block">This protocol describes the use of each function of Docker4Circ to analyse the circRNAs predicted from a set of RNA-Seq experiments performed in normal colon and colorectal cancer cell lines. Furthermore, the description of the functions required to compute the expression level of the analysed circRNAs in a set of RNA-Seq experiments of colorectal primary tumors is provided.</div></div>

[STEPS]
?. [Softwares and datasets preparation]
Installation of the docker4seq R package.In the R environment digit the following command to install and run the docker4seq pipeline
?. [Softwares and datasets preparation]
Creation of the analysis folders.Before running the analyses, create the following directories in the working folder "data" "reference" "scratch". The "data" folder will be used to store all the input and output data, the "scratch" folder will be used to store the temporary data, and the "reference" folder will be used to store the reference genome and annotation data. The folders can be created in your working directory using the command "mkdir".Based on the path of your working directory, the path to these folder will be different. In our example the working directory is "/home". Then, the path to these three folders will be "/home/data" "/home/scratch" "/home/reference"You can obtain the path to your working directory using the R getwd() command.
?. [Softwares and datasets preparation]
Download of the input RNA-Seq dataThe RNA-Seq raw reads for the circRNA prediction can be downloaded from PRJNA393626. This dataset includes a triplicate paired-end total and RNAse-R treated RNA-Seq performed on NCM460 (normal colon cells), SW480 (primary colorectal cancer cells), and SW620 cell lines (metastatic colorectal cancer cells).The detailed list of datasets needed for the analysis is the following:SRA ID               IDSRR5889371    NCM460_rep1SRR5889366    NCM460_rep2SRR5889367    NCM460_rep3SRR5889368    SW480_rep1SRR5889369    SW480_rep2SRR5889362    SW480_rep3SRR5889363    SW620_rep1SRR5889364    SW620_rep2SRR5889365    SW620_rep3The the .fastq files can be downloaded from the ENA page of the experiment (linked below). The links to these files are reported under the column "FASTQ files (FTP)". Each dataset should be located in a specific directory, for example the experiment SRR5889371 should be put in the folder /data/SRR5889371.Use the following code to automatically create these folders:To download the files you can use the following R code.
?. [Module 1a: circRNAs prediction with CIRI2]
Indexing of the reference genome The first module of Docker4Circ was designed for the prediction of circRNAs from raw RNA-Seq reads. In this part of the protocol, the prediction performed using the CIRI2 algorithm is described. The first step of the pipeline is the BWA indexing of a reference genome using the bwaIndex function.All the index files of the reference genome will be stored in the reference folder.
?. [Module 1a: circRNAs prediction with CIRI2]
Read alignment with BWAThe second step of the pipeline will be the RNA-Seq read quality control using the fastqc function, the read aligment using the bwa function, and the circRNAs prediction using ciri2 function. The sequential call of these three functions is implemented in the wrapperCiri function that can be used as follow:The read alignment quality control files,  the BWA read alignment files and the set of predicted circRNAs (.ciri files) will be stored in the folder in which the input fastq files are located.
?. [Module 1a: circRNAs prediction with CIRI2]
Merge of multiple CIRI2 predictionsTo merge multiple CIRI2 circRNAs predictions into a common list of circRNAs, the function ciri2MergePredictions was implemented. Each .ciri files located in a specific dataset folder will be merged into a single file. Each sample name should be reported ad element of the samples.list vector with correponding sample type specified as element of the covariate.list vector.This function generates two files named merged_circRNA.ciri2.count_table and merged_circRNA.ciri2.txt. The first file reports the ids and coordinates of each circRNA while the second file is a matrix reporting the number of backsplicing reads supporting each circRNA in each dataset.
?. [Module 1b: circRNAs prediction with STARChip]
Indexing of the reference genome In this part of the protocol, the prediction performed using the STARChip algorithm is described. The first step of the pipeline is the STAR indexing of a reference genome using the rsemstarIndex function.The STAR index files of the reference genome will be stored in the reference folder.
?. [Module 1b: circRNAs prediction with STARChip]
Create the reference file for STARChipThe STARChip algorithm required an additional .bed file defined starting from the STAR-indexed reference genome. To generate this file, the function starChipIndex should be applied as follow:Two files called genome.gtf.bed and genome.gtf.exon.bed will be generated in the reference folder.
?. [Module 1b: circRNAs prediction with STARChip]
Running of STAR chimeric analysisThe STARChip circRNAs prediction require a run of STAR chimeric algorithm on the RNA-Seq reads. The STAR chimeric analysis is implemented in the starChimeric function that shoul be applied as follow:This function will generate each STAR chimeric output in each sample directory.
?. [Module 1b: circRNAs prediction with STARChip]
STARChip circRNAs predictionThe circRNA prediction will be performed using the starchipCircle function applied on the data folder containing each sample-specific folder
?. [Module 2: circRNAs annotation and classification]
Preparation of the reference files for the classificationTo classify the circRNAs a reference of Ensembl exon and transcript annotations is required. To provide these data in the correct format, the circrnaPrepareFiles function should be applied as follow.Two files called exons_reference and isoforms_reference reporting the exons and the gene isoform annotations respectively, will be generated in the data folder.
?. [Module 2: circRNAs annotation and classification]
Classification of circRNAs based on their mapping locationTo classify the circRNAs into distinct classes the function circrnaClassification should be applied as follow.Two files called circRNA_classification and circRNA_univocal_classification reporting the transcript- and the gene-level classification respectively, will be generated in the data folder.
?. [Module 2: circRNAs annotation and classification]
Annotation of the circRNA based on databases informationTo annotate the circRNAs based on the information stored in the circBase, TSCD, CSCD v2, Circ2Disease, ExoRBase, and CircFunBase databases, the function circAnnotation should be applied as follow.Different files with suffix .anno will be will be generated in the data folder. Each of these files will report the information about the circRNAs found in a specific database (es. circbase.anno will report the circBase information)
?. [Module 3: circRNAs sequence analysis]
Reconstruction of the circRNAs backsplicing junction sequencesTo reconstruct the sequence of the backsplicing junction of each circRNA the function circrnaBSJunctions should be applied as followThis function will generate a files called circRNA_backsplicing_sequences.fasta reporting the reconstructed sequence.
?. [Module 3: circRNAs sequence analysis]
Prediction of alternative splicing events involving the circRNAsTo predict the set of alternative splicing events involving the circRNA, the ciriAS function can be applied as follow using each BWA read alignment file and CIRI2 output.The output of the function will be a two different files called structure.list and structure_AS.list.
?. [Module 4: circRNAs expression analysis]
Download of the RNA-Seq data in which quantify the expression of a circRNA setThe RNA-Seq raw reads for the circRNAs quantification can be downloaded from PRJNA-411984. This dataset includes RNA-Seq data of three CRC samples with matched data from normal mucosa samples.The detailed list of datasets needed for the analysis is the following:SRA ID                IDSRR6067723     CRC_1SRR6067725     CRC_2SRR6067727     CRC_3SRR6067729     Normal mucosa 1SRR6067731     Normal mucosa 2
SRR6067733     Normal mucosa 3For each dataset a specific folder in the data folder The datasets can be downloaded using the following code applied using the url of the different datasets.
?. [Module 4: circRNAs expression analysis]
Quantification of circRNAs expression in RNA-Seq datasetsThe quantification of each circRNA in a specific RNA-Seq dataset is computed using the circrnaQuantification function This function will generate a file with extension .hashcirc reporting for each dataset the number of reads supporting each circRNA.
?. [Module 4: circRNAs expression analysis]
CircRNAs differential expression analysisBefore the differential expression analysis of the circRNAs level detected by the circrnaQuantification function, the function mergeData should be applied in order to merge the result obtained for each dataset.The output of this function called MergedData.tsv is a table reporting the counts of each annotation for each dataset. Furthermore, the sample identifiers reported in the header will be report the sample id followed by the corresponding  sample class. On this table the differential expression analysis can be perfomed using DESeq2 algorithm implemented in the wrapperDeseq2 function.