Пример #1
0
LONGMATRIX *new_longmatrix( long nrh, long nch)





{





LONGMATRIX *m;





		  m=(LONGMATRIX *)malloc(sizeof(LONGMATRIX));


		  if (!m) t_error("allocation failure in LONGMATRIX()");


		  


		  m->isdynamic=isDynamic;


		  m->nrl=NL;


		  m->nrh=nrh;


          m->ncl=NL;


		  m->nch=nch;


		  m->co=lmatrix(1,nrh,1,nch);


		  return m;


}
Пример #2
0
void head_to_tail(long j, long *npair_per_helix, long **bs_1, long **bs_2,
                  long *nregions,long **sub_helix1,long **sub_helix2) 
/* Account only the real anti-parrellel helix from the longer  helix.*/
{
    long i, n, m, k, nh, **helix, nregion;

    n = npair_per_helix[j];
    helix = lmatrix(1, n , 1, 2);
    
    nh=1;    
    nregion = 1;    
    for(i=1; i<=n; i++){  /* get the anti-parrellel helix region */
        helix[nregion][1] = i;
        for(i++;(i<=n)&&
                ((bs_1[j][i] == bs_1[j][i-1]+1)
                 &&(bs_2[j][i] == bs_2[j][i-1]-1))
                ||((bs_2[j][i] == bs_2[j][i-1]+1)
                   &&(bs_1[j][i] == bs_1[j][i-1]-1))
                ; i++){  
            helix[nregion][2] = i;
        }
        i--;        
        if(helix[nregion][2] - helix[nregion][1] >= 1){ /* minimum two pairs */
            nregion++;
        }        
    }
 
	/* NOTE: each nregions[j] is the real anti-parrallel helix in the longer
	helix determined by geometry. 
	*/
    nregions[j] = nregion -1;    
    for(m=1; m<=nregions[j]; m++){
        sub_helix1[j][m] = nh;
        for(k = helix[m][1]; k<=helix[m][2]; k++){
            bs_1[j][nh]=bs_1[j][k];
            bs_2[j][nh]=bs_2[j][k];
            nh++;
        }
        sub_helix2[j][m] = nh-1;
    }
    
    npair_per_helix[j]=nh-1;
    free_lmatrix(helix, 1, n, 1, 2);
}