#!/bin/sh
#  Get example input files for theseus
#  Copyright (C) 2007 Morten Kjeldgaard <mok@bioxray.dk>
#
#  This script is free software; you can redistribute it and/or
#  modify it under the terms of the GNU  General Public
#  License as published by the Free Software Foundation; either
#  version 2.1 of the License, or (at your option) any later
#  version.
#
#  This script is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#   General Public License for more details.
#
#  You should have received a copy of the GNU  General Public
#  License along with this script; if not, write to the Free
#  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
#  Boston, MA 02110-1301 USA
set -e

pdbs="1s40"

astrals="d1cih__ d1cih__2 d1crj__ d1csu__ d1csx__ d1kyow_ d1lfma_ d1m60a_ d1u74d_ d1yeb__ d2pcbb_"

# function to fetch entries from the pdb
pdb_fetch () {
  for f in $* ; do
      wget -nv http://www.pdb.org/pdb/files/$f.pdb.gz 
      gzip -dc $f.pdb.gz > $f.pdb
  done
}

# function to fetch entries from astral
astral_fetch() {
  for f in $* ; do
    wget -nv http://astral.berkeley.edu/pdbstyle.cgi?id=${f}.pdb&output=text
  done
}

savedir=$PWD
cd /tmp

pdb_fetch $pdbs
astral_fetch $astrals

cd $savedir
