-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparsefile.cpp
More file actions
57 lines (48 loc) · 1.54 KB
/
parsefile.cpp
File metadata and controls
57 lines (48 loc) · 1.54 KB
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
#include "parsefile.h"
parsefile::parsefile()
{
}
int parsefile::readFiles(std::string expressionFile, std::string spatialFile, std::string geneNameFile){
// read beams and spatial information into parsing object
spatial = parsing();
try {
std::cout << "[Progress] Reading spatial data ..." << std::endl;
spatial.readBeamFileCSV(spatialFile);
} catch(...) {
std::cerr << "[Error] Reading spatial data failed ..." << std::endl;
return 1;
}
// read expression matrix
expression_raw = parsemtx();
try {
std::cout << "[Progress] Reading expression matrix ..." << std::endl;
expression_raw.readFile(expressionFile);
std::cout << "[Progress] Finished reading expression matrix" << std::endl;
} catch(...) {
std::cerr << "[Error] Reading expression matrix failed ..." << std::endl;
return 2;
}
// read gene name file
try {
std::cout << "[Progress] Reading gene names file ..." << std::endl;
geneNamePath = geneNameFile;
geneNames = listgene(geneNameFile);
} catch(...) {
std::cerr << "[Error] Reading gene names file failed ..." << std::endl;
return 3;
}
std::cout << "[Progress] File reading finished successfully ..." << std::endl;
return 0;
}
parsemtx parsefile::getExpression(){
return expression_raw;
}
parsing parsefile::getSpatial(){
return spatial;
}
std::vector<std::string> parsefile::getGenes(){
return geneNames;
}
std::string parsefile::getGenePath(){
return geneNamePath;
}