예제 #1
0
int main(int argc, char *argv[])
{  FILE *pdb_fp, *fp;
   PROT prot;
 
   
   db_open();
   if (get_env()) {
      printf("   This program needs run.prm in working directory.\n");
      return USERERR;
   }

   if (argc < 2) {
      printf("surfmcce mcce_pdb_file\n");
      return 0;
   }

   /* load parameters */
   if ((fp=fopen(env.new_tpl, "r"))) {
      fclose(fp);
      load_param(env.new_tpl);
      printf("%s loaded.\n",env.new_tpl);
   }
   if (strlen(env.param)) {
      if (load_all_param(env.param)) {
         printf("   Can't load parameter files in %s\n",env.param);
         return USERERR;
      }
   }
   
   /* load pdb */
   if ((pdb_fp=fopen(argv[1], "r"))) {
      prot = load_pdb(pdb_fp);
      fclose(pdb_fp);
      if (prot.n_res == 0) {
         printf("   Fail to load pdb file: %s\n",STEP2_OUT);
         return USERERR;
      }
   }
   else {
      printf("   Specified PDB file \"%s\" was not found\n",argv[1]);
      return USERERR;
   }
   
   surfw(prot, 1.4);
   print_surfw(prot);
   
   return 0;
}
예제 #2
0
int get_scored_atoms(PROT prot, IPECE *ipece)
{
    int i_res, i_conf, i_atom;
    int exp_dist_ngrid;  /* number of grids to be searched for surface, see the description in the later code */
    
    /* initialize scored atom list */
    ipece->n_scored_atom = 0;
    
    /* convert surface_exp_dist to exp_dist_ngrid */
    exp_dist_ngrid = (int)(ipece->surface_exp_dist/ipece->grid_space + 0.5);
    
    surfw(prot, PROBE_RADIUS);
    
    for (i_res=0; i_res<prot.n_res; i_res++) {
        /* only score one sidechain conformer */
        int n_conf = 2;
        if (prot.res[i_res].n_conf<n_conf)
            n_conf=prot.res[i_res].n_conf;
        for (i_conf=0; i_conf<n_conf; i_conf++) {
            for (i_atom=0; i_atom<prot.res[i_res].conf[i_conf].n_atom; i_atom++) {
                float score;
                ATOM *atom_p;
                atom_p = &prot.res[i_res].conf[i_conf].atom[i_atom];
                if (!atom_p->on) continue;
                
                if ( !param_get("IPECE_SC",prot.res[i_res].resName, atom_p->name, &score) ) {
                    /* only put the atom into the score list if it is within
                    surface_exp_dist to the solvent. this condition is added for
                    the outer membrane proteins, such as porin, where there are
                    many exposed ionizable residues in the transmembrane region
                    facing the pore side. These residues will not contribute to
                    the score if the protein is aligned in the right orientation */
                    
                    INT_VECT atom_grid;
                    atom_grid = coor2grid(atom_p->xyz, ipece);
                    int added = 0;  /* flag to indicate whether atom_p has been added to the scored atom list */
                    INT_VECT probe_grid;
                    for (probe_grid.x = atom_grid.x-exp_dist_ngrid;
                    probe_grid.x <= atom_grid.x+exp_dist_ngrid;
                    probe_grid.x++) {
                        for (probe_grid.y = atom_grid.y-exp_dist_ngrid;
                        probe_grid.y <= atom_grid.y+exp_dist_ngrid;
                        probe_grid.y++) {
                            for (probe_grid.z = atom_grid.z-exp_dist_ngrid;
                            probe_grid.z <= atom_grid.z+exp_dist_ngrid;
                            probe_grid.z++) {
                                if ( *reach_label(probe_grid, ipece) == 's' ||
                                *reach_label(probe_grid, ipece) == 'o' ) {
                                    ipece->n_scored_atom++;
                                    
                                    ipece->scored_atoms = (ATOM **) realloc(ipece->scored_atoms, ipece->n_scored_atom*sizeof(ATOM *));
                                    ipece->scored_atoms[ipece->n_scored_atom-1] = (ATOM *) malloc(sizeof(ATOM));
                                    memcpy(ipece->scored_atoms[ipece->n_scored_atom-1], atom_p, sizeof(ATOM));
                                    
                                    ipece->atom_scores = (float *) realloc(ipece->atom_scores, ipece->n_scored_atom*sizeof(float));
                                    ipece->atom_scores[ipece->n_scored_atom-1] = score*atom_p->sas;
                                    
                                    added = 1;
                                    break;
                                }
                            }
                            if (added) break;
                        }
                        if (added) break;
                    }
                }
                else
                    continue;
            }
        }
    }
    
    /*
    int ia;
    printf("    List of atoms being scored:\n");
    for (ia=0; ia<ipece->n_scored_atom; ia++) {
        printf("%s acc=%8.3f\n",
        ipece->scored_atoms[ia]->name,ipece->scored_atoms[ia]->sas);
    }
    */
    return 0;
}