~ubuntu-branches/ubuntu/precise/ncbi-tools6/precise

« back to all changes in this revision

Viewing changes to biostruc/cdd/cddposutil.c

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2005-03-27 12:00:15 UTC
  • mfrom: (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050327120015-embhesp32nj73p9r
Tags: 6.1.20041020-3
* Fix FTBFS under GCC 4.0 caused by inconsistent use of "static" on
  functions.  (Closes: #295110.)
* Add a watch file, now that we can.  (Upstream's layout needs version=3.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: cddposutil.c,v 1.15 2001/12/31 13:47:06 bauer Exp $
 
1
/* $Id: cddposutil.c,v 1.18 2004/03/31 17:58:51 papadopo Exp $
2
2
*===========================================================================
3
3
*
4
4
*                            PUBLIC DOMAIN NOTICE
29
29
*
30
30
* Initial Version Creation Date: 12/21/1999
31
31
*
32
 
* $Revision: 1.15 $
 
32
* $Revision: 1.18 $
33
33
*
34
34
* File Description: CDD utilities involving position-specific scoring 
35
35
*                   matrices (PSSMs)
37
37
* Modifications:
38
38
* --------------------------------------------------------------------------
39
39
* $Log: cddposutil.c,v $
 
40
* Revision 1.18  2004/03/31 17:58:51  papadopo
 
41
* Mike Gertz' changes for length adjustment calculations
 
42
*
 
43
* Revision 1.17  2004/01/22 15:43:57  bauer
 
44
* call BlastCalculateEffectiveLengths in CddSetUpSearchInternalByLoc
 
45
*
 
46
* Revision 1.16  2003/05/29 13:17:56  thiessen
 
47
* fix memory leak in CddposFreeMemory()
 
48
*
40
49
* Revision 1.15  2001/12/31 13:47:06  bauer
41
50
* made block_width a local variable in CddSetUpSearchInternalByLoc to deal with changes in blast data structures
42
51
*
271
280
  MemFree(posSearch->posRowSigma);
272
281
  MemFree(posSearch->posInformation);
273
282
  MemFree(posSearch->posUseSequences);
 
283
  MemFree(posSearch->posGaplessColumnWeights);
274
284
}
275
285
 
276
286
 
1703
1713
        */
1704
1714
        if (retval)
1705
1715
                return retval;
1706
 
 
1707
 
 
1708
 
        if (search->pbp->gapped_calculation &&
1709
 
                StringCmp(search->prog_name, "blastn") != 0)
1710
 
                min_query_length = 1/(search->sbp->kbp_gap_std[search->first_context]->K);
1711
 
        else
1712
 
                min_query_length = 1/(search->sbp->kbp[search->first_context]->K);
1713
 
 
1714
 
        last_length_adjustment = 0;
1715
 
        for (index=0; index<5; index++)
1716
 
        {
1717
 
                length_adjustment = ((search->sbp->kbp[search->first_context]->logK)+log((Nlm_FloatHi)(length-last_length_adjustment)*(Nlm_FloatHi)(MAX(1, (search->dblen)-(search->dbseq_num*last_length_adjustment)))))/(search->sbp->kbp[search->first_context]->H);
1718
 
                if (length_adjustment >= length-min_query_length)
1719
 
                {
1720
 
                        length_adjustment = length-min_query_length;
1721
 
                        break;
1722
 
                }
1723
 
        
1724
 
                if (ABS(last_length_adjustment-length_adjustment) <= 1)
1725
 
                        break;
1726
 
                last_length_adjustment = length_adjustment;
1727
 
        }
1728
 
        search->length_adjustment = MAX(length_adjustment, 0);
1729
 
 
1730
 
        search->dblen_eff = MAX(1, search->dblen - search->dbseq_num*search->length_adjustment);
1731
 
        effective_query_length = MAX(length - search->length_adjustment, min_query_length);
1732
 
        
1733
 
        for (index=search->first_context; index<=search->last_context; index++)
1734
 
        {
1735
 
                search->context[index].query->effective_length = effective_query_length;
1736
 
        }
1737
 
 
1738
 
        if (search->searchsp_eff == 0)
1739
 
                search->searchsp_eff = ((Nlm_FloatHi) search->dblen_eff)*((Nlm_FloatHi) effective_query_length);
 
1716
        if( 0 != BlastComputeLengthAdjustment(1/min_query_length,
 
1717
                                         search->sbp->
 
1718
                                         kbp[search->first_context]->logK,
 
1719
                                         1/search->sbp->
 
1720
                                         kbp[search->first_context]->H,
 
1721
                                         0.0, 
 
1722
                                         length,
 
1723
                                         search->dblen, search->dbseq_num,
 
1724
                                         &length_adjustment) ) {
 
1725
            ErrPostEx(SEV_WARNING, 0, 0,
 
1726
                      "BlastComputeLengthAdjustment failed!");
 
1727
        }
 
1728
        search->length_adjustment = length_adjustment;
 
1729
        search->dblen_eff =
 
1730
            search->dblen - search->dbseq_num*search->length_adjustment;
 
1731
 
 
1732
        effective_query_length    = length - length_adjustment;
 
1733
        for (index=search->first_context; index<=search->last_context; index++)
 
1734
        {
 
1735
            search->context[index].query->effective_length =
 
1736
                effective_query_length;
 
1737
        }
 
1738
 
 
1739
        if (search->searchsp_eff == 0)
 
1740
            search->searchsp_eff =
 
1741
                ((Nlm_FloatHi) search->dblen_eff)*
 
1742
                ((Nlm_FloatHi) effective_query_length);
1740
1743
 
1741
1744
        /* The default is that cutoff_s was not set and is zero. */
1742
1745
        if (options->cutoff_s == 0)