#These files instructs on how to prepare the conformation database and PSSM files used during design. 
#The example explains how to prepare a conformation database for beta-alpha unit 4 but are the same for all other units

1. In the source pdb (the pdb from which you are extracting the conformation) find the stem positions that best align to the stem positions of the 
#template pdb's corresponding beta-alpha unit (in this example the unit we are genrating the conformation for in unit 4, whose stem position are 135-169 (see methods for unit stem positions).
#Finding the correct alignment between source unit and template unit can be done using the python script "find_best_match.py".
#Run this script in the following way (requires pymol):

	pymol -c find_best_match_blade_tim_barrel.py 2vc5B_unit4.pdb 4h9zB.pdb

	2vc5B_unit4.pdb  - the beta-alpha unit from the template pdb (in this example 2VC5. The beta-alpha unit definitions can be found in the main text methods)
	4h9zB.pdb - The source pdb from where we are extracting the conformation.

# This script will create the folder named "pdb". In it the aligned units are saved.

2. Once the source unit pdb is saved we can run "SpliceOut" which creates the conformation database:
	rosetta_scripts.default.linuxgccrelease  @flags  -parser:script_vars  source=pdb/4h9zB.pdb  db_name=blade4_4h9zB  -out:prefix  4h9zB_
# this will create a confrmation database named "blade4_4h9zB " which holds the phi/psi/omega angles of unit 4 from pdb 4h9z chain B.
	
3. Generating PSSM files
# Every conformation segment has an accompanying PSSM file
# to generate those you first must have a folder with "cut out" conformation segments (those that are created in step 1 above).
# Once those are created, for each segment run the following command:

rosetta_scripts.default.linuxgccrelease -s 2vc5B_unit4.pdb -unboundrot pdb/4h9zB.pdb @flags_make_pssm -parser:script_vars rot_db=2vc5_U4.db seq_aln=2vc5_U4.fa

# change the input pdb after "-s" for every new run
# The -unboundrot flags takes a space separated list of all the pdbs in the "cut out" folder.

#This command will create two files: 
	1. a rotamer database file: 2vc5_U4.db 
	2. a sequence alignment file: 2vc5_U4.fa
#The second file is an MSA with same length as the input file (in this case the sequence length of unit4 from 2VC5)
#this sequence alignment can then be converted into a pssm file using psiblast or any other suitable sofware.

	