#include #include #include #include #include "molecule.h" // // Any comments and suggestion may be sent to: // Author: Björn Wallner // E-mail: bjorn.wallner@liu.se // // int main(int argc,char *argv[]) /* Main routine */ { molecule m[1]; molecule model[1]; int i,j,k; double d; double mean=0; int atoms=0; int residues=0,residues2=0; // int contacts[MAXRES][MAXRES]={{}}; /* int **contacts,**contacts2; double **dist,**dist2;*/ // int res_contacts[20][20]={{}}; // int restype[20]={}; // int tot_res_contacts=0; /// int type_i,type_j; int current_res_i=0; int current_res_j=0; long selected_resnum; int first=0; double cutoff=0; FILE *fp; int error=0,error2=0; double temp; int tmp=0; int binary=1; char chain_name; int nativeA[5000]; int nativeB[5000]; int modelA[5000]; int modelB[5000]; char chainA,chainB,chainA2,chainB2; int interface_contacts=0; int interface_contacts_model=0; int verbose=0; char set='a'; char set_switch[100]; char arg[100]; //float sum=0; /* Parse command line for PDB filename */ if(argc>=4) { strcpy(model[0].filename,argv[1]); strcpy(m[0].filename,argv[2]); cutoff=strtod(argv[3],NULL); cutoff=cutoff*cutoff; for(i=4; i5) // verbose=1; } else { printf("Usage: fnat [pdb_file] [native] cutoff [set default all-atom] [verbose (default off)]]\n"); exit(1); } error=read_molecules(m,set); if(error==0) { residues=m[0].residues; /* contacts = malloc(residues*sizeof(int *)); dist = malloc(residues*sizeof(double *)); for(i=0;i5 && if(strcmp(m[0].atm[j].chain,m[0].atm[i].chain)!=0) { // printf("HEJ %d %d %d %d %f %f\n",current_res_j,current_res_i,i,j,crd(m,i,j),crd(m,j,i)); d=crd(m,i,j); // printf("%d %d %d %d %s %s %f\n",m[0].atm[j].resnum,m[0].atm[i].resnum,i,j,m[0].atm[j].chain,m[0].atm[i].chain,d); if(verbose) printf("ALLNATIVE: %d%s %d%s %f %d %d\n",m[0].atm[i].resnum,m[0].atm[i].chain,m[0].atm[j].resnum,m[0].atm[j].chain,sqrt(d),current_res_i,current_res_j); //,contacts[current_res_i][current_res_j]); chainA=m[0].atm[i].chain[0]; chainB=m[0].atm[j].chain[0]; if(/*contacts[current_res_i][current_res_j]==0 && */crd(m,i,j)<=cutoff) { nativeA[interface_contacts]=m[0].atm[i].resnum; nativeB[interface_contacts]=m[0].atm[j].resnum; interface_contacts++; d=crd(m,i,j); printf("NATIVE: %d%s %d%s %f\n",m[0].atm[i].resnum,m[0].atm[i].chain,m[0].atm[j].resnum,m[0].atm[j].chain,sqrt(d)); /*contacts[current_res_i][current_res_j]=1; contacts[current_res_j][current_res_i]=1;*/ //res_contacts[get_res(m[0].atm[i].residue)][get_res(m[0].atm[j].residue)]++; //tot_res_contacts++; } /*dist[current_res_i][current_res_j]=d; dist[current_res_j][current_res_i]=d;*/ } current_res_j++; } } current_res_i++; } } //chain_name=m[0].atm[m[0].CA_ref[i]].chain[0]; } error2=read_molecules(model,set); if(error2==0) { residues2=model[0].residues; /* contacts2 = malloc(residues2*sizeof(int *)); for(i=0;i5 && if(strcmp(model[0].atm[j].chain,model[0].atm[i].chain)!=0) { //printf("HEJ %d %d %d %d %f %f\n",current_res_j,current_res_i,i,j,crd(m,i,j),crd(m,j,i)); //d=crd(m,i,j); //printf("%d %d %d %d %s %s %f\n",model[0].atm[j].resnum,model[0].atm[i].resnum,i,j,model[0].atm[j].chain,model[0].atm[i].chain,d); //d=crd(model,i,j); //printf("ALLMODEL: %d%s %d%s %f %d %d\n",model[0].atm[i].resnum,model[0].atm[i].chain,model[0].atm[j].resnum,model[0].atm[j].chain,sqrt(d),current_res_i,current_res_j); chainA2=model[0].atm[i].chain[0]; chainB2=model[0].atm[j].chain[0]; if(/*contacts2[current_res_i][current_res_j]==0 &&*/ crd(model,i,j)<=cutoff) { //printf("%d %d %d %d %d %d %d\n", residues2,model[0].atm[i].resnum,model[0].atm[j].resnum,model[0].atm[i].rescount,model[0].atm[j].rescount,current_res_i,current_res_j); modelA[interface_contacts_model]=model[0].atm[i].resnum; modelB[interface_contacts_model]=model[0].atm[j].resnum; interface_contacts_model++; if(verbose) { d=crd(model,i,j); printf("MODEL: %d%s %d%s %f %d %d\n",model[0].atm[i].resnum,model[0].atm[i].chain,model[0].atm[j].resnum,model[0].atm[j].chain,sqrt(d),current_res_i,current_res_j); } /*contacts2[current_res_i][current_res_j]=1; contacts2[current_res_j][current_res_i]=1;*/ //res_contacts[get_res(model[0].atm[i].residue)][get_res(model[0].atm[j].residue)]++; //tot_res_contacts++; } } current_res_j++; } } current_res_i++; } } //chain_name=model[0].atm[model[0].CA_ref[i]].chain[0]; } int matches=0; if(chainA!= chainA2 || chainB != chainB2) { fprintf(stderr,"chain mismatch %c %c %c %c",chainA,chainA2,chainB,chainB2); } else { // find matches in nativeA-nativeB modelA-modelB for(i=0;i