hmmer-3.3/easel/esl_msaweight.c
/* consensus_by_all()
 * Use counts from all sequences to determine consensus.
 * 
 * If we weren't able to define a consensus before collecting observed
 * counts in just those columns, then we had to collect observed
 * counts on all columns, and now we define the consensus.
 * 
 * Because we do this from counts, not the MSA, <msa> here is only
 * used for dimensions <alen> and <Kp>.
 * 
 * Returns <eslOK> on success.
 *
 * Obscure C note: <ct> is input only here, so it might look like 
 * you can declare it <const int **ct>, but don't. <const> syntax
 * is arcane and confusing with double indirection. 
 */
consensus_by_all()
Use counts from all sequences to determine consensus.

If we weren't able to define a consensus before collecting observed
counts in just those columns, then we had to collect observed
counts on all columns, and now we define the consensus.

Because we do this from counts, not the MSA,  here is only
used for dimensions  and .

Returns  on success.

Obscure C note:  is input only here, so it might look like
you can declare it , but don't.  syntax
is arcane and confusing with double indirection.
consensus_by_all () Use counts from all sequences to determine consensus . If we weren ' t able to define a consensus before collecting observed counts in just those columns then we had to collect observed counts on all columns and now we define the consensus . Because we do this from counts not the MSA here is only used for dimensions and . Returns on success . Obscure C note : is input only here so it might look like you can declare it but don ' t . syntax is arcane and confusing with double indirection .
static int
consensus_by_all(const ESL_MSAWEIGHT_CFG *cfg, const ESL_MSA *msa, int **ct, int *conscols, int *ret_ncons, ESL_MSAWEIGHT_DAT *dat)
{
  float symfrac = (cfg? cfg->symfrac : eslMSAWEIGHT_SYMFRAC);
  int   ncons   = 0;
  int   apos;
  int   tot;
  int   a;
  for (apos = 1; apos <= msa->alen; apos++)
    {
      tot = 0;
      for (a = 0; a < msa->abc->Kp-2; a++)  
	tot += ct[apos][a];
      if ( ((float) ct[apos][msa->abc->K] / (float) tot) < symfrac)
	conscols[ncons++] = apos;
    }      
  if (dat) dat->cons_by_all = TRUE;
  *ret_ncons = ncons;
  return eslOK;
}
static int consensus_by_all ( const ESL_MSAWEIGHT_CFG * cfg , const ESL_MSA * msa , int * * ct , int * conscols , int * ret_ncons , ESL_MSAWEIGHT_DAT * dat ) { float symfrac = ( cfg ? cfg -> symfrac : eslMSAWEIGHT_SYMFRAC ) ; int ncons = 0 ; int apos ; int tot ; int a ; for ( apos = 1 ; apos <= msa -> alen ; apos ++ ) { tot = 0 ; for ( a = 0 ; a < msa -> abc -> Kp - 2 ; a ++ ) tot += ct [ apos ] [ a ] ; if ( ( ( float ) ct [ apos ] [ msa -> abc -> K ] / ( float ) tot ) < symfrac ) conscols [ ncons ++ ] = apos ; } if ( dat ) dat -> cons_by_all = TRUE ; * ret_ncons = ncons ; return eslOK ; }
consensus_by_all()
 Use counts from all sequences to determine consensus.
consensus_by_all () Use counts from all sequences to determine consensus .
// i.e. over esl_abc_XIsResidue() || esl_abc_XIsGap()