#!/bin/bash

echo "*********************"
echo "* LICENSE AGREEMENT *"
echo "*********************"
echo "All data downloaded from the Murphy Lab web site (http://murphylab.web.cmu.edu) remain the property of the 
Murphy" 
echo "Lab. You are granted a non-exclusive license to use these images for non-commercial, research purposes, with the" 
echo "following conditions: (a) you agree to include a reference to"
echo ""
echo "X. Chen, M. Velliste, S. Weinstein, J.W. Jarvik and R.F. Murphy (2003). Location proteomics - Building subcellular location trees from high resolution 3D "
echo "fluorescence microscope images of randomly-tagged proteins. Proc. SPIE 4962: 298-306."
echo ""
echo "when presenting or publishing your results, (b) you agree to send a copy of any paper or abstract (upon its"
echo "acceptance for publication or presentation) by FAX, email or regular mail to Dr. Murphy, and (c) you agree not to "
echo "distribute these images without inclusion of this notice."

echo "Dr. Robert F. Murphy"
echo "Professor of Biological Sciences, Biomedical Engineering and Machine Learning"
echo "Carnegie Mellon University"
echo "4400 Fifth Ave., Pittsburgh, PA 15213"
echo "FAX: 412-268-6571"
echo "email: murphy@cmu.edu"
echo ""

WEBSITE="http://murphylab.web.cmu.edu/data/3D/3T3"

URLS=('3T3_Tarfile_1.tgz' '3T3_Tarfile_2.tgz' '3T3_Tarfile_3.tgz'
'3T3_Tarfile_4.tgz' '3T3_Tarfile_5.tgz' '3T3_Tarfile_6.tgz' 
'3T3_Tarfile_7.tgz' '3T3_Tarfile_8.tgz' '3T3_Tarfile_9.tgz'
'3T3_Tarfile_10.tgz' '3T3_Tarfile_11.tgz' '3T3_Tarfile_12.tgz'
'3T3_Tarfile_13.tgz' '3T3_Tarfile_14.tgz' '3T3_Tarfile_15.tgz'
'3T3_Tarfile_16.tgz' '3T3_Tarfile_17.tgz' '3T3_Tarfile_18.tgz'
'3T3_Tarfile_19.tgz' '3T3_Tarfile_20.tgz' '3T3_Tarfile_21.tgz'
'3T3_Tarfile_22.tgz' '3T3_Tarfile_23.tgz' '3T3_Tarfile_24.tgz'
'3T3_Tarfile_25.tgz')

for URL in "${URLS[@]}"
do
	echo Downloading "$WEBSITE"/"$URL" to `pwd`
	wget --quiet -nc "$WEBSITE"/"$URL"
done

echo ""

for FILE in *.tgz
do
	if [ -f "$FILE" ]; then
		echo "Decompressing" "$FILE"
		tar -xf $FILE
		echo "Removing file" "$FILE"
		rm -fv $FILE
	fi
done