comparison parsedb.sh @ 6:3ddd933dd7a2 draft default tip

Uploaded
author davidvanzessen
date Thu, 15 Sep 2016 03:54:33 -0400
parents dda9b2e72e2b
children
comparison
equal deleted inserted replaced
5:3d97839fda21 6:3ddd933dd7a2
10 input="$PWD/input.tab" 10 input="$PWD/input.tab"
11 11
12 mkdir $PWD/outdir 12 mkdir $PWD/outdir
13 13
14 if [ "fasta" == "$action" ] ; then 14 if [ "fasta" == "$action" ] ; then
15 /data/users/david/anaconda3/bin/python $dir/ParseDb.py fasta -d $input --outdir $PWD/outdir --outname output 15 python3 $dir/ParseDb.py fasta -d $input --outdir $PWD/outdir --outname output
16 mv $PWD/outdir/output_sequences.fasta $output 16 mv $PWD/outdir/output_sequences.fasta $output
17 elif [ "clip" == "$action" ] ; then 17 elif [ "clip" == "$action" ] ; then
18 /data/users/david/anaconda3/bin/python $dir/ParseDb.py clip -d $input --outdir $PWD/outdir --outname output 18 python3 $dir/ParseDb.py clip -d $input --outdir $PWD/outdir --outname output
19 mv $PWD/outdir/output_sequences.fasta $output 19 mv $PWD/outdir/output_sequences.fasta $output
20 elif [ "split" == "$action" ] ; then 20 elif [ "split" == "$action" ] ; then
21 field="`cat $input 2> /dev/null | head -n 1 | cut -f$4 | tr '\n\r' ' '`" 21 field="`cat $input 2> /dev/null | head -n 1 | cut -f$4 | tr '\n\r' ' '`"
22 label=$5 22 label=$5
23 mkdir $PWD/split 23 mkdir $PWD/split
24 /data/users/david/anaconda3/bin/python $dir/ParseDb.py split -d $input --outdir $PWD/split --outname output -f $field 24 python3 $dir/ParseDb.py split -d $input --outdir $PWD/split --outname output -f $field
25 #rename "s/output_${field}/$label/" $PWD/split/* 25 #rename "s/output_${field}/$label/" $PWD/split/*
26 elif [ "add" == "$action" ] ; then 26 elif [ "add" == "$action" ] ; then
27 field="`cat $input 2> /dev/null | head -n 1 | cut -f$4 | tr '\n\r' ' '`" 27 field="`cat $input 2> /dev/null | head -n 1 | cut -f$4 | tr '\n\r' ' '`"
28 value=$5 28 value=$5
29 /data/users/david/anaconda3/bin/python $dir/ParseDb.py add -d $input --outdir $PWD/outdir --outname output -f $field -u $value 29 python3 $dir/ParseDb.py add -d $input --outdir $PWD/outdir --outname output -f $field -u $value
30 mv $PWD/outdir/output_parse-add.tab $output 30 mv $PWD/outdir/output_parse-add.tab $output
31 elif [ "delete" == "$action" ] ; then 31 elif [ "delete" == "$action" ] ; then
32 field="`cat $input 2> /dev/null | head -n 1 | cut -f$4 | tr '\n\r' ' '`" 32 field="`cat $input 2> /dev/null | head -n 1 | cut -f$4 | tr '\n\r' ' '`"
33 value=$5 33 value=$5
34 regex=$6 34 regex=$6
35 if [ "true" == "$regex" ] ; then 35 if [ "true" == "$regex" ] ; then
36 regex="--regex" 36 regex="--regex"
37 else 37 else
38 regex="" 38 regex=""
39 fi 39 fi
40 /data/users/david/anaconda3/bin/python $dir/ParseDb.py delete -d $input --outdir $PWD/outdir --outname output -f $field -u $value --logic any $regex 40 python3 $dir/ParseDb.py delete -d $input --outdir $PWD/outdir --outname output -f $field -u $value --logic any $regex
41 mv $PWD/outdir/output_parse-delete.tab $output 41 mv $PWD/outdir/output_parse-delete.tab $output
42 elif [ "drop" == "$action" ] ; then 42 elif [ "drop" == "$action" ] ; then
43 field="`cat $input 2> /dev/null | head -n 1 | cut -f$4 | tr '\n\r' ' '`" 43 field="`cat $input 2> /dev/null | head -n 1 | cut -f$4 | tr '\n\r' ' '`"
44 /data/users/david/anaconda3/bin/python $dir/ParseDb.py drop -d $input --outdir $PWD/outdir --outname output -f $field 44 python3 $dir/ParseDb.py drop -d $input --outdir $PWD/outdir --outname output -f $field
45 mv $PWD/outdir/output_parse-drop.tab $output 45 mv $PWD/outdir/output_parse-drop.tab $output
46 elif [ "index" == "$action" ] ; then 46 elif [ "index" == "$action" ] ; then
47 field=$4 47 field=$4
48 /data/users/david/anaconda3/bin/python $dir/ParseDb.py index -d $input --outdir $PWD/outdir --outname output -f $field 48 python3 $dir/ParseDb.py index -d $input --outdir $PWD/outdir --outname output -f $field
49 mv $PWD/outdir/output_parse-index.tab $output 49 mv $PWD/outdir/output_parse-index.tab $output
50 elif [ "rename" == "$action" ] ; then 50 elif [ "rename" == "$action" ] ; then
51 field="`cat $input 2> /dev/null | head -n 1 | cut -f$4 | tr '\n\r' ' '`" 51 field="`cat $input 2> /dev/null | head -n 1 | cut -f$4 | tr '\n\r' ' '`"
52 newname=$5 52 newname=$5
53 /data/users/david/anaconda3/bin/python $dir/ParseDb.py rename -d $input --outdir $PWD/outdir --outname output -f $field -k $newname 53 python3 $dir/ParseDb.py rename -d $input --outdir $PWD/outdir --outname output -f $field -k $newname
54 mv $PWD/outdir/output_parse-rename.tab $output 54 mv $PWD/outdir/output_parse-rename.tab $output
55 elif [ "select" == "$action" ] ; then 55 elif [ "select" == "$action" ] ; then
56 field="`cat $input 2> /dev/null | head -n 1 | cut -f$4 | tr '\n\r' ' '`" 56 field="`cat $input 2> /dev/null | head -n 1 | cut -f$4 | tr '\n\r' ' '`"
57 value=$5 57 value=$5
58 regex=$6 58 regex=$6
59 if [ "true" == "$regex" ] ; then 59 if [ "true" == "$regex" ] ; then
60 regex="--regex" 60 regex="--regex"
61 else 61 else
62 regex="" 62 regex=""
63 fi 63 fi
64 /data/users/david/anaconda3/bin/python $dir/ParseDb.py select -d $input --outdir $PWD/outdir --outname output -f $field -u $value --logic any $regex 64 python3 $dir/ParseDb.py select -d $input --outdir $PWD/outdir --outname output -f $field -u $value --logic any $regex
65 mv $PWD/outdir/output_parse-select.tab $output 65 mv $PWD/outdir/output_parse-select.tab $output
66 elif [ "sort" == "$action" ] ; then 66 elif [ "sort" == "$action" ] ; then
67 field="`cat $input 2> /dev/null | head -n 1 | cut -f$4 | tr '\n\r' ' '`" 67 field="`cat $input 2> /dev/null | head -n 1 | cut -f$4 | tr '\n\r' ' '`"
68 num=$5 68 num=$5
69 tmp="" 69 tmp=""
72 fi 72 fi
73 desc=$6 73 desc=$6
74 if [ "true" == "$desc" ] ; then 74 if [ "true" == "$desc" ] ; then
75 tmp="--descend $tmp" 75 tmp="--descend $tmp"
76 fi 76 fi
77 /data/users/david/anaconda3/bin/python $dir/ParseDb.py sort -d $input --outdir $PWD/outdir --outname output -f $field $tmp 77 python3 $dir/ParseDb.py sort -d $input --outdir $PWD/outdir --outname output -f $field $tmp
78 mv $PWD/outdir/output_parse-sort.tab $output 78 mv $PWD/outdir/output_parse-sort.tab $output
79 elif [ "update" == "$action" ] ; then 79 elif [ "update" == "$action" ] ; then
80 field="`cat $input 2> /dev/null | head -n 1 | cut -f$4 | tr '\n\r' ' '`" 80 field="`cat $input 2> /dev/null | head -n 1 | cut -f$4 | tr '\n\r' ' '`"
81 value=$5 81 value=$5
82 replace=$6 82 replace=$6
84 if [ "true" == "$regex" ] ; then 84 if [ "true" == "$regex" ] ; then
85 regex="--regex" 85 regex="--regex"
86 else 86 else
87 regex="" 87 regex=""
88 fi 88 fi
89 /data/users/david/anaconda3/bin/python $dir/ParseDb.py update -d $input --outdir $PWD/outdir --outname output -f $field -u $value -t $replace $regex 89 python3 $dir/ParseDb.py update -d $input --outdir $PWD/outdir --outname output -f $field -u $value -t $replace $regex
90 mv $PWD/outdir/output_parse-update.tab $output 90 mv $PWD/outdir/output_parse-update.tab $output
91 fi 91 fi
92 92