
			 BAMMDS TUTORIAL

Please send problems and feedback to bammds-users@nongnu.org.

This tutorial will get you up and running on a GNU/Linux system or a Mac computer.


= Get the software =

You get the software by running (copy paste in a terminal):

    GET=$(
        (fetch -o /dev/null file:///bin/sh && echo fetch -o -) 2> /dev/null ||
        (curl -h >/dev/null && echo curl -L) 2> /dev/null || 
        (wget -h >/dev/null && echo wget -qO -) 2> /dev/null ||
        echo 'No wget, curl, fetch: Please inform bammds-users@nongnu.org what you use for downloading URLs' >&2
    )
    $GET http://download-mirror.savannah.gnu.org/releases/bammds/bammds-20140326.tar.gz > bammds-20140328.tar.gz
    # Change to this later:
    $GET http://download.savannah.nongnu.org/releases/bammds/bammds-20140326.tar.gz > bammds-20140328.tar.gz

64bit GNU/Linux: Then you unpack it and do a personal installation by:

    tar xvf bammds-*.tar.gz
    cd bammds-*/
    ./configure --prefix=$HOME && make install

Mac: Then you unpack it and do a personal installation by:

    tar xvf bammds-*.tar.gz
    cd bammds-*/
    ./configure --prefix=$HOME && make macinstall


= Requirements =

BAMMDS needs other software to work.

== R ==

To test if R is installed run:

    echo 'print("R is installed")' |  R --vanilla --quiet || echo "R is NOT installed"

If that did not work you need to install R.

On Debian/ubuntu you will do:

    sudo apt-get install r-base-core

== Samtools ==

To test if samtools is installed run:

    samtools

If that did not work you need to install samtools.

On Debian/ubuntu you will do:

    sudo apt-get install samtools


== VCFtools == Skip this step if your reference panel is not in a vcf format

To test if VCFtools is installed run:

    vcftools || echo "VCFtools is not installed"

If that did not work you need to install VCFtools.

On Debian you will do:

    sudo apt-get install vcftools

== PLINK == skip this step if the reference panel is not in a plink format.

To test if PLINK is installed run:

    p-link -h || echo "PLINK is not installed"

If that did not work you need to install PLINK.

On Debian you will do:

    sudo apt-get install plink

== Perl Local::Lib ==

To test if Perl Local::Lib is installed run:

    perl -Mlocal::lib -e 'print "Local::Lib is installed\n"' || echo "Local::Lib is NOT installed"

If that did not work you need to install Perl Local::Lib.

On Debian you will do:

    sudo apt-get install liblocal-lib-perl


= Running =

BAMMDS includes some small example files (you should expect that your bamfiles would be much bigger and
so the running time will be 100 times bigger than this example), so you should now be able
to do:

    PATH=$HOME/bin:$PATH
    MANPATH=$HOME/share/man
    bammds $HOME/share/doc/bammds/Gus.Subsample.bam $HOME/share/doc/bammds/HDGP.Reference.Subsample.txt

This will generate Gus.Subsample,HDGP.Reference.pdf

You can also run bamdamage on the bam-file:

    PATH=$HOME/bin:$PATH
    MANPATH=$HOME/share/man
    bamdamage $HOME/share/doc/bammds/Gus.Subsample.bam

and will generate Gus.Subsample.dam.pdf


= Generating plots for manuscripts =

BAMMDS can give you the output in different format:

    PATH=$HOME/bin:$PATH
    MANPATH=$HOME/share/man
    bammds -o my_plot.png $HOME/share/doc/bammds/Gus.Subsample.bam $HOME/share/doc/bammds/HDGP.Reference.Subsample.txt

Instead of png, you can use: tiff, svg, pdf, jpg. Instead of the plot
you can get the X,Y coordinates in a CSV-file to make your own plot in
R or a spreadsheet:

    PATH=$HOME/bin:$PATH
    MANPATH=$HOME/share/man
    bammds -o my_plot.csv $HOME/share/doc/bammds/Gus.Subsample.bam $HOME/share/doc/bammds/HDGP.Reference.Subsample.txt


