/* $Id: 547222620ce73a2525ac7b7cb4b5e8971f2ed7d3 $ */
#ifndef KMER_SEARCH_INCLUDED
#define KMER_SEARCH_INCLUDED

#include "method.h"
#include "list.h"
#include "indexdb.h"
#include "iit-read-univ.h"
#include "ef64.h"
#include "transcriptome.h"
#include "compress.h"
#include "shortread.h"
#include "genomebits.h"
#include "indel.h"

#include "bool.h"
#include "pass.h"
#include "univdiag.h"
#include "stage1hr.h"
#include "mergeinfo.h"
#include "knownsplicing.h"
#include "knownindels.h"

#include "intlistpool.h"
#include "uintlistpool.h"
#include "univcoord.h"
#include "pathpool.h"
#include "transcriptpool.h"
#include "vectorpool.h"
#include "listpool.h"
#include "hitlistpool.h"
#include "spliceendsgen.h"


/* Does not take paired_end_p as a parameter.  ? Generates both sense and antisense */
extern int
Kmer_exact_univdiagonals (List_T *exact_univdiagonals_gplus, Intlist_T *exact_nunivdiagonals_gplus,
			  List_T *exact_univdiagonals_gminus, Intlist_T *exact_nunivdiagonals_gminus,
			  Stage1_T stage1, int querylength,
			  Listpool_T listpool, Intlistpool_T intlistpool);

extern void
Kmer_exact_paths (bool *any_imperfect_ends_p, int *found_score, bool *found_transcriptp,
		  List_T *sense_paths_gplus, List_T *sense_paths_gminus,
		  List_T *antisense_paths_gplus, List_T *antisense_paths_gminus,

		  List_T exact_univdiagonals_gplus, Intlist_T exact_nunivdiagonals_gplus,
		  List_T exact_univdiagonals_gminus, Intlist_T exact_nunivdiagonals_gminus,

		  Compress_T query_compress_fwd, Compress_T query_compress_rev,
		  Shortread_T queryseq, char *queryuc_ptr, char *queryrc, int querylength,
		  int genestrand, Intlistpool_T intlistpool, Uintlistpool_T uintlistpool,
		  Univcoordlistpool_T univcoordlistpool,
		  Listpool_T listpool, Pathpool_T pathpool, Vectorpool_T vectorpool,
		  Hitlistpool_T hitlistpool, Transcriptpool_T transcriptpool, Method_T method);

extern void
Kmer_search_approx (int *found_score, bool *found_transcriptp,
		    List_T *unsolved_sense_paths_gplus, List_T *unsolved_sense_paths_gminus,
		    List_T *unsolved_antisense_paths_gplus, List_T *unsolved_antisense_paths_gminus,

		    List_T *sense_paths_gplus, List_T *sense_paths_gminus,
		    List_T *antisense_paths_gplus, List_T *antisense_paths_gminus,
				
		    Compress_T query_compress_fwd, Compress_T query_compress_rev,
		    Shortread_T queryseq, int querylength,
		    Stage1_T stage1, Knownsplicing_T knownsplicing,
		    int genestrand, int max_insertionlen, int max_deletionlen, int max_gaplen, int sizelimit,

		    Intlistpool_T intlistpool, Uintlistpool_T uintlistpool,
		    Univcoordlistpool_T univcoordlistpool,
		    Listpool_T listpool, Pathpool_T pathpool, Vectorpool_T vectorpool,
		    Hitlistpool_T hitlistpool, Transcriptpool_T transcriptpool,
		    Method_T method);

extern void
Kmer_search_complete (int *found_score, bool *found_transcriptp,
		      List_T *unextended_sense_paths_gplus, List_T *unextended_sense_paths_gminus,
		      List_T *unextended_antisense_paths_gplus, List_T *unextended_antisense_paths_gminus,

		      List_T *sense_paths_gplus, List_T *sense_paths_gminus,
		      List_T *antisense_paths_gplus, List_T *antisense_paths_gminus,

		      Stage1_T stage1, Shortread_T queryseq, char *queryuc_ptr, char *queryrc,
		      int querylength, int genestrand, 

		      int streamspace_max_alloc, Univcoord_T *streamspace_alloc,
		      Univcoord_T **streamptr_alloc, int *streamsize_alloc, 

		      Mergeinfo_T mergeinfo, Indelinfo_T indelinfo, Spliceinfo_T spliceinfo,
		      Knownsplicing_T knownsplicing, Knownindels_T knownindels,

#ifdef LARGE_GENOMES
		      unsigned char **plus_stream_high_array, UINT4 **plus_stream_low_array,
		      unsigned char **minus_stream_high_array, UINT4 **minus_stream_low_array,
#else
		      Univcoord_T **plus_stream_array, Univcoord_T **minus_stream_array,
#endif
		      int *plus_streamsize_array, int *plus_diagterm_array,
		      int *minus_streamsize_array, int *minus_diagterm_array,

		      int *mismatch_positions_alloc, Univcoord_T *novel_diagonals_alloc, unsigned short *localdb_alloc,
		      
		      Compress_T query_compress_fwd, Compress_T query_compress_rev,
		      int max_insertionlen, int max_deletionlen,
		      Intlistpool_T intlistpool, Uintlistpool_T uintlistpool, Univcoordlistpool_T univcoordlistpool,
		      Listpool_T listpool, Pathpool_T pathpool,
		      Transcriptpool_T transcriptpool, Vectorpool_T vectorpool, Hitlistpool_T hitlistpool,
		      Spliceendsgen_T spliceendsgen, bool paired_end_p, bool first_read_p,
		      Method_T method, Pass_T pass);

extern void
Kmer_search_setup (int index1part_in, int index1interval_in,
		   Indexdb_T indexdb_in, EF64_T chromosome_ef64_in,
		   Genomebits_T genomebits_in, Genomebits_T genomebits_alt_in,
		   Univcoord_T genomelength_in, bool splicingp_in);
#endif
