1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#!/bin/bash
if [ $# -ne 3 ];
then
echo "usage: "$(basename $0) "[vg-graph.xg] [output-dir] [pdf or png]"
exit
fi
graph=$1
outdir=$2
type=$3
mkdir -p $outdir
vg dotplot -x $graph | gzip >$outdir/pathoverlaps.tsv.gz
paths=$(vg paths -L -x $graph)
#(zcat $outdir/pathoverlaps.tsv.gz | tail -n+2 | awk '{ print $1, $4 }' | sort | uniq ) | while read cmp
for path1 in $paths
do
for path2 in $paths
do
echo $path1 $path2
zcat $outdir/pathoverlaps.tsv.gz \
| awk 'NR==1 || $1=="'$path1'" && $4=="'$path2'" { print }' \
| Rscript -e 'require(ggplot2); d <- read.delim("stdin"); ggplot(d, aes(x=query.pos, y=target.pos)) + geom_point(size=0.1) + scale_x_continuous("'$path1'") + scale_y_continuous("'$path2'") + coord_fixed(ratio = 1) + theme_bw(); ggsave("'$outdir/$path1.$path2.dotplot.$type'", height=7, width=7)'
done
done
|