Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
150
Issues
150
List
Board
Labels
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
eac6ceb5
Commit
eac6ceb5
authored
Mar 29, 2019
by
Quentin Lobbé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring Phylo.hs
parent
c35221a6
Pipeline
#312
failed with stage
Changes
9
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
169 additions
and
135 deletions
+169
-135
Phylo.hs
src/Gargantext/Viz/Phylo.hs
+70
-56
Cluster.hs
src/Gargantext/Viz/Phylo/Aggregates/Cluster.hs
+3
-3
BranchMaker.hs
src/Gargantext/Viz/Phylo/BranchMaker.hs
+5
-5
Example.hs
src/Gargantext/Viz/Phylo/Example.hs
+26
-24
LevelMaker.hs
src/Gargantext/Viz/Phylo/LevelMaker.hs
+7
-7
LinkMaker.hs
src/Gargantext/Viz/Phylo/LinkMaker.hs
+7
-7
Tools.hs
src/Gargantext/Viz/Phylo/Tools.hs
+36
-22
Filters.hs
src/Gargantext/Viz/Phylo/View/Filters.hs
+8
-4
ViewMaker.hs
src/Gargantext/Viz/Phylo/View/ViewMaker.hs
+7
-7
No files found.
src/Gargantext/Viz/Phylo.hs
View file @
eac6ceb5
...
...
@@ -43,21 +43,6 @@ import Gargantext.Core.Utils.Prefix (unPrefix)
import
Gargantext.Prelude
------------------------------------------------------------------------
data
PhyloQuery
=
PhyloQuery
{
_phyloQuery_phyloName
::
Text
,
_phyloQuery_phyloDescription
::
Text
,
_phyloQuery_timeGrain
::
Int
,
_phyloQuery_timeSteps
::
Int
,
_phyloQuery_fstCluster
::
Clustering
,
_phyloQuery_timeMatching
::
Proximity
,
_phyloQuery_nthLevel
::
Level
,
_phyloQuery_nthCluster
::
Clustering
}
deriving
(
Show
)
data
PhyloExport
=
PhyloExport
{
_phyloExport_param
::
PhyloParam
,
_phyloExport_data
::
Phylo
...
...
@@ -201,21 +186,53 @@ data PhyloError = LevelDoesNotExist
deriving
(
Show
)
-- | A List of Proximity methods names
data
ProximityName
=
WeightedLogJaccard
|
Hamming
|
Filiation
deriving
(
Show
)
-- | A List of Clustering methods names
data
ClusteringName
=
Louvain
|
RelatedComponents
|
FrequentItemSet
deriving
(
Show
)
------------------------------------------------------------------------
-- | To create a Phylo | --
-- | PhyloQuery | --
-- | A PhyloQuery is the structured representation of a user query to create a Phylo
data
PhyloQuery
=
PhyloQuery
{
_q_phyloName
::
Text
,
_q_phyloDescription
::
Text
-- Grain and Steps for seting up the periods
,
_q_periodGrain
::
Int
,
_q_periodSteps
::
Int
-- First clustering methods (ie: level 1)
,
_q_fstCluster
::
QueryClustering
-- Inter temporal matching method
,
_q_interTemporalMatching
::
QueryProximity
-- Level max of reconstruction of the Phylo && clustering methods to level max
,
_q_nthLevel
::
Level
,
_q_nthCluster
::
QueryClustering
}
deriving
(
Show
)
data
Filiation
=
Ascendant
|
Descendant
|
Complete
deriving
(
Show
)
data
EdgeType
=
PeriodEdge
|
LevelEdge
deriving
(
Show
)
-- | Reconstruction treatments
data
Proximity
=
WeightedLogJaccard
|
Hamming
|
Filiation
deriving
(
Show
)
data
Clustering
=
Louvain
|
RelatedComponents
|
FrequentItemSet
deriving
(
Show
)
-- | A constructor for Proximities
data
Proximity
=
Proximity
{
_proximity_name
::
ProximityName
,
_proximity_params
::
Map
Text
Double
,
_proximity_threshold
::
Maybe
Double
}
deriving
(
Show
)
data
QueryProximity
=
QueryProximity
{
_qp_name
::
Proximity
,
_qp_pNum
::
Map
Text
Double
,
_qp_threshold
::
Maybe
Double
}
deriving
(
Show
)
-- | A constructor for Clustering
data
Clustering
=
Clustering
{
_
clustering_name
::
ClusteringName
,
_
clustering_params
::
Map
Text
Double
,
_
clustering_paramsBool
::
Map
Text
Bool
,
_
clustering_proximity
::
Maybe
Proximity
}
deriving
(
Show
)
data
QueryClustering
=
Query
Clustering
{
_
qc_name
::
Clustering
,
_
qc_pNum
::
Map
Text
Double
,
_
qc_pBool
::
Map
Text
Bool
,
_
qc_proximity
::
Maybe
Query
Proximity
}
deriving
(
Show
)
------------------------------------------------------------------------
-- | To export a Phylo | --
...
...
@@ -224,9 +241,6 @@ data Clustering = Clustering
-- | PhyloView | --
data
Filiation
=
Ascendant
|
Descendant
|
Complete
deriving
(
Show
)
data
EdgeType
=
PeriodEdge
|
LevelEdge
deriving
(
Show
)
data
PhyloView
=
PhyloView
{
_phylo_viewParam
::
PhyloParam
,
_phylo_viewLabel
::
Text
...
...
@@ -265,50 +279,50 @@ data PhyloNode = PhyloNode
,
_phylo_nodeChilds
::
[
PhyloNode
]
}
deriving
(
Show
)
-- | PhyloQuery | --
-- | PhyloQueryView | --
-- | Post reconstruction treatments
data
Filter
=
LonelyBranch
data
Metric
=
BranchAge
data
Tagger
=
BranchLabelFreq
|
GroupLabelCooc
|
GroupDynamics
data
Sort
=
ByBranchAge
data
Order
=
Asc
|
Desc
data
DisplayMode
=
Flat
|
Nested
-- | A
query filter seen as : prefix && ((filter params)(clause))
-- | A
constructor for filters
data
QueryFilter
=
QueryFilter
{
_query_filter
::
Filter
,
_query_params
::
[
Double
]
{
_qf_name
::
Filter
,
_qf_pNum
::
Map
Text
Double
,
_qf_pBool
::
Map
Text
Bool
}
-- | A PhyloQueryView is the structured representation of a user query to be applied to a Phylo
data
PhyloQueryView
=
PhyloQueryView
{
_q
uery
_lvl
::
Level
{
_q
v
_lvl
::
Level
-- Does the PhyloGraph contain ascendant, descendant or a complete Filiation ?
,
_q
uery
_filiation
::
Filiation
,
_q
v
_filiation
::
Filiation
-- Does the PhyloGraph contain some levelChilds ? How deep must it go ?
,
_q
uery
_childs
::
Bool
,
_q
uery
_childsDepth
::
Level
,
_q
v
_childs
::
Bool
,
_q
v
_childsDepth
::
Level
-- Ordered lists of filters, taggers and metrics to be applied to the PhyloGraph
-- Firstly the metrics, then the filters and the taggers
,
_q
uery
_metrics
::
[
Metric
]
,
_q
uery
_filters
::
[
QueryFilter
]
,
_q
uery
_taggers
::
[
Tagger
]
,
_q
v
_metrics
::
[
Metric
]
,
_q
v
_filters
::
[
QueryFilter
]
,
_q
v
_taggers
::
[
Tagger
]
-- An asc or desc sort to apply to the PhyloGraph
,
_q
uery
_sort
::
Maybe
(
Sort
,
Order
)
,
_q
v
_sort
::
Maybe
(
Sort
,
Order
)
-- A display mode to apply to the PhyloGraph, ie: [Node[Node,Edge],Edge] or [[Node,Node],[Edge,Edge]]
,
_q
uery
_display
::
DisplayMode
,
_q
uery
_verbose
::
Bool
,
_q
v
_display
::
DisplayMode
,
_q
v
_verbose
::
Bool
}
...
...
@@ -329,8 +343,8 @@ makeLenses ''PhyloQueryView
makeLenses
''
P
hyloBranch
makeLenses
''
P
hyloNode
makeLenses
''
P
hyloEdge
makeLenses
''
P
roximity
makeLenses
''
C
lustering
makeLenses
''
Q
uery
Proximity
makeLenses
''
Q
uery
Clustering
makeLenses
''
Q
ueryFilter
makeLenses
''
P
hyloQuery
...
...
@@ -342,12 +356,12 @@ $(deriveJSON (unPrefix "_phylo_group" ) ''PhyloGroup )
--
$
(
deriveJSON
(
unPrefix
"_software_"
)
''
S
oftware
)
$
(
deriveJSON
(
unPrefix
"_phyloParam_"
)
''
P
hyloParam
)
$
(
deriveJSON
(
unPrefix
"_clustering_"
)
''
C
lustering
)
$
(
deriveJSON
(
unPrefix
"_proximity_"
)
''
P
roximity
)
$
(
deriveJSON
(
unPrefix
""
)
''
P
roximityName
)
$
(
deriveJSON
(
unPrefix
""
)
''
C
lusteringName
)
$
(
deriveJSON
(
unPrefix
"_phyloQuery_"
)
''
P
hyloQuery
)
$
(
deriveJSON
(
unPrefix
"_phyloExport_"
)
''
P
hyloExport
)
--
$
(
deriveJSON
(
unPrefix
"_q_"
)
''
P
hyloQuery
)
$
(
deriveJSON
(
unPrefix
"_qc_"
)
''
Q
ueryClustering
)
$
(
deriveJSON
(
unPrefix
"_qp_"
)
''
Q
ueryProximity
)
$
(
deriveJSON
(
unPrefix
""
)
''
P
roximity
)
$
(
deriveJSON
(
unPrefix
""
)
''
C
lustering
)
-- | TODO XML instances
src/Gargantext/Viz/Phylo/Aggregates/Cluster.hs
View file @
eac6ceb5
...
...
@@ -37,14 +37,14 @@ import qualified Data.Set as Set
-- | To apply a Clustering method to a PhyloGraph
graphToClusters
::
Clustering
->
GroupGraph
->
[
Cluster
]
graphToClusters
clust
(
nodes
,
edges
)
=
case
clust
^.
clustering
_name
of
graphToClusters
::
Query
Clustering
->
GroupGraph
->
[
Cluster
]
graphToClusters
clust
(
nodes
,
edges
)
=
case
clust
^.
qc
_name
of
Louvain
->
undefined
-- louvain (nodes,edges)
RelatedComponents
->
relatedComp
0
(
head
nodes
)
(
tail
nodes
,
edges
)
[]
[]
-- | To transform a Phylo into Clusters of PhyloGroups at a given level
phyloToClusters
::
Level
->
Proximity
->
Clustering
->
Phylo
->
Map
(
Date
,
Date
)
[
Cluster
]
phyloToClusters
::
Level
->
QueryProximity
->
Query
Clustering
->
Phylo
->
Map
(
Date
,
Date
)
[
Cluster
]
phyloToClusters
lvl
prox
clus
p
=
Map
.
fromList
$
zip
(
getPhyloPeriods
p
)
(
map
(
\
prd
->
let
graph
=
groupsToGraph
prox
(
getGroupsWithFilters
lvl
prd
p
)
p
...
...
src/Gargantext/Viz/Phylo/BranchMaker.hs
View file @
eac6ceb5
...
...
@@ -44,19 +44,19 @@ graphToBranches lvl (nodes,edges) p = concat
-- | To transform a list of PhyloGroups into a PhyloGraph by using a given Proximity mesure
groupsToGraph
::
Proximity
->
[
PhyloGroup
]
->
Phylo
->
GroupGraph
groupsToGraph
::
Query
Proximity
->
[
PhyloGroup
]
->
Phylo
->
GroupGraph
groupsToGraph
prox
groups
p
=
(
groups
,
edges
)
where
edges
::
GroupEdges
edges
=
case
prox
^.
proximity
_name
of
edges
=
case
prox
^.
qp
_name
of
Filiation
->
(
nub
.
concat
)
$
map
(
\
g
->
(
map
(
\
g'
->
((
g'
,
g
),
1
))
$
getGroupParents
g
p
)
++
(
map
(
\
g'
->
((
g
,
g'
),
1
))
$
getGroupChilds
g
p
))
groups
WeightedLogJaccard
->
filter
(
\
edge
->
snd
edge
>=
(
fromJust
(
prox
^.
proximity
_threshold
)))
WeightedLogJaccard
->
filter
(
\
edge
->
snd
edge
>=
(
fromJust
(
prox
^.
qp
_threshold
)))
$
map
(
\
(
x
,
y
)
->
((
x
,
y
),
weightedLogJaccard
(
getSensibility
prox
)
(
getGroupCooc
x
)
(
unifySharedKeys
(
getGroupCooc
x
)
(
getGroupCooc
y
))))
$
listToDirectedCombi
groups
Hamming
->
filter
(
\
edge
->
snd
edge
<=
(
fromJust
(
prox
^.
proximity
_threshold
)))
Hamming
->
filter
(
\
edge
->
snd
edge
<=
(
fromJust
(
prox
^.
qp
_threshold
)))
$
map
(
\
(
x
,
y
)
->
((
x
,
y
),
hamming
(
getGroupCooc
x
)
(
unifySharedKeys
(
getGroupCooc
x
)
(
getGroupCooc
y
))))
$
listToDirectedCombi
groups
_
->
undefined
...
...
@@ -72,5 +72,5 @@ setPhyloBranches lvl p = alterGroupWithLevel (\g -> let bIdx = (fst . head) $ fi
bs
=
graphToBranches
lvl
graph
p
--------------------------------------
graph
::
GroupGraph
graph
=
groupsToGraph
(
Proximity
Filiation
empty
Nothing
)
(
getGroupsWithLevel
lvl
p
)
p
graph
=
groupsToGraph
(
Query
Proximity
Filiation
empty
Nothing
)
(
getGroupsWithLevel
lvl
p
)
p
--------------------------------------
\ No newline at end of file
src/Gargantext/Viz/Phylo/Example.hs
View file @
eac6ceb5
This diff is collapsed.
Click to expand it.
src/Gargantext/Viz/Phylo/LevelMaker.hs
View file @
eac6ceb5
...
...
@@ -155,7 +155,7 @@ initPhylo g s c a f = addPhyloLevel 0 (corpusToDocs f c base) base
-- | To incrementally add new Levels to a Phylo by making all the linking and aggregation tasks
toNthLevel
::
Level
->
Proximity
->
Clustering
->
Phylo
->
Phylo
toNthLevel
::
Level
->
QueryProximity
->
Query
Clustering
->
Phylo
->
Phylo
toNthLevel
lvlMax
prox
clus
p
|
lvl
>=
lvlMax
=
p
|
otherwise
=
toNthLevel
lvlMax
prox
clus
...
...
@@ -164,7 +164,7 @@ toNthLevel lvlMax prox clus p
$
interTempoMatching
Ascendant
(
lvl
+
1
)
prox
$
setLevelLinks
(
lvl
,
lvl
+
1
)
$
addPhyloLevel
(
lvl
+
1
)
(
phyloToClusters
lvl
(
fromJust
$
clus
^.
clustering
_proximity
)
clus
p
)
p
(
phyloToClusters
lvl
(
fromJust
$
clus
^.
qc
_proximity
)
clus
p
)
p
where
--------------------------------------
lvl
::
Level
...
...
@@ -173,7 +173,7 @@ toNthLevel lvlMax prox clus p
-- | To reconstruct the Level 1 of a Phylo based on a Clustering Methods
toPhylo1
::
Clustering
->
Proximity
->
Map
(
Date
,
Date
)
[
Document
]
->
Phylo
->
Phylo
toPhylo1
::
QueryClustering
->
Query
Proximity
->
Map
(
Date
,
Date
)
[
Document
]
->
Phylo
->
Phylo
toPhylo1
clst
proxy
d
p
=
case
getClusterName
clst
of
FrequentItemSet
->
setPhyloBranches
1
$
interTempoMatching
Descendant
1
proxy
...
...
@@ -184,7 +184,7 @@ toPhylo1 clst proxy d p = case getClusterName clst of
where
--------------------------------------
phyloFis
::
Map
(
Date
,
Date
)
[
Fis
]
phyloFis
=
filterFisBySupport
(
getClusterP
aramBool
clst
"emptyFis"
)
(
round
$
getClusterPara
m
clst
"supportInf"
)
(
filterFisByNested
(
docsToFis
d
))
phyloFis
=
filterFisBySupport
(
getClusterP
Bool
clst
"emptyFis"
)
(
round
$
getClusterPNu
m
clst
"supportInf"
)
(
filterFisByNested
(
docsToFis
d
))
--------------------------------------
_
->
panic
"[ERR][Viz.Phylo.PhyloMaker.toPhylo1] fst clustering not recognized"
...
...
@@ -201,7 +201,7 @@ toPhyloBase q c a = initPhyloBase periods foundations
where
--------------------------------------
periods
::
[(
Date
,
Date
)]
periods
=
initPeriods
(
get
TimeGrain
q
)
(
getTime
Steps
q
)
periods
=
initPeriods
(
get
PeriodGrain
q
)
(
getPeriod
Steps
q
)
$
both
fst
(
head
c
,
last
c
)
--------------------------------------
foundations
::
Vector
Ngrams
...
...
@@ -211,11 +211,11 @@ toPhyloBase q c a = initPhyloBase periods foundations
-- | To reconstruct a Phylomemy from a PhyloQuery, a Corpus and a list of actants
toPhylo
::
PhyloQuery
->
[(
Date
,
Text
)]
->
[
Ngrams
]
->
Phylo
toPhylo
q
c
a
=
toNthLevel
(
getNthLevel
q
)
(
get
Time
Matching
q
)
(
getNthCluster
q
)
phylo1
toPhylo
q
c
a
=
toNthLevel
(
getNthLevel
q
)
(
get
InterTemporal
Matching
q
)
(
getNthCluster
q
)
phylo1
where
--------------------------------------
phylo1
::
Phylo
phylo1
=
toPhylo1
(
getFstCluster
q
)
(
get
Time
Matching
q
)
phyloDocs
phylo0
phylo1
=
toPhylo1
(
getFstCluster
q
)
(
get
InterTemporal
Matching
q
)
phyloDocs
phylo0
--------------------------------------
phylo0
::
Phylo
phylo0
=
toPhylo0
phyloDocs
phyloBase
...
...
src/Gargantext/Viz/Phylo/LinkMaker.hs
View file @
eac6ceb5
...
...
@@ -85,8 +85,8 @@ setLevelLinks (lvl,lvl') p = alterPhyloGroups (linkGroupsByLevel (lvl,lvl') p) p
-- | To apply the corresponding proximity function based on a given Proximity
getProximity
::
Proximity
->
PhyloGroup
->
PhyloGroup
->
(
PhyloGroupId
,
Double
)
getProximity
prox
g1
g2
=
case
(
prox
^.
proximity
_name
)
of
getProximity
::
Query
Proximity
->
PhyloGroup
->
PhyloGroup
->
(
PhyloGroupId
,
Double
)
getProximity
prox
g1
g2
=
case
(
prox
^.
qp
_name
)
of
WeightedLogJaccard
->
((
getGroupId
g2
),
weightedLogJaccard
(
getSensibility
prox
)
(
getGroupCooc
g1
)
(
unifySharedKeys
(
getGroupCooc
g2
)
(
getGroupCooc
g1
)))
Hamming
->
((
getGroupId
g2
),
hamming
(
getGroupCooc
g1
)
(
unifySharedKeys
(
getGroupCooc
g2
)
(
getGroupCooc
g1
)))
_
->
panic
(
"[ERR][Viz.Phylo.Example.getProximity] Proximity function not defined"
)
...
...
@@ -122,7 +122,7 @@ getNextPeriods to id l = case to of
-- | To find the best set (max = 2) of Childs/Parents candidates based on a given Proximity mesure until a maximum depth (max = Period + 5 units )
findBestCandidates
::
Filiation
->
Int
->
Int
->
Proximity
->
PhyloGroup
->
Phylo
->
[(
PhyloGroupId
,
Double
)]
findBestCandidates
::
Filiation
->
Int
->
Int
->
Query
Proximity
->
PhyloGroup
->
Phylo
->
[(
PhyloGroupId
,
Double
)]
findBestCandidates
to
depth
max
prox
group
p
|
depth
>
max
||
null
next
=
[]
|
(
not
.
null
)
best
=
take
2
best
...
...
@@ -141,9 +141,9 @@ findBestCandidates to depth max prox group p
best
::
[(
PhyloGroupId
,
Double
)]
best
=
reverse
$
sortOn
snd
$
filter
(
\
(
id
,
score
)
->
case
(
prox
^.
proximity
_name
)
of
WeightedLogJaccard
->
score
>=
fromJust
(
prox
^.
proximity
_threshold
)
Hamming
->
score
<=
fromJust
(
prox
^.
proximity
_threshold
))
scores
$
filter
(
\
(
id
,
score
)
->
case
(
prox
^.
qp
_name
)
of
WeightedLogJaccard
->
score
>=
fromJust
(
prox
^.
qp
_threshold
)
Hamming
->
score
<=
fromJust
(
prox
^.
qp
_threshold
))
scores
--------------------------------------
...
...
@@ -161,7 +161,7 @@ makePair to group ids = case to of
-- | To pair all the Phylogroups of given PhyloLevel to their best Parents or Childs
interTempoMatching
::
Filiation
->
Level
->
Proximity
->
Phylo
->
Phylo
interTempoMatching
::
Filiation
->
Level
->
Query
Proximity
->
Phylo
->
Phylo
interTempoMatching
to
lvl
prox
p
=
alterPhyloGroups
(
\
groups
->
map
(
\
group
->
...
...
src/Gargantext/Viz/Phylo/Tools.hs
View file @
eac6ceb5
...
...
@@ -140,27 +140,41 @@ getBranchMeta k b = (b ^. phylo_branchMeta) ! k
-- | To get the Name of a Clustering Methods
getClusterName
::
Clustering
->
ClusteringName
getClusterName
c
=
_
clustering
_name
c
getClusterName
::
QueryClustering
->
Clustering
getClusterName
c
=
_
qc
_name
c
-- | To get the params of a Clustering Methods
getClusterP
aram
::
Clustering
->
Text
->
Double
getClusterP
aram
c
k
=
if
(
member
k
$
_clustering_params
c
)
then
(
_
clustering_params
c
)
Map
.!
k
getClusterP
Num
::
Query
Clustering
->
Text
->
Double
getClusterP
Num
c
k
=
if
(
member
k
$
_qc_pNum
c
)
then
(
_
qc_pNum
c
)
Map
.!
k
else
panic
"[ERR][Viz.Phylo.Tools.getClusterParam] the key is not in params"
-- | To get the boolean params of a Clustering Methods
getClusterP
aramBool
::
Clustering
->
Text
->
Bool
getClusterP
aramBool
c
k
=
if
(
member
k
$
_clustering_params
Bool
c
)
then
(
_
clustering_params
Bool
c
)
Map
.!
k
getClusterP
Bool
::
Query
Clustering
->
Text
->
Bool
getClusterP
Bool
c
k
=
if
(
member
k
$
_qc_p
Bool
c
)
then
(
_
qc_p
Bool
c
)
Map
.!
k
else
panic
"[ERR][Viz.Phylo.Tools.getClusterParamBool] the key is not in paramsBool"
-- | To get a numeric param from a given QueryFilter
getFilterPNum
::
QueryFilter
->
Text
->
Double
getFilterPNum
f
k
=
if
(
member
k
$
f
^.
qf_pNum
)
then
(
f
^.
qf_pNum
)
Map
.!
k
else
panic
"[ERR][Viz.Phylo.Tools.getFilterPNum] the key is not in pNum"
-- | To get a boolean param from a given QueryFilter
getFilterPBool
::
QueryFilter
->
Text
->
Bool
getFilterPBool
f
k
=
if
(
member
k
$
f
^.
qf_pBool
)
then
(
f
^.
qf_pBool
)
Map
.!
k
else
panic
"[ERR][Viz.Phylo.Tools.getFilterPBool] the key is not in pBool"
-- | To get the first clustering method to apply to get the level 1 of a Phylo
getFstCluster
::
PhyloQuery
->
Clustering
getFstCluster
q
=
q
^.
phyloQuery
_fstCluster
getFstCluster
::
PhyloQuery
->
Query
Clustering
getFstCluster
q
=
q
^.
q
_fstCluster
-- | To get the foundations of a Phylo
...
...
@@ -380,13 +394,13 @@ getNodesInBranches v = filter (\n -> isJust $ n ^. phylo_nodeBranchId)
-- | To get the cluster methods to apply to the Nths levels of a Phylo
getNthCluster
::
PhyloQuery
->
Clustering
getNthCluster
q
=
q
^.
phyloQuery
_nthCluster
getNthCluster
::
PhyloQuery
->
Query
Clustering
getNthCluster
q
=
q
^.
q
_nthCluster
-- | To get the Sup Level of a reconstruction of a Phylo from a PhyloQuery
getNthLevel
::
PhyloQuery
->
Level
getNthLevel
q
=
q
^.
phyloQuery
_nthLevel
getNthLevel
q
=
q
^.
q
_nthLevel
-- | To get the PhylolevelId of a given PhyloLevel
...
...
@@ -411,9 +425,9 @@ getPhyloPeriodId prd = _phylo_periodId prd
-- | To get the sensibility of a Proximity if it exists
getSensibility
::
Proximity
->
Double
getSensibility
prox
=
if
(
member
"sensibility"
$
prox
^.
proximity_params
)
then
(
prox
^.
proximity_params
)
!
"sensibility"
getSensibility
::
Query
Proximity
->
Double
getSensibility
prox
=
if
(
member
"sensibility"
$
prox
^.
qp_pNum
)
then
(
prox
^.
qp_pNum
)
!
"sensibility"
else
panic
"[ERR][Viz.Phylo.Tools.getSensibility] sensibility not in params"
...
...
@@ -428,18 +442,18 @@ getTargetId e = e ^. phylo_edgeTarget
-- | To get the Grain of the PhyloPeriods from a PhyloQuery
get
Time
Grain
::
PhyloQuery
->
Int
get
TimeGrain
q
=
q
^.
phyloQuery_time
Grain
get
Period
Grain
::
PhyloQuery
->
Int
get
PeriodGrain
q
=
q
^.
q_period
Grain
-- | To get the intertemporal matching strategy to apply to a Phylo from a PhyloQuery
get
TimeMatching
::
PhyloQuery
->
Proximity
get
TimeMatching
q
=
q
^.
phyloQuery_time
Matching
get
InterTemporalMatching
::
PhyloQuery
->
Query
Proximity
get
InterTemporalMatching
q
=
q
^.
q_interTemporal
Matching
-- | To get the Steps of the PhyloPeriods from a PhyloQuery
get
Time
Steps
::
PhyloQuery
->
Int
get
TimeSteps
q
=
q
^.
phyloQuery_time
Steps
get
Period
Steps
::
PhyloQuery
->
Int
get
PeriodSteps
q
=
q
^.
q_period
Steps
-- | To get all the PhyloBranchIds of a PhyloView
...
...
src/Gargantext/Viz/Phylo/View/Filters.hs
View file @
eac6ceb5
...
...
@@ -77,10 +77,14 @@ filterLonelyBranch nbInf nbSup nbNs prds v = cleanNodesEdges v v'
--------------------------------------
-- | To process a list of QueryFilter to a PhyloView
processFilters
::
[
QueryFilter
]
->
Phylo
->
PhyloView
->
PhyloView
processFilters
fs
p
v
=
foldl
(
\
v'
f
->
case
f
^.
q
uery_filter
of
LonelyBranch
->
filterLonelyBranch
(
round
$
(
f
^.
query_params
)
!!
0
)
(
round
$
(
f
^.
query_params
)
!!
1
)
(
round
$
(
f
^.
query_params
)
!!
2
)
(
getPhyloPeriods
p
)
v'
processFilters
fs
p
v
=
foldl
(
\
v'
f
->
case
f
^.
q
f_name
of
LonelyBranch
->
filterLonelyBranch
(
round
$
getFilterPNum
f
"nbInf"
)
(
round
$
getFilterPNum
f
"nbSup"
)
(
round
$
getFilterPNum
f
"nbNs"
)
(
getPhyloPeriods
p
)
v'
_
->
panic
"[ERR][Viz.Phylo.View.Filters.processFilters] filter not found"
)
v
fs
\ No newline at end of file
src/Gargantext/Viz/Phylo/View/ViewMaker.hs
View file @
eac6ceb5
...
...
@@ -126,13 +126,13 @@ addChildNodes shouldDo lvl lvlMin vb fl p v =
-- | To transform a PhyloQuery into a PhyloView
queryToView
::
PhyloQueryView
->
Phylo
->
PhyloView
queryToView
q
p
=
processDisplay
(
q
^.
q
uery
_display
)
$
processSort
(
q
^.
q
uery
_sort
)
p
$
processTaggers
(
q
^.
q
uery
_taggers
)
p
$
processFilters
(
q
^.
q
uery
_filters
)
p
$
processMetrics
(
q
^.
q
uery
_metrics
)
p
$
addChildNodes
(
q
^.
q
uery_childs
)
(
q
^.
query_lvl
)
(
q
^.
query_childsDepth
)
(
q
^.
query_verbose
)
(
q
^.
query
_filiation
)
p
$
initPhyloView
(
q
^.
q
uery_lvl
)
"Phylo2000"
"This is a Phylo"
(
q
^.
query_filiation
)
(
q
^.
query
_verbose
)
p
queryToView
q
p
=
processDisplay
(
q
^.
q
v
_display
)
$
processSort
(
q
^.
q
v
_sort
)
p
$
processTaggers
(
q
^.
q
v
_taggers
)
p
$
processFilters
(
q
^.
q
v
_filters
)
p
$
processMetrics
(
q
^.
q
v
_metrics
)
p
$
addChildNodes
(
q
^.
q
v_childs
)
(
q
^.
qv_lvl
)
(
q
^.
qv_childsDepth
)
(
q
^.
qv_verbose
)
(
q
^.
qv
_filiation
)
p
$
initPhyloView
(
q
^.
q
v_lvl
)
"Phylo2000"
"This is a Phylo"
(
q
^.
qv_filiation
)
(
q
^.
qv
_verbose
)
p
-- | dirty params
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment