Biowulf High Performance Computing at the NIH
SGA on Biowulf

SGA (String Graph Assembler) is a de novo genome assembler based on the concept of string graphs. The major goal of SGA is to be very memory efficient, which is achieved by using a compressed representation of DNA sequence reads. It is based on Gene Myers' string graph formulation of assembly and uses the FM-index/Burrows-Wheeler transform to efficiently find overlaps between sequence reads.


Important Notes

Interactive job
Interactive jobs should be used for debugging, graphics, or applications that cannot be run as batch jobs.

Allocate an interactive session and run the program.
Sample session (user input in bold):

[user@biowulf]$ sinteractive
salloc.exe: Pending job allocation 46116226
salloc.exe: job 46116226 queued and waiting for resources
salloc.exe: job 46116226 has been allocated resources
salloc.exe: Granted job allocation 46116226
salloc.exe: Waiting for resource configuration
salloc.exe: Nodes cn3144 are ready for job
[user@cn3144 ~]$ module load sga
[user@cn3144 ~]$ sga preprocess --pe-mode 1 -o SRR065390.fastq SRR065390_1.fastq SRR065390_2.fastq
[user@cn3144 ~]$ exit
salloc.exe: Relinquishing job allocation 46116226
[user@biowulf ~]$

Batch job
Most jobs should be run as batch jobs.

Create a batch input file (e.g. For example:

module load sga
cp $SGA_EXAMPLES/SRR065390*.fastq.gz .
gunzip SRR065390*.fastq.gz

# Example assembly of 100bp C. elegans data set. The only argument
# this script takes is the overlap length used for the final contig assembly.

# We assume the data is downloaded from the SRA and converted to fastq files
# Set IN1 and IN2 to be the paths to the data on your filesystem

# Parameters

# Overlap parameter used for the final assembly. This is the only argument
# to the script

# The number of threads to use

# To save memory, we index $D reads at a time then merge the indices together

# Correction k-mer value

# The minimum k-mer coverage for the filter step. Each 27-mer
# in the reads must be seen at least this many times

# Overlap parameter used for FM-merge. This value must be no greater than the minimum
# overlap value you wish to try for the assembly step.

# Parameter for the small repeat resolution algorithm

# The number of pairs required to link two contigs into a scaffold

# The minimum length of contigs to include in a scaffold

# Distance estimate tolerance when resolving scaffold sequences

# Turn off collapsing bubbles around indels

# First, preprocess the data to remove ambiguous basecalls
$SGA_BIN preprocess --pe-mode 1 -o SRR065390.fastq $IN1 $IN2

# Error correction
# Build the index that will be used for error correction
# As the error corrector does not require the reverse BWT, suppress
# construction of the reversed index
$SGA_BIN index -a ropebwt -t $CPU --no-reverse SRR065390.fastq

# Perform error correction with a 41-mer.
# The k-mer cutoff parameter is learned automatically
$SGA_BIN correct -k $CK --discard --learn -t $CPU -o$CK.fastq SRR065390.fastq

# Contig assembly

# Index the corrected data.
$SGA_BIN index -a ropebwt -t $CPU$CK.fastq

# Remove exact-match duplicates and reads with low-frequency k-mers
$SGA_BIN filter -x $COV_FILTER -t $CPU --homopolymer-check --low-complexity-check$CK.fastq

# Merge simple, unbranched chains of vertices
$SGA_BIN fm-merge -m $MOL -t $CPU -o merged.k$CK.fa$CK.filter.pass.fa

# Build an index of the merged sequences
$SGA_BIN index -d 1000000 -t $CPU merged.k$CK.fa

# Remove any substrings that were generated from the merge process
$SGA_BIN rmdup -t $CPU merged.k$CK.fa

# Compute the structure of the string graph
$SGA_BIN overlap -m $MOL -t $CPU merged.k$CK.rmdup.fa

# Perform the contig assembly without bubble popping
$SGA_BIN assemble -m $OL -g $MAX_GAP_DIFF -r $R -o assemble.m$OL merged.k$CK.rmdup.asqg.gz

# Scaffolding/Paired end resolution

# Realign reads to the contigs
sga-align --name $CTGS $IN1 $IN2

# Make contig-contig distance estimates -n $MIN_PAIRS --prefix libPE

# Make contig copy number estimates -m $MIN_LENGTH > libPE.astat

$SGA_BIN scaffold -m $MIN_LENGTH --pe -a libPE.astat -o scaffolds.n$MIN_PAIRS.scaf $CTGS
$SGA_BIN scaffold2fasta -m $MIN_LENGTH -a $GRAPH -o scaffolds.n$MIN_PAIRS.fa -d $SCAFFOLD_TOLERANCE --use-overlap --write-unplaced scaffolds.n$MIN_PAIRS.scaf

Submit this job using the Slurm sbatch command.

sbatch --cpus-per-task=16