/* ===========================================================================
*
*                            PUBLIC DOMAIN NOTICE
*               National Center for Biotechnology Information
*
*  This software/database is a "United States Government Work" under the
*  terms of the United States Copyright Act.  It was written as part of
*  the author's official duties as a United States Government employee and
*  thus cannot be copyrighted.  This software/database is freely available
*  to the public for use. The National Library of Medicine and the U.S.
*  Government have not placed any restriction on its use or reproduction.
*
*  Although all reasonable efforts have been taken to ensure the accuracy
*  and reliability of the software and data, the NLM and the U.S.
*  Government do not and cannot warrant the performance or results that
*  may be obtained by using this software or data. The NLM and the U.S.
*  Government disclaim all warranties, express or implied, including
*  warranties of performance, merchantability or fitness for any particular
*  purpose.
*
*  Please cite the author in any work or product based on this material.
*
* ===========================================================================*/
#ifndef __BLAST_HITLIST__
#define __BLAST_HITLIST__
#ifdef __cplusplus
extern "C" {
#endif

typedef PoolBlkPtr	BLAST_HLPoolPtr;

typedef struct _blast_hitlist_pdata {
		BLAST_HLPoolPtr		hitlist_pool;
		BLAST_HSPPoolPtr	hsp_pool;
		BLAST_VScorePoolPtr	vscore_pool;
		BLAST_StrPoolPtr	str_pool;
	} BLAST_HitListPData, PNTR BLAST_HitListPDataPtr;

typedef struct _blast_hitlist {
		struct _blast_hitlist	PNTR next;
		BLAST_HSPPtr	PNTR hpp; /* points to member of hplist[] */
		int				hpclass;
		BLAST_HSPPtr	hplist[2];
		BLAST_HSPPtr	best_hsp;	/* p-value of most significant HSP in the list */
		VScorePtr		vsp;
		BLAST_HitListPData	pdata;
		BLAST_Str		str1, str2;
		ValNode			user;
	} BLAST_HitList, PNTR BLAST_HitListPtr;


BLAST_HitListPtr LIBCALL BlastHitListSave PROTO((BLAST_HitListPtr));
BLAST_HitListPDataPtr LIBCALL BlastHitListPDataNew PROTO((size_t cnt));
void LIBCALL BlastHitListPDataDestruct PROTO((BLAST_HitListPDataPtr));

BLAST_HitListPtr LIBCALL BlastHitListGet PROTO((BLAST_HitListPDataPtr));
void LIBCALL BlastHitListPut PROTO((BLAST_HitListPtr));

int LIBCALL BlastHitListCount PROTO((BLAST_HitListPtr));
void LIBCALL BlastHitListTruncate PROTO((BLAST_HitListPtr PNTR hlp, int cnt, void (*func)(), VoidPtr arg1));
void LIBCALL BlastHitListHSPPutAll PROTO((BLAST_HitListPtr));
void LIBCALL BlastHitListTruncateByEValue PROTO((BLAST_HitListPtr hlp, double cutoff));
void LIBCALL BlastHitListTruncateByCutoff PROTO((BLAST_HitListPtr hlp, int which, double cutoff));
void LIBCALL BlastHitListPruneByCutoff PROTO((BLAST_HitListPtr hlp, int which, double cutoff));
void LIBCALL BlastHitListPruneLinksByCutoff PROTO((BLAST_HitListPtr hlp, int which, double cutoff));
BLAST_HSPPtr LIBCALL BlastHitListHSPHighestNormScore PROTO((BLAST_HitListPtr));
BLAST_HSPPtr LIBCALL BlastHitListHSPStrandHighestNormScore PROTO((BLAST_HitListPtr));

BLAST_HitListPtr LIBCALL BlastHLPoolSave PROTO((BLAST_HitListPtr PNTR,BLAST_HLPoolPtr,BLAST_HitListPtr));


BLAST_HLPoolPtr LIBCALL BlastHLPoolNew PROTO((size_t cnt));
void LIBCALL BlastHLPoolInit PROTO((BLAST_HLPoolPtr));
void LIBCALL BlastHLPoolDestruct PROTO((BLAST_HLPoolPtr));
BLAST_HitListPtr LIBCALL BlastHLPoolGet PROTO((BLAST_HLPoolPtr));
void LIBCALL BlastHLPoolPut PROTO((BLAST_HLPoolPtr, BLAST_HitListPtr));
void LIBCALL BlastHLPoolPutLink PROTO((BLAST_HLPoolPtr, BLAST_HitListPtr PNTR));
void LIBCALL BlastHLPoolPutLinkApply PROTO((BLAST_HLPoolPtr, BLAST_HitListPtr PNTR, int (LIBCALLBACK *func)() ));

#ifdef __cplusplus
}
#endif
#endif /* !__BLAST_HITLIST__ */

