Preparing read data
The best format to present short read alignments to GenomeView is the SAM/BAM format. You need to have your read data in this format and it has to be aligned to a reference genome.
Aligning reads
GenomeView is a visualization tool and does not do the computationally intensive read alignment. There are however dozens of tools already available to do this job.
If you need help aligning your reads, you may want to have a look at the Recipe to align reads to get some ideas.
Sorting and indexing
Before you can visualize read data you need to prepare the data. This needs to be done because those files are generally huge and we do not want to read the complete file if we're only looking at a small portion of it.
There are two things to prepare data fresh from the aligner.
- Sort reads based on genomic coordinates
- Index sorted reads.
With Picard (OS independent, recommended)
You need to have a local copy of Picard installed and you need to run these commands on the command-line.
In this example we have a read alignment in BAM format called 'alignment.sam'. We use the program SortSam from Picard to sort the file by coordinates. This also works if your aligner gives you a BAM file as output, i.e. 'alignment.bam'
Sorting The instruction below will sort the SAM file by coordinate.
java -Xmx500m -jar SortSam.jar I=aligned.sam O=sorted.bam SO=coordinate
Important:
- You may need to put the full path for SortSam.jar to the location where you installed the Picard programs.
- You may need to put the full path to where the aligned.sam file sits and where you want the sorted.bam file to end up.
- You have to make sure to replace 'alignment.sam' with the actual name of you aligned SAM/BAM file.
- You have to make sure to replace 'sorted.bam' with the actual name that you want your sorted file to have.
Sanity checks:
- Make sure there are no errors reported on the console when running this instruction.
- Make sure that you now have a file 'sorted.bam' and that it's not completely empty, i.e. it has a size > 0
Indexing After you have sorted the file, you can index the resulting BAM file with the instruction below:
java -Xmx500m -jar BuildBamIndex.jar I=sorted.bam
Important:
- You may need to put the full path for BuildBamIndex.jar to the location where you installed the Picard programs.
- You may need to put the full path to where the 'sorted.bam' file sits.
Sanity checks:
- Make sure there are no errors reported on the console when running this instruction.
- Make sure that you now have a file 'sorted.bam.bai' and that it's not completely empty, i.e. it has a size > 0. This file will be created in the same directory as the 'sorted.bam' file.
With SAMtools (Mac OS and Linux)
Steps to get from the various aligner formats to the SAM format are available on the SAMtools website.
You need to have SAMtools installed.
Steps to go from SAM to indexed BAM.
samtools faidx reference.fasta (will create reference.fasta.fai for the next step)
samtools view -bS -t reference.fasta.fai alignment.sam -o alignment.bam
samtools sort alignment.bam sorted (will create sorted.bam)
samtools index sorted.bam (will create sorted.bam.bai, which is read by GenomeView together with the bam file)
Summary visualizations
Coverage plots
If you are primarily interested in the read coverage and not in individual reads, you may want to create coverage plots.
Variants
If you are investigating SNPs or other genetic variants, you also may want to create variant calls.