Make a SAM file (like those produced by GSNAP, bowtie2, SOAP2, etc) into a sorted, indexed BAM file for use by BamBam and other programs:
samtools view -Sb file.sam > file.bam
samtools sort file.bam file
samtools index file.bam
Call differential expression between 3 reps of 2 samples, using the EdgeR package (download from CRAN):
counter -g gene_annotation.gff sample1_rep1.bam sample1_rep2.bam sample1_rep3.bam sample2_rep1.bam sample2_rep2.bam sample2_rep3.bam > expression.txt
edgeR.R expression.txt differential_expression.txt
# modify the line "groups <- factor(c(1,1,1,2,2,2))" in edgeR.R to support other numbers os samples and reps
Build a SNP index to use SNP-tolerant mapping with GSNAP (iit_store and snpindex are downloaded with GSNAP):
interSnp haplotypeA.bam haplotypeB.bam > snps.txt
snp2gsnap.pl snps.txt ref.fasta | iit_store -o new_snps.iit
snpindex -d genome -V genome -v new_snps new_snps.iit
Build a phylogeny (newick format) with PHYLIP (download separately):
interSnp sample1.bam sample2.bam sample3.bam sample4.bam > snps.txt
snp2dist.pl snps.txt > infile
neighbor
mv outtree tree.nwk
# if you don't have PHYLIP, you can use "dist2dendo.pl infile > outtree" instead of "neighbor"
Build an alignment of several taxa for each gene:
bam2consensus -g gene_annotation.gff sample1.bam sample.bam sample3.bam sample4.bam sample5.bam sample6.bam
Estimate molecular evolution rates based on sequence reads from several individuals aligned to a common reference sequence:
bam2consensus -g gene_annotation.gff sample1.bam sample2.bam
for i in $(ls gene*.fasta | sed "s/\.fasta//g");
do
ESTScan -M ~/ESTScan2-2.1/Arabidopsis_thaliana.smat $i.fasta | sed "s/X/N/g" > $i.cds.fasta;
done;
kaks.pl *.cds.fasta > kaks.txt
Summarize methylation across a genome:
fasta2cyt.pl reference.fasta > reference.cyt
metHead -r reference.fasta -c reference.cyt sample.bam > sample.meth
BamBam is built on and makes use of both SAMtools (http://samtools.sourceforge.net/) and BAMtools (https://github.com/pezmaster31/bamtools). Zlib (zlib.net) is used by BAMtools. For Mac OS, an implementation of pthread_barrier was obtained from Albert Armea (http://blog.albertarmea.com/post/47089939939/using-pthread-barrier-on-mac-os-x).