This script creates a 'homopolymer corrected' assembly from consensus information on 
homopolymers obtained from mapping the original reads to the original MIRA assembly with
BWA (http://bio-bwa.sourceforge.net/) and calling indels with Varscan 
(http://varscan.sourceforge.net/). In addition samtools (http://samtools.sourceforge.net/)
is needed for additional file manipulations.     

These were steps taken to perform the homopolymer correction:

(1) create alignment of original reads to the MIRA assembly:

bwa index your_assembly.fasta

bwa bwasw your_assembly.fasta your_fastq.fastq > your_assembly.sam

(2) change from sam to bam format
samtools view -S -b your_assembly.sam | samtools sort - your_assembly

(3) core indels with varscan
samtools mpileup -f your_assembly.fasta your_assembly.bam | java -jar path_to_varscan/VarScan/VarScan.v2.2.8.jar pileup2indel --min-var-freq 0.3 --p-value 0.1 > your_assembly.varscanindel30.txt

(4) run the script
perl replaceHomopolymers.pl contigs.fasta your_assembly.varscan.txt 5 > contigs.replaced.fasta


contigs.replaced.fasta contains your corrected assembly.

 