Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 44 Next »

Samtools

Setup output directory.

mkdir samtools_bowtie

If you do not have an alignment file in the SAM format you may want to start with Introduction to mapping.

cp bowtie/REL606.5.sam samtools_bowtie/ 
cp bowtie/REL606.5.fasta samtools_bowtie/

Index the reference file.

samtools faidx samtools_bowtie/REL606.5.fasta

Convert from SAM to BAM format.

samtools view -bS -o samtools_bowtie/REL606.5.bam bowtie/REL606.5.sam |borderStyle=solid}

Sort the BAM file.

samtools sort samtools_bowtie/REL606.5.bam samtools_bowtie/sorted_REL606.5

Output VCF file.

samtools mpileup -uf samtools_bowtie/REL606.5.fasta samtools_bowtie/sorted_REL606.5.bam \|bcftools view -vcg - \> samtools_bowtie/output.vcf 

Results on Lonestar

bowtie
/corral-repl/utexas/BioITeam/ngs_course/mapping/samtools_bowtie/sorted_REL606.5.bam
/corral-repl/utexas/BioITeam/ngs_course/mapping/samtools_bowtie/output.vcf
bwa
/corral-repl/utexas/BioITeam/ngs_course/mapping/samtools_bwa/sorted_REL606.5.bam
/corral-repl/utexas/BioITeam/ngs_course/mapping/samtools_bwa/output.vcf

Exercise.

VCF format has Allele Frequency tags denoted by AF1. Try the following command to see what value we have in our files.

cat input.vcf | grep AF1

For the data we are dealing with, predictions with an allele frequency not equal to 1 are not really applicable. How can we remove these lines from the file and continue on?

 Hint

What does the -v flag do in grep?

grep -v *something*
 Solution
cat input.vcf | grep AF1=1 > output.vcf

Is not practical, since we will lose vital VCF formatting and may not be able to use this file in the futre.

cat input.vcf | grep -v AF1=0 > output.vcf

Will preserve all lines that don't have an AF1=0 value and is one way of doing this.

sed -i '/AF1=0/ d' input.vcf

Is a better way of doing it inline and not requiring you to make another file.

Determining Differences Between Aligners.

Setup output directory and then change into it.

mkdir output
cp samtools_bowtie/output.vcf output/bowtie.vcf
cp samtools_bwa/output.vcf output/bwa.vcf
cd output

Bedtools is a suite of utility programs that work on a variety of file formats, one of which is conveniently VCF format. Using intersectBed and subtractBed we can find equal and different predictions between mappers.

Load Bedtools.

module load bedtools

Finding alike mutations.

intersectBed -a bowtie.vcf -b bwa.vcf > intersect.vcf

Finding unique mutations for each mapper.

subtractBed -a bowtie.vcf -b intersect.vcf > unique_bowtie.vcf
subtractBed -a bwa.vcf -b intersect.vcf > unique_bwa.vcf
  • No labels