#!/usr/bin/awk -f # # Chemical Shift Index Table # -------------------------- # This script makes a chemical shift index table from # your NMRView sequence and assignment files using the # chemical shift index reference tables from NMRView. # # Usage: csitab.awk protein.seq ppm.out CA C HA CB # # The protein.seq is standard NMRView format 3-letter # listing of your sequence with one residue per line. # # The ppm.out is the standard output from the Assignment # module with first word defining the residue number and # atom label, ie: #.lab, and the second word defining the # assigned ppm value. # # The remaining arguments are the atom labels that you want # to appear in the table. Nothing fancy here yet. You have # to explicitly define each label which will result in a # corresponding column for the chemical shift index for that label. # The labels must match the csi files used by NMRView. # # BEGIN { res = 0 # Read ppm.out file and store in 2D array while( getline < ARGV[2] > 0) { sub(/HA2/,"HA") split($1,tmp,".") assign[tmp[1], tmp[2]] = $2 # print tmp[1], tmp[2], assign[tmp[1], tmp[2]] } delete ARGV[2] printf("%3s %3s ", "#", "Num") # Read label arguments for( j = 3; j < ARGC; j++) { label[++col] = ARGV[j] delete ARGV[j] printf("%7s ", label[col]) # print col, label[col] # Read csi tables from NMRView table = ENVIRON["NMRVIEW4HOME"]"/amino/"tolower(label[col]) while( getline < table > 0) { # Convert to 3-letter for lookup if($0!~/^#/) { sub(/A/,"ala") sub(/B/,"csh") sub(/C/,"cys") sub(/D/,"asp") sub(/E/,"glu") sub(/F/,"phe") sub(/G/,"gly") sub(/H/,"his") sub(/I/,"ile") sub(/K/,"lys") sub(/L/,"leu") sub(/M/,"MET") sub(/N/,"asn") sub(/P/,"pro") sub(/Q/,"gln") sub(/R/,"arg") sub(/S/,"ser") sub(/T/,"thr") sub(/V/,"val") sub(/W/,"trp") sub(/Y/,"tyr") # Convert to uppercase to match assignment table ref = toupper($1) # Create 2D array for lookup table csi[col, ref] = $2 } # print col, ref, csi[col, ref] } } print "" } # Capitlaize residue name $0 !~ /^$/ {residue[++res] = toupper($1)} END { for( i = 1; i <= res; i++ ) { # Print residue name and number { if (residue[i] == "ALA") residue1[i]="A" else if (residue[i] == "CYS") residue1[i]="C" else if (residue[i] == "ASP") residue1[i]="D" else if (residue[i] == "GLU") residue1[i]="E" else if (residue[i] == "PHE") residue1[i]="F" else if (residue[i] == "GLY") residue1[i]="G" else if (residue[i] == "HIS") residue1[i]="H" else if (residue[i] == "ILE") residue1[i]="I" else if (residue[i] == "LYS") residue1[i]="K" else if (residue[i] == "LEU") residue1[i]="L" else if (residue[i] == "MET") residue1[i]="M" else if (residue[i] == "ASN") residue1[i]="N" else if (residue[i] == "PRO") residue1[i]="P" else if (residue[i] == "GLN") residue1[i]="Q" else if (residue[i] == "ARG") residue1[i]="R" else if (residue[i] == "SER") residue1[i]="S" else if (residue[i] == "THR") residue1[i]="T" else if (residue[i] == "VAL") residue1[i]="V" else if (residue[i] == "TRP") residue1[i]="W" else if (residue[i] == "TYR") residue1[i]="Y" } printf("%3d %3s ", i, residue1[i]) # Print csi from 2D array for each label for( k = 1; k <= col; k++) { if ( assign[i, label[k]] == 0.000) printf("%7s ","0") else { # Subtract csi reference from assigned resonance dif = assign[i, label[k]] - csi[k, residue[i]] # printf("%7.3f ", dif) printf("%7.2f ", assign[i, label[k]]) } } print "" } }