|
| 1 | +#!/bin/sh |
| 2 | +base=`dirname $(readlink -f $0)`/../ |
| 3 | +base=`readlink -f $base` |
| 4 | +if [ ! -f "$base/bin/env.sh" ]; |
| 5 | +then |
| 6 | + echo -e "\n$(tput setaf 1)error: cannot find $base/bin/env.sh$(tput setaf 7)\n" |
| 7 | + exit 1 |
| 8 | +fi |
| 9 | +. $base/bin/env.sh |
| 10 | +if [ $# -ne 4 ]; |
| 11 | +then |
| 12 | + echo -e "\nusage:\n sh $0 $(tput setaf 3)track.list$(tput setaf 7) prefix outdir/ $(tput setaf 3)main.conf$(tput setaf 7)\n\nany question, go to https://github.com/orangeSi/ClustersPloter/issues" |
| 13 | + exit |
| 14 | +fi |
| 15 | +#set -vex |
| 16 | + |
| 17 | +#samtools view -h S20K.sort.bam s160:155612-178608 |samtools view - -b >S20K.s160.155612.178608.sort.bam #samtools index S20K.s160.155612.178608.sort.bam |
| 18 | + |
| 19 | +#base=`dirname $(readlink -f $0)`/src/ |
| 20 | +#source $base/../env.sh |
| 21 | +list=$1 |
| 22 | +prefix=$2 |
| 23 | +outdir=$3 |
| 24 | +conf=$4 |
| 25 | + |
| 26 | +for i in $list $conf |
| 27 | +do |
| 28 | + if [ ! -f "$i" ]; |
| 29 | + then |
| 30 | + echo -e "\n$(tput setaf 1)error: file $i not exists$(tput setaf 7)" |
| 31 | + exit |
| 32 | + fi |
| 33 | +done |
| 34 | + |
| 35 | +if [ ! -d "$outdir" ]; |
| 36 | +then |
| 37 | + mkdir -p $outdir |
| 38 | +fi |
| 39 | + |
| 40 | +cd $outdir |
| 41 | + |
| 42 | +num=`cat $conf|grep -iE "^\s*hist_scatter_line\s*|^\s*reads_mapping\s*|^\s*synteny\s*"|wc -l` |
| 43 | +if [ "$num" -ge 1 ]; |
| 44 | +then |
| 45 | + echo |
| 46 | + date |
| 47 | + echo -e "$(tput setaf 3)perl $base/src/prepare.data.pl --list $list --prefix $prefix --outdir . --conf $conf$(tput setaf 7)" |
| 48 | + time perl $base/src/prepare.data.pl --list $list --prefix $prefix --outdir . --conf $conf >$prefix.prepare.data.log 2>$prefix.prepare.data.error.tmp |
| 49 | + cat $prefix.prepare.data.error.tmp|grep -v '^+ ' > $prefix.prepare.data.error && rm $prefix.prepare.data.error.tmp |
| 50 | + echo |
| 51 | +else |
| 52 | + cp $list $list.$prefix |
| 53 | + cp $conf $conf.$prefix |
| 54 | +fi |
| 55 | + |
| 56 | +if [ -s $prefix.prepare.data.error ]; |
| 57 | +then |
| 58 | + cat $prefix.prepare.data.error |
| 59 | + echo -e "\n\n$(tput setaf 1)error in file: $prefix.prepare.data.error$(tput setaf 7)\n\n" |
| 60 | + date |
| 61 | + exit |
| 62 | +else |
| 63 | +date |
| 64 | +echo |
| 65 | +echo |
| 66 | +date |
| 67 | +echo -e "$(tput setaf 3)perl $base/src/plot.genome.featureCluster.pl --list $list.$prefix --prefix $prefix --outdir . --conf $conf.$prefix $(tput setaf 7)" |
| 68 | +time perl $base/src/plot.genome.featureCluster.pl --list $list.$prefix --prefix $prefix --outdir . --conf $conf.$prefix >$prefix.plot.log 2>$prefix.plot.error.tmp |
| 69 | +cat $prefix.plot.error.tmp|grep -v '^+ ' >$prefix.plot.error && rm $prefix.plot.error.tmp |
| 70 | +echo |
| 71 | +fi |
| 72 | +echo |
| 73 | +#ls -ltrh $prefix.prepare.data.log $prefix.plot.log 2>/dev/null |
| 74 | +#ls -ltrh $prefix.prepare.data.error $prefix.plot.error 2>/dev/null |
| 75 | +if [ -s $prefix.plot.error ]; |
| 76 | +then |
| 77 | + cat $prefix.plot.error |
| 78 | + echo -e "\n\n$(tput setaf 1)detail error in file $prefix.plot.error, $(tput setaf 7)\n\n" |
| 79 | + date |
| 80 | + exit |
| 81 | +else |
| 82 | + echo -e "\n\n$(tput setaf 2)finished, no error~$(tput setaf 7)\n\n" |
| 83 | +fi |
| 84 | +date |
| 85 | + |
| 86 | +echo "$(tput setaf 2)output is:$(tput setaf 7)" |
| 87 | +ls -thl $prefix.svg $prefix.notitle.svg $prefix.html |
| 88 | +echo |
0 commit comments