comparison misc/bug1/cmp.sh @ 18:e4d75f9efb90 draft

planemo upload commit b'4303231da9e48b2719b4429a29b72421d24310f4\n'-dirty
author nick
date Thu, 02 Feb 2017 18:44:31 -0500
parents af383638de66
children
comparison
equal deleted inserted replaced
17:836fa4fe9494 18:e4d75f9efb90
1 #!/usr/bin/env bash
2 if [ x$BASH = x ] || [ ! $BASH_VERSINFO ] || [ $BASH_VERSINFO -lt 4 ]; then
3 echo "Error: Must use bash version 4+." >&2
4 exit 1
5 fi
6 set -ue
7
8 TmpSscsBefore="tmp.sscs.before.fa"
9 TmpSscsAfter="tmp.sscs.after.fa"
10 TmpMsa="tmp.family.msa.tsv"
11
12 Usage="Usage: \$ $(basename $0) diff.family.msa.tsv diff.sscs.before.fa diff.sscs.after.fa > cmp.txt"
13
14 function main {
15 if [[ $# -lt 3 ]] || [[ $1 == '-h' ]]; then
16 fail "$Usage"
17 else
18 msa_input="$1"
19 sscs_before="$2"
20 sscs_after="$3"
21 fi
22
23 lines=$(cat $sscs_before | wc -l)
24 choice=$(python -c "import random; print 2*random.randint(1, $lines/2)")
25
26 echo $lines $choice >&2
27
28 head -n $choice $sscs_before | tail -n 2 > $TmpSscsBefore
29 head -n $choice $sscs_after | tail -n 2 > $TmpSscsAfter
30 cat $msa_input | ../msa_sscs_matcher.py $TmpSscsBefore > $TmpMsa
31
32 tail -n +2 $TmpSscsBefore
33 tail -n +2 $TmpSscsAfter
34 echo
35 cut -f 5,6 $TmpMsa
36 }
37
38 function fail {
39 echo "$@" >&2
40 exit 1
41 }
42
43 main "$@"