Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Przemyslaw Kaminski
haskell-gargantext
Commits
87628655
Commit
87628655
authored
Sep 23, 2020
by
qlobbe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix branch_x
parent
a67c6565
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
20 deletions
+31
-20
PhyloExport.hs
src/Gargantext/Core/Viz/Phylo/PhyloExport.hs
+31
-20
No files found.
src/Gargantext/Core/Viz/Phylo/PhyloExport.hs
View file @
87628655
...
...
@@ -145,17 +145,13 @@ groupToDotNode fdt g bId =
])
toDotEdge
::
DotId
->
DotId
->
Text
.
Text
->
EdgeType
->
Dot
DotId
toDotEdge
::
DotId
->
DotId
->
[
Char
]
->
EdgeType
->
Dot
DotId
toDotEdge
source
target
lbl
edgeType
=
edge
source
target
(
case
edgeType
of
GroupToGroup
->
[
Width
3
,
penWidth
4
,
Color
[
toWColor
Black
],
Constraint
True
,
Label
(
StrLabel
$
fromStrict
lbl
)]
<>
[
toAttr
"edgeType"
"link"
]
BranchToGroup
->
[
Width
3
,
Color
[
toWColor
Black
],
ArrowHead
(
AType
[(
ArrMod
FilledArrow
RightSide
,
DotArrow
)])
,
Label
(
StrLabel
$
fromStrict
lbl
)]
<>
[
toAttr
"edgeType"
"branchLink"
]
BranchToBranch
->
[
Width
2
,
Color
[
toWColor
Black
],
Style
[
SItem
Dashed
[]
],
ArrowHead
(
AType
[(
ArrMod
FilledArrow
BothSides
,
DotArrow
)])
,
Label
(
StrLabel
$
fromStrict
lbl
)]
GroupToAncestor
->
[
Width
3
,
Color
[
toWColor
Red
],
Style
[
SItem
Dashed
[]
],
ArrowHead
(
AType
[(
ArrMod
FilledArrow
BothSides
,
NoArrow
)])
,
Label
(
StrLabel
$
fromStrict
lbl
),
PenWidth
4
]
<>
[
toAttr
"edgeType"
"ancestorLink"
]
GroupToGroup
->
[
Width
3
,
penWidth
4
,
Color
[
toWColor
Black
],
Constraint
True
]
<>
[
toAttr
"edgeType"
"link"
,
toAttr
"label"
(
pack
lbl
)]
BranchToGroup
->
[
Width
3
,
Color
[
toWColor
Black
],
ArrowHead
(
AType
[(
ArrMod
FilledArrow
RightSide
,
DotArrow
)])]
<>
[
toAttr
"edgeType"
"branchLink"
]
BranchToBranch
->
[
Width
2
,
Color
[
toWColor
Black
],
Style
[
SItem
Dashed
[]
],
ArrowHead
(
AType
[(
ArrMod
FilledArrow
BothSides
,
DotArrow
)])]
GroupToAncestor
->
[
Width
3
,
Color
[
toWColor
Red
],
Style
[
SItem
Dashed
[]
],
ArrowHead
(
AType
[(
ArrMod
FilledArrow
BothSides
,
NoArrow
)]),
PenWidth
4
]
<>
[
toAttr
"edgeType"
"ancestorLink"
,
toAttr
"label"
(
pack
lbl
)]
PeriodToPeriod
->
[
Width
5
,
Color
[
toWColor
Black
]])
...
...
@@ -239,12 +235,12 @@ exportToDot phylo export =
$
fromListWith
(
++
)
$
map
(
\
g
->
(
g
^.
phylo_groupBranchId
,[
g
]))
$
export
^.
export_groups
{- 8) create the edges between the groups -}
_
<-
mapM
(
\
((
k
,
k'
),
_
)
->
toDotEdge
(
groupIdToDotId
k
)
(
groupIdToDotId
k'
)
""
GroupToGroup
_
<-
mapM
(
\
((
k
,
k'
),
v
)
->
toDotEdge
(
groupIdToDotId
k
)
(
groupIdToDotId
k'
)
(
show
v
)
GroupToGroup
)
$
(
toList
.
mergePointers
)
$
export
^.
export_groups
_
<-
mapM
(
\
((
k
,
k'
),
_
)
->
toDotEdge
(
groupIdToDotId
k
)
(
groupIdToDotId
k'
)
""
GroupToAncestor
_
<-
mapM
(
\
((
k
,
k'
),
v
)
->
toDotEdge
(
groupIdToDotId
k
)
(
groupIdToDotId
k'
)
(
show
v
)
GroupToAncestor
)
$
mergeAncestors
$
export
^.
export_groups
-- | 10) create the edges between the periods
...
...
@@ -296,17 +292,31 @@ branchToIso branches =
$
zip
branches
$
([
0
]
++
(
map
(
\
(
b
,
b'
)
->
let
idx
=
length
$
commonPrefix
(
b
^.
branch_canonId
)
(
b'
^.
branch_canonId
)
[]
in
(
b'
^.
branch_seaLevel
)
!!
(
idx
-
1
)
lmin
=
min
(
length
$
b
^.
branch_seaLevel
)
(
length
$
b'
^.
branch_seaLevel
)
in
if
((
idx
-
1
)
>
((
length
$
b'
^.
branch_seaLevel
)
-
1
))
then
(
b'
^.
branch_seaLevel
)
!!
(
lmin
-
1
)
else
(
b'
^.
branch_seaLevel
)
!!
(
idx
-
1
)
)
$
listToSeq
branches
))
in
map
(
\
(
x
,
b
)
->
b
&
branch_x
.~
x
)
$
zip
steps
branches
branchToIso'
::
Double
->
Double
->
[
PhyloBranch
]
->
[
PhyloBranch
]
branchToIso'
start
step
branches
=
let
bx
=
map
(
\
l
->
(
sum
l
)
+
((
fromIntegral
$
length
l
)
*
0.5
))
$
inits
$
([
0
]
++
(
map
(
\
(
b
,
b'
)
->
let
root
=
fromIntegral
$
length
$
commonPrefix
(
snd
$
b
^.
branch_id
)
(
snd
$
b'
^.
branch_id
)
[]
in
1
-
start
-
step
*
root
)
$
listToSeq
branches
))
in
map
(
\
(
x
,
b
)
->
b
&
branch_x
.~
x
)
$
zip
bx
branches
sortByHierarchy
::
Int
->
[
PhyloBranch
]
->
[
PhyloBranch
]
sortByHierarchy
depth
branches
=
if
(
length
branches
==
1
)
then
branch
ToIso
branch
es
else
branchToIso
$
concat
then
branches
else
concat
$
map
(
\
branches'
->
let
partitions
=
partition
(
\
b
->
depth
+
1
==
((
length
.
snd
)
$
b
^.
branch_id
))
branches'
in
(
sortOn
(
\
b
->
(
b
^.
branch_meta
)
!
"birth"
)
(
fst
partitions
))
...
...
@@ -323,10 +333,11 @@ sortByBirthDate order export =
Desc
->
reverse
branches
in
export
&
export_branches
.~
branches'
processSort
::
Sort
->
PhyloExport
->
PhyloExport
processSort
sort'
export
=
case
sort'
of
processSort
::
Sort
->
SeaElevation
->
PhyloExport
->
PhyloExport
processSort
sort'
e
lev
e
xport
=
case
sort'
of
ByBirthDate
o
->
sortByBirthDate
o
export
ByHierarchy
->
export
&
export_branches
.~
sortByHierarchy
0
(
export
^.
export_branches
)
ByHierarchy
->
export
&
export_branches
.~
(
branchToIso'
(
_cons_start
elev
)
(
_cons_step
elev
)
$
sortByHierarchy
0
(
export
^.
export_branches
))
-----------------
...
...
@@ -617,7 +628,7 @@ getPreviousChildIds lvl frame curr prds phylo =
toPhyloExport
::
Phylo
->
DotGraph
DotId
toPhyloExport
phylo
=
exportToDot
phylo
$
processFilters
(
exportFilter
$
getConfig
phylo
)
(
phyloQuality
$
getConfig
phylo
)
$
processSort
(
exportSort
$
getConfig
phylo
)
$
processSort
(
exportSort
$
getConfig
phylo
)
(
getSeaElevation
phylo
)
$
processLabels
(
exportLabel
$
getConfig
phylo
)
(
getRoots
phylo
)
(
_phylo_lastTermFreq
phylo
)
$
processMetrics
export
where
...
...
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