#! /bin/csh
#
# C-Shell script for generating a model of an FNR/Fd/NADP-complex
# 
#================================================================
#

# define the prefix of the PDB files are variables
#
set ref  = 1ewy
set nadp = 1gjr

# convert the sequence read from the ATOM-records of the
# PDB-file to a fasta file
#
# the command "head -8" writes the first eight line of the output
#
pdb2fasta $ref.pdb ATOM  | head -8 > $ref.fasta
pdb2fasta $nadp.pdb ATOM > $nadp.fasta

# make a sequence alignment using needle of the EMBOSS package.
# This is the command line usage of the program that you used
# through jemboss
#
# the resulting alignment will be written to the file `align.fasta`
#
needle -asequence $nadp.fasta \
       -bsequence $ref.fasta \
       -gapopen 11 -gapextend 1 \
       -aformat3 fasta \
       -outfile align.fasta

# superimpose (= structurally align) the two structures for which the 
# sequence alignment is given in the file `align.fasta`.
#
# The first structure in the `align.fasta` will serve as reference, 
# the second structure is superimposed to it.
# The resulting superimposed structure is written to a file called
# 'kabsch.pdb'
#
kabsch align.fasta B  > kabsch-bb.out    

#
# This generates now a model containing the Ferredoxin, NADP (unproductive 
# conformation), and FNR from the PDB file 1gjr in an orinetation that is
# superimposed with the FNR in an orientation superimposed with 
# the FNR/Fd complex (PDB 1ewy)  
#
# the command "grep -E ^".{21}C" selects all line that contain the
# character 'C' in the 21st column of the file (chain-id of the protein)
#
cat kabsch.pdb > model.pdb
