File: vg-dotplots

package info (click to toggle)
vg 1.30.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 267,848 kB
  • sloc: cpp: 446,974; ansic: 116,148; python: 22,805; cs: 17,888; javascript: 11,031; sh: 5,866; makefile: 4,039; java: 1,415; perl: 1,303; xml: 442; lisp: 242
file content (28 lines) | stat: -rwxr-xr-x 883 bytes parent folder | download | duplicates (2)
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