/* ===========================================================================
*
*                            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_HSP__
#define __BLAST_HSP__
#ifdef __cplusplus
extern "C" {
#endif

typedef struct _blast_seg {
		BLAST_StrPtr	sp;
		int			frame;
		BLAST_Offset	offset;
		BLAST_Offset	len;
	} BLAST_Seg, PNTR BLAST_SegPtr;

typedef struct _consistn {
		unsigned long   qbeg, qend, sbeg, send;
		unsigned long   len;
		double  xscore, tot_score;
		unsigned    n;
		double	p, psave;
		Nlm_Boolean	flag;
	} ConsistData, PNTR ConsistDataPtr;


typedef struct _blast_hsp {
		struct _blast_hsp	PNTR next;
		BLAST_Seg	q_seg, /* query segment */
					s_seg; /* subject segment */
		unsigned long	len;
		BLAST_Score	score;
		BLAST_KarlinBlkPtr	kbp;
		BLAST_ScoreBlkPtr	sbp;
		double		evalue;
		unsigned	n; /* Poisson event count */
		double		xscore;
		double		sumscore; /* "Sum P" score */
		ConsistData	cd;
		int			class;
		double		pvalue;
		BLAST_VScoreType	etype;
		struct _blast_hitlist	PNTR hlp;
		VScorePtr	vsp;
		unsigned 	ordnum;
		struct _blast_hsp	PNTR fwdptr, PNTR revptr, PNTR hprel;
		struct _blast_wfcontext	PNTR wfcp;
		unsigned	context;
		signed char PNTR	script;
		ValNode		privat;
		ValNode		user;
	} BLAST_HSP, PNTR BLAST_HSPPtr;


typedef PoolBlkPtr	BLAST_HSPPoolPtr;


#define BLAST_HSPSCORE_PVALUE	1
#define BLAST_HSPSCORE_EVALUE	2


BLAST_HSPPoolPtr LIBCALL BlastHSPPoolNew PROTO((size_t cnt));
void LIBCALL BlastHSPPutLink PROTO((struct _blast_hitlist PNTR hlp));
void LIBCALL BlastHSPTruncate PROTO((struct _blast_hitlist PNTR hlp, int maxcnt));
void LIBCALL BlastHSPPoolDestruct PROTO((BLAST_HSPPoolPtr));

BLAST_HSPPtr LIBCALL BlastHSPSave PROTO((struct _blast_hitlist PNTR,BLAST_HSPPtr));
BLAST_HSPPtr LIBCALL BlastHSPGet PROTO((struct _blast_hitlist PNTR));
void LIBCALL BlastHSPPut PROTO((BLAST_HSPPtr));

void LIBCALL 		BlastHSPCopy PROTO((BLAST_HSPPtr to, BLAST_HSPPtr from));
BLAST_HSPPtr LIBCALL BlastHSPAppend PROTO((BLAST_HSPPtr to, BLAST_HSPPtr from));

size_t LIBCALL BlastHSPCount PROTO((BLAST_HSPPtr));
BLAST_Error LIBCALL BlastHSPNumber PROTO((BLAST_HSPPtr));
CharPtr LIBCALL BlastHSPLabel PROTO((BLAST_HSPPtr));
BLAST_Error LIBCALL BlastHSPLabelPutFile PROTO((BLAST_HSPPtr,FILE *));
BLAST_Error LIBCALL BlastHSPLabelPutString PROTO((BLAST_HSPPtr,CharPtr));

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

