MorphoGraphX  2.0-1-227
DataAnalyzer.hpp
Go to the documentation of this file.
1 //
2 // This file is part of 3DCellAtlas.
3 // Copyright (C) 2015 George W. Bassel and collaborators.
4 //
5 // If you use 3DCellAtlas in your work, please cite:
6 // http://dx.doi.org/10.1105/tpc.15.00175
7 //
8 // 3DCellAtlas is an AddOn for MorphoGraphX - http://www.MorphoGraphX.org
9 // Copyright (C) 2012-2015 Richard S. Smith and collaborators.
10 //
11 // 3DCellAtlas and MorphoGraphX are free software, and are licensed under under the terms of the
12 // GNU General (GPL) Public License version 2.0, http://www.gnu.org/licenses.
13 //
14 #ifndef DataAnalyzer_H
15 #define DataAnalyzer_H
16 
17 //#include "Geometry.hpp"
18 #include <math.h>
19 #include "Progress.hpp"
20 
21 #include "Geometry.hpp"
22 #include "Types.hpp"
23 
24 #include <stdio.h>
25 #include <cstdlib>
26 #include <iostream>
27 #include <string.h>
28 #include <fstream>
29 #include <dirent.h>
30 
31 using namespace std;
32 
33 namespace mgx {
34 //namespace process {
35 
36 //using util::Vector;
37 
38 
40 {
41  int cellType;
43  double ratio, upper, lower;
44 
45  int measure;
46 };
47 
49 {
51  int cellType;
53  double radial;
54  double lenLong, lenRad, lenCirc;
55  double wallArea, cellVol;
56 
57  double GUS;
58  double GUSUpper;
59  double GUSLower;
60 
61  QString file;
62 };
63 
65 {
66  int cellType;
68  double facLong, facRad, facCirc;
69 };
70 
71 typedef std::vector<SortResultData> SortResultVector;
72 typedef std::vector<SortResultVector> SortResultVectorAll;
73 typedef std::vector<FileDataType> FileDataVector;
74 typedef std::vector<FileEFactorDataType> FileEFactorDataVector;
76 typedef std::vector<Vec2i> tagTypeVector;
77 typedef std::map<int, FileDataVector> tagDataMap;
78 typedef std::vector<QString> FilenameVector;
79 
81 {
82 
83 public:
84  // global variables
85  // X is always treatment and Y control
86  bool perCellAvg;
87 
88  // possible tags (cell type, assoc cort cell)
90 
91  // maps tags (celltype*100 + acc) to the data from the file data = [cell#, type, acc, [data columns], file]
92  tagDataMap dataX, dataY;
93 
94  // vector with all filenames
96 
97  // data structure for the efactors
99 
100  // data structure for the sorted results
102 
103  bool saveEFactors(FileEFactorDataVector eFData, tagDataMap data, tagTypeVector tagTypes, FilenameVector filenames, QString folderOut);
104 
105  bool calcEFactors(SortResultVectorAll sortResVec, bool avg, int window, tagTypeVector tagTypes, FileEFactorDataVector& eFData);
106 
107  bool logRatio(double& ratio, double& upper, double& lower);
108 
109  bool sortData(tagDataMap data1, tagDataMap data2, tagTypeVector tagTypes);
110 
111  bool logRatio(double& ratio, double& upper, double& lower, std::vector<double> dataX, std::vector<double> dataY);
112 
113  bool analyze(QString folderX, QString folderY, QString folderOut, bool treatment, bool avg, int window, bool perCell);
114 
115  bool readCellData(QString folder, tagDataMap& tagData, tagTypeVector& tagTypes, FilenameVector& filenames);
116 
117  //double t005(double df);
118 
119  bool smoothAnalyzed(SortResultVectorAll& sortResVec, double window, tagTypeVector tagTypes);
120 
121  bool joinData(SortResultVectorAll sortResVec, tagDataMap data, tagTypeVector tagTypes, FilenameVector& filenames, QString folderOut);
122 
123  //double tIntervalB(double t, std::vector<double> x, std::vector<double> y);
124 
125  bool analyzeGUS(QString folderInput, /*QString folderOut, */QString gusFileExt, bool mergeBool, QString fileToMerge, bool avg, int window, QString upperFilter, double upperFilterValue, QString lowerFilter, double lowerFilterValue, IntDoubleMap& GUSInfo);
126 
127 private:
128 
129 };
130 //}
131 }
132 
133 #endif
134 
mgx::DataAnalyzer::efData
FileEFactorDataVector efData
Definition: DataAnalyzer.hpp:98
mgx::DataAnalyzer::filenamesY
FilenameVector filenamesY
Definition: DataAnalyzer.hpp:95
mgx::FileDataType::GUSUpper
double GUSUpper
Definition: DataAnalyzer.hpp:58
mgx::IntDoubleMap
std::unordered_map< int, double > IntDoubleMap
Map of an integer to a double.
Definition: Types.hpp:55
mgx::SortResultData::upper
double upper
Definition: DataAnalyzer.hpp:43
mgx::SortResultData
Definition: DataAnalyzer.hpp:39
mgx::DataAnalyzer::perCellAvg
bool perCellAvg
Definition: DataAnalyzer.hpp:86
mgx::Vec2i
Vector< 2, int > Vec2i
Definition: DataAnalyzer.hpp:75
mgx::tagTypeVector
std::vector< Vec2i > tagTypeVector
Definition: DataAnalyzer.hpp:76
Geometry.hpp
mgx
Distributed matrix library.
Definition: Assert.hpp:26
mgx::SortResultData::cellType
int cellType
Definition: DataAnalyzer.hpp:41
mgx::DataAnalyzer::resVecAll
SortResultVectorAll resVecAll
Definition: DataAnalyzer.hpp:101
mgx::FileDataType::GUSLower
double GUSLower
Definition: DataAnalyzer.hpp:59
mgx::FileDataType::cellType
int cellType
Definition: DataAnalyzer.hpp:51
mgx::FileEFactorDataType::asocCortCell
int asocCortCell
Definition: DataAnalyzer.hpp:67
mgx::FileDataType::cellNumber
int cellNumber
Definition: DataAnalyzer.hpp:50
mgx::FileDataType::wallArea
double wallArea
Definition: DataAnalyzer.hpp:55
mgx::SortResultData::asocCortCell
int asocCortCell
Definition: DataAnalyzer.hpp:42
mgx::FileEFactorDataType
Definition: DataAnalyzer.hpp:64
Progress.hpp
mgx::FileDataType::lenRad
double lenRad
Definition: DataAnalyzer.hpp:54
mgx::FileDataType::GUS
double GUS
Definition: DataAnalyzer.hpp:57
mgx::FileDataType
Definition: DataAnalyzer.hpp:48
mgx::SortResultData::measure
int measure
Definition: DataAnalyzer.hpp:45
mgx::tagDataMap
std::map< int, FileDataVector > tagDataMap
Definition: DataAnalyzer.hpp:77
mgx::FileDataType::radial
double radial
Definition: DataAnalyzer.hpp:53
mgx::Vector< 2, int >
mgx::FilenameVector
std::vector< QString > FilenameVector
Definition: DataAnalyzer.hpp:78
mgx::SortResultVectorAll
std::vector< SortResultVector > SortResultVectorAll
Definition: DataAnalyzer.hpp:72
mgx::FileEFactorDataType::facRad
double facRad
Definition: DataAnalyzer.hpp:68
Types.hpp
mgx::FileDataType::asocCortCell
int asocCortCell
Definition: DataAnalyzer.hpp:52
mgx::FileDataVector
std::vector< FileDataType > FileDataVector
Definition: DataAnalyzer.hpp:73
mgx::DataAnalyzer::tagTypesY
tagTypeVector tagTypesY
Definition: DataAnalyzer.hpp:89
mgx::DataAnalyzer
Definition: DataAnalyzer.hpp:80
mgx::SortResultVector
std::vector< SortResultData > SortResultVector
Definition: DataAnalyzer.hpp:71
mgx::DataAnalyzer::dataY
tagDataMap dataY
Definition: DataAnalyzer.hpp:92
mgx::FileDataType::file
QString file
Definition: DataAnalyzer.hpp:61
mgx::FileEFactorDataVector
std::vector< FileEFactorDataType > FileEFactorDataVector
Definition: DataAnalyzer.hpp:74
mgx::FileEFactorDataType::cellType
int cellType
Definition: DataAnalyzer.hpp:66