This tutorial details how to use the OpenCGA alignment command line to run the alignment/mapping pipeline steps. The alignment pipeline outputs alignments in BAM files from raw sequence data in FastQ format files. BAM files can be used for further analysis, such as alignment statistics, coverage computation or variant calling.
A working setup of OpenCGA is required to setup a testing environment, please follow the steps on installation guide.
In addition, you need to download the following data files:
The alignment pipeline
Quality control for raw sequence data: FastQC subcommand
In order to use the input.fastq file, it has to be linked to the OpenCGA catalog:
Once linked the FastQ file, you can run the FastQC command:
For the input.fastq file, the FastQC command creates a report file called input_fastqc.html that can be downloaded from the OpenCGA catalog to the local directory /tmp by using the following command:
Here is the FastQC report file: input_fastqc.html.
Mapping raw sequences: BWA subcommand
First, link the reference.fasta file to the OpenCGA catalog:
Then, you can run the bwa index command to index database sequences in the FASTA format:
Internally, the index for the reference.fasta file created by the bwa index command consists of the following files:
Once created the index, you can map the FastQ file by using the bwa mem command:
In the previous command, the result alignments are saved in SAM format in the output.sam file .
Converting to and sorting BAM files
In order to convert a SAM file into BAM file, use the samtools view command with the parameter b (for more parameters details, see http://www.htslib.org/doc/samtools-view.1.html):
To sort a BAM file, use the samtools sort command:
Indexing and querying BAM files
Once the BAM file is sorted, you can index. A BAM index consists of a BAI file. Use the following command to create the index file (it will be called alignments.sorted.bam.bai):
To query for alignments use the query command applying a set of filters (e.g., regions, insert size, maximum number of hits of mismatches, minimum mapping quality...). The following command query alignments for a given region in chromosome 20 and from the position 500000 to 1000000:
Computing and querying BAM coverage
In order to compute the BAM coverage, use the command coverage-run. The coverage is saved in a BigWig format file.
To query for the coverage in a given region use the command coverage-query. The following command query for the coverage from the position 78700 to 78900 in chromosome 20:
Computing BAM statistics
In order to compute the statistics for a given BAM file, use the command stats-run:
BAM statistics can be viewed by executing the command stats-info:
In addition, OpenCGA provides the command stats-query to fetch BAM files according to their statistics. The following command fetch BAM files whose average mapping quality is greater than 35:
Table of Contents:
- No labels