File: GraphExplorer.h

package info (click to toggle)
ray 2.3.1-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,008 kB
  • sloc: cpp: 49,973; sh: 339; makefile: 281; python: 168
file content (112 lines) | stat: -rw-r--r-- 2,963 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
 *  Ray -- Parallel genome assemblies for parallel DNA sequencing
 *  Copyright (C) 2013 Sébastien Boisvert
 *
 *  http://DeNovoAssembler.SourceForge.Net/
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, version 3 of the License.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You have received a copy of the GNU General Public License
 *  along with this program (gpl-3.0.txt).
 *  see <http://www.gnu.org/licenses/>
 */

#ifndef GraphExplorer_header
#define GraphExplorer_header

#include "AttributeFetcher.h"
#include "AnnotationFetcher.h"
#include "GraphSearchResult.h"

#include <code/Mock/Parameters.h>
#include <code/Mock/Parameters.h>

#include <RayPlatform/core/ComputeCore.h>
#include <RayPlatform/communication/VirtualCommunicator.h>

#include <stack>
using namespace std;

#define EXPLORER_LEFT 0x89
#define EXPLORER_RIGHT 0x452

/**
 * This class is an explorer to find paths leading to new paths.
 *
 * \author Sébastien Boisvert
 */
class GraphExplorer {

	int m_searchDepthForFirstResult;
	bool m_debug;
	vector<GraphSearchResult> m_searchResults;

	stack<Kmer> m_verticesToVisit;
	stack<int> m_depths;

	int m_maximumVisitedDepth;

	AnnotationFetcher m_annotationFetcher;
	AnnotationFetcher m_annotationFetcherReverse;
	AttributeFetcher m_attributeFetcher;

	WorkerHandle m_key;
	int m_direction;
	PathHandle m_seedName;

	map<Kmer, vector<Kmer> > m_parents;
	map<Kmer, int> m_vertexDepths;

	CoverageDepth m_coverage1;

	Kmer m_start;

	MessageTag RAY_MPI_TAG_GET_VERTEX_EDGES_COMPACT;
	MessageTag RAY_MPI_TAG_ASK_VERTEX_PATHS_SIZE;
	MessageTag RAY_MPI_TAG_ASK_VERTEX_PATH;

	bool m_haveAttributes;
	bool m_haveAnnotations;
	bool m_haveAnnotationsReverse;

	bool m_stopAtFirstHit;
	bool m_done;
	int m_maximumDepth;

	VirtualCommunicator * m_virtualCommunicator;
	Parameters * m_parameters;
	int m_maximumVisitedVertices;
	int m_visitedVertices;
	RingAllocator*m_outboxAllocator;
	GraphPath * m_seed;

	bool backtrackPath(vector<Kmer> * path, Kmer * vertex);
	bool getBestParent(Kmer * parent, Kmer kmer);
	bool processAnnotations(AnnotationFetcher & annotationFetcher, int currentDepth, Kmer & object);

public:
	void start(WorkerHandle worker, Kmer * start, GraphPath * seed, int direction, Parameters * parameters,
		VirtualCommunicator * virtualCommunicator,
		RingAllocator * outboxAllocator,
		MessageTag RAY_MPI_TAG_GET_VERTEX_EDGES_COMPACT,
		MessageTag RAY_MPI_TAG_ASK_VERTEX_PATHS_SIZE, MessageTag RAY_MPI_TAG_ASK_VERTEX_PATH,
		PathHandle seedName
	);

	bool work();

	vector<GraphSearchResult> & getSearchResults();

	bool isValid() const ;
};

#endif /* GraphExplorer_header */