|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# exit when any command fails |
| 4 | +#set -e |
| 5 | + |
| 6 | +IN=$PASH_TOP/evaluation/benchmarks/dependency_untangling/input/ |
| 7 | +OUT=$PASH_TOP/evaluation/benchmarks/dependency_untangling/output/ |
| 8 | +IN_NAME=$PASH_TOP/evaluation/benchmarks/dependency_untangling/input/100G.txt |
| 9 | + |
| 10 | +if [ "$1" == "-c" ]; then |
| 11 | + rm -rf ${IN}/jpg |
| 12 | + rm -rf ${IN}/log_data |
| 13 | + rm -rf ${IN}/wav |
| 14 | + rm -rf ${IN}/nginx-logs |
| 15 | + rm -rf ${IN}/node_modules |
| 16 | + rm -rf ${IN}/pcap_data |
| 17 | + rm -rf ${IN}/pcaps |
| 18 | + rm -rf ${IN}/packages |
| 19 | + rm -rf ${IN}/mir-sa |
| 20 | + rm -rf ${IN}/deps |
| 21 | + rm -rf ${IN}/bio |
| 22 | + rm -rf ${IN}/output |
| 23 | + rm -rf ${OUT} |
| 24 | + exit |
| 25 | +fi |
| 26 | + |
| 27 | +setup_dataset() { |
| 28 | + if [ "$1" == "--small" ]; then |
| 29 | + LOG_DATA_FILES=6 |
| 30 | + WAV_DATA_FILES=20 |
| 31 | + NODE_MODULE_LINK=http://pac-n4.csail.mit.edu:81/pash_data/small/node_modules.zip |
| 32 | + BIO_DATA_LINK=http://pac-n4.csail.mit.edu:81/pash_data/small/bio.zip |
| 33 | + JPG_DATA_LINK=http://pac-n4.csail.mit.edu:81/pash_data/small/jpg.zip |
| 34 | + PCAP_DATA_FILES=1 |
| 35 | + else |
| 36 | + LOG_DATA_FILES=84 |
| 37 | + WAV_DATA_FILES=120 |
| 38 | + NODE_MODULE_LINK=http://pac-n4.csail.mit.edu:81/pash_data/full/node_modules.zip |
| 39 | + BIO_DATA_LINK=http://pac-n4.csail.mit.edu:81/pash_data/full/bio.zip |
| 40 | + JPG_DATA_LINK=http://pac-n4.csail.mit.edu:81/pash_data/full/jpg.zip |
| 41 | + PCAP_DATA_FILES=15 |
| 42 | + fi |
| 43 | + |
| 44 | + if [ ! -d ${IN}/wav ]; then |
| 45 | + mkdir -p ${IN}/wav |
| 46 | + cd ${IN}/wav |
| 47 | + wget https://file-examples-com.github.io/uploads/2017/11/file_example_WAV_1MG.wav |
| 48 | + wget https://file-examples-com.github.io/uploads/2017/11/file_example_WAV_2MG.wav |
| 49 | + wget https://file-examples-com.github.io/uploads/2017/11/file_example_WAV_5MG.wav |
| 50 | + wget https://file-examples-com.github.io/uploads/2017/11/file_example_WAV_10MG.wav |
| 51 | + for f in *.wav; do |
| 52 | + FILE=$(basename "$f") |
| 53 | + for (( i = 0; i <= $WAV_DATA_FILES; i++)) do |
| 54 | + echo copying to $f$i.wav |
| 55 | + cp $f $f$i.wav |
| 56 | + done |
| 57 | + done |
| 58 | + echo "WAV Generated" |
| 59 | + fi |
| 60 | + |
| 61 | + if [ ! -d ${IN}/jpg ]; then |
| 62 | + cd ${IN} |
| 63 | + wget $JPG_DATA_LINK |
| 64 | + unzip jpg.zip |
| 65 | + echo "JPG Generated" |
| 66 | + rm -rf ${IN}/jpg.zip |
| 67 | + fi |
| 68 | + |
| 69 | + # download the input for the nginx logs and populate the dataset |
| 70 | + if [ ! -d ${IN}/log_data ]; then |
| 71 | + cd $IN |
| 72 | + wget http://pac-n4.csail.mit.edu:81/pash_data/nginx.zip |
| 73 | + unzip nginx.zip |
| 74 | + rm nginx.zip |
| 75 | + # generating analysis logs |
| 76 | + mkdir -p ${IN}/log_data |
| 77 | + for (( i = 1; i <=$LOG_DATA_FILES; i++)) do |
| 78 | + for j in nginx-logs/*;do |
| 79 | + n=$(basename $j) |
| 80 | + cat $j > log_data/log${i}_${n}.log; |
| 81 | + done |
| 82 | + done |
| 83 | + echo "Logs Generated" |
| 84 | + fi |
| 85 | + |
| 86 | + if [ ! -d ${IN}/bio ]; then |
| 87 | + if [ "$1" = "--small" ]; then |
| 88 | + # download the Genome loc file |
| 89 | + wget $BIO_DATA_LINK |
| 90 | + unzip bio.zip |
| 91 | + cd bio |
| 92 | + wget http://pac-n4.csail.mit.edu:81/pash_data/Gene_locs.txt |
| 93 | + wget http://pac-n4.csail.mit.edu:81/pash_data/small/100G.txt |
| 94 | + cd .. |
| 95 | + rm bio.zip |
| 96 | + else |
| 97 | + mkdir ${IN}/bio |
| 98 | + cd ${IN}/bio |
| 99 | + # download the file containing the links for the dataset |
| 100 | + wget http://pac-n4.csail.mit.edu:81/pash_data/100G.txt |
| 101 | + # download the Genome loc file |
| 102 | + wget http://pac-n4.csail.mit.edu:81/pash_data/Gene_locs.txt |
| 103 | + # start downloading the real dataset |
| 104 | + cat ${IN_NAME} |while read s_line; |
| 105 | + do |
| 106 | + echo ${IN_NAME} |
| 107 | + sample=$(echo $s_line |cut -d " " -f 2); |
| 108 | + if [[ ! -f $sample ]]; then |
| 109 | + pop=$(echo $s_line |cut -f 1 -d " "); |
| 110 | + link=$(echo $s_line |cut -f 3 -d " "); |
| 111 | + wget -O "$sample".bam "$link"; ##this part can be adjusted maybe |
| 112 | + fi |
| 113 | + done; |
| 114 | + fi |
| 115 | + echo "Genome data downloaded" |
| 116 | + fi |
| 117 | + |
| 118 | + # download the initial pcaps to populate the whole dataset |
| 119 | + if [ ! -d ${IN}/pcap_data ]; then |
| 120 | + cd $IN |
| 121 | + wget http://pac-n4.csail.mit.edu:81/pash_data/pcaps.zip |
| 122 | + unzip pcaps.zip |
| 123 | + rm pcaps.zip |
| 124 | + mkdir ${IN}/pcap_data/ |
| 125 | + # generates 20G |
| 126 | + for (( i = 1; i <= $PCAP_DATA_FILES; i++ )) do |
| 127 | + for j in ${IN}/pcaps/*;do |
| 128 | + n=$(basename $j) |
| 129 | + cat $j > pcap_data/pcap${i}_${n}; |
| 130 | + done |
| 131 | + done |
| 132 | + echo "Pcaps Generated" |
| 133 | + fi |
| 134 | + |
| 135 | + # download the modules for the Mir static analyses |
| 136 | + if [ ! -d ${IN}/node_modules ]; then |
| 137 | + cd $IN |
| 138 | + wget $NODE_MODULE_LINK |
| 139 | + unzip node_modules.zip |
| 140 | + rm node_modules.zip |
| 141 | + # download the specific mir version |
| 142 | + wget http://pac-n4.csail.mit.edu:81/pash_data/mir-sa.zip |
| 143 | + unzip mir-sa.zip |
| 144 | + rm mir-sa.zip |
| 145 | + echo "Node modules generated" |
| 146 | + fi |
| 147 | + |
| 148 | + # download the packages for the package building |
| 149 | + if [ ! -f ${IN}/packages ]; then |
| 150 | + cd $IN |
| 151 | + wget http://pac-n4.csail.mit.edu:81/pash_data/packages |
| 152 | + if [ "$1" = "--small" ]; then |
| 153 | + head -n 20 packages > p |
| 154 | + mv p packages |
| 155 | + fi |
| 156 | + echo "Package datset downloaded" |
| 157 | + fi |
| 158 | +} |
| 159 | + |
| 160 | +source_var() { |
| 161 | + export IN= |
| 162 | +} |
0 commit comments