#!/bin/bash
all="all: "
while read a 
do 
	name=`basename $a`
	name=${a%.bsp}
	echo "$name.2bed.fi: $a"
	echo "	perl bin/bsp2bed_JE_v2.pl $a > $name.pairs.bed 2>$name.jlen.hist && Rscript bin/plot.bar.R $name.jlen.hist $name && touch $name.2bed.fi"
	all="$all $name.2bed.fi "

	echo "$name.2ends.fi: $a"
	echo "	perl bin/infer_jagged_ends.pl $a >$name.jagged.ends && Rscript bin/plot_MD.R $name.jagged.ends $name && touch $name.2ends.fi "
	all="$all $name.2ends.fi "

	echo "$name.2hist.fi: $name.2bed.fi"
	echo "	perl bin/parse_jbed.pl $name.pairs.bed >$name.JE.exact.hist.v2 && Rscript bin/plot_all_MD_vs_size.R $name.JE.exact.hist.v2 $name && touch $name.2hist.fi "
	all="$all $name.2hist.fi "
done<bsp.list
echo $all



