{-|
Module      : Gargantext.Core.Viz.Phylo
Description : Phylomemy definitions and types.
Copyright   : (c) CNRS, 2017-Present
License     : AGPL + CECILL v3
Maintainer  : team@gargantext.org
Stability   : experimental
Portability : POSIX

Specifications of Phylomemy export format.

Phylomemy can be described as a Temporal Graph with different scale of
granularity of group of ngrams (terms and multi-terms).

The main type is Phylo which is synonym of Phylomemy (only difference is
the number of chars).

References:
Chavalarias, D., Cointet, J.-P., 2013. Phylomemetic patterns
in science evolution — the rise and fall of scientific fields. PloS
one 8, e54847.

-}

{-# LANGUAGE DeriveAnyClass   #-}
{-# LANGUAGE TemplateHaskell   #-}

module Gargantext.Core.Viz.LegacyPhylo where

import Control.DeepSeq
import Control.Lens (makeLenses)
import Data.Aeson.TH (deriveJSON,defaultOptions)
import Data.Map     (Map)
import Data.Set     (Set)
import Data.Swagger
import Data.Text    (Text)
import Data.Vector  (Vector)
import GHC.Generics (Generic)
import Gargantext.Core.Utils.Prefix (unPrefix, unPrefixSwagger)
import Gargantext.Prelude
import Gargantext.Core.Text.Context (TermList)

--------------------
-- | PhyloParam | --
--------------------


-- | Global parameters of a Phylo
data PhyloParam =
     PhyloParam { PhyloParam -> Text
_phyloParam_version  :: !Text -- Double ?
                , PhyloParam -> Software
_phyloParam_software :: !Software
                , PhyloParam -> PhyloQueryBuild
_phyloParam_query    :: !PhyloQueryBuild
     } deriving ((forall x. PhyloParam -> Rep PhyloParam x)
-> (forall x. Rep PhyloParam x -> PhyloParam) -> Generic PhyloParam
forall x. Rep PhyloParam x -> PhyloParam
forall x. PhyloParam -> Rep PhyloParam x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PhyloParam x -> PhyloParam
$cfrom :: forall x. PhyloParam -> Rep PhyloParam x
Generic, Int -> PhyloParam -> ShowS
[PhyloParam] -> ShowS
PhyloParam -> String
(Int -> PhyloParam -> ShowS)
-> (PhyloParam -> String)
-> ([PhyloParam] -> ShowS)
-> Show PhyloParam
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhyloParam] -> ShowS
$cshowList :: [PhyloParam] -> ShowS
show :: PhyloParam -> String
$cshow :: PhyloParam -> String
showsPrec :: Int -> PhyloParam -> ShowS
$cshowsPrec :: Int -> PhyloParam -> ShowS
Show, PhyloParam -> PhyloParam -> Bool
(PhyloParam -> PhyloParam -> Bool)
-> (PhyloParam -> PhyloParam -> Bool) -> Eq PhyloParam
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhyloParam -> PhyloParam -> Bool
$c/= :: PhyloParam -> PhyloParam -> Bool
== :: PhyloParam -> PhyloParam -> Bool
$c== :: PhyloParam -> PhyloParam -> Bool
Eq)


-- | Software parameters
data Software =
     Software { Software -> Text
_software_name    :: !Text
              , Software -> Text
_software_version :: !Text
     } deriving ((forall x. Software -> Rep Software x)
-> (forall x. Rep Software x -> Software) -> Generic Software
forall x. Rep Software x -> Software
forall x. Software -> Rep Software x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Software x -> Software
$cfrom :: forall x. Software -> Rep Software x
Generic, Int -> Software -> ShowS
[Software] -> ShowS
Software -> String
(Int -> Software -> ShowS)
-> (Software -> String) -> ([Software] -> ShowS) -> Show Software
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Software] -> ShowS
$cshowList :: [Software] -> ShowS
show :: Software -> String
$cshow :: Software -> String
showsPrec :: Int -> Software -> ShowS
$cshowsPrec :: Int -> Software -> ShowS
Show, Software -> Software -> Bool
(Software -> Software -> Bool)
-> (Software -> Software -> Bool) -> Eq Software
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Software -> Software -> Bool
$c/= :: Software -> Software -> Bool
== :: Software -> Software -> Bool
$c== :: Software -> Software -> Bool
Eq)


---------------
-- | Phylo | --
---------------


-- | Phylo datatype of a phylomemy
-- Duration    : time Segment of the whole Phylo
-- Foundations : vector of all the Ngrams contained in a Phylo (build from a list of actants)
-- Periods     : list of all the periods of a Phylo
data Phylo =
     Phylo { Phylo -> (Int, Int)
_phylo_duration    :: !(Start, End)
           , Phylo -> PhyloFoundations
_phylo_foundations :: !PhyloFoundations
           , Phylo -> [PhyloPeriod]
_phylo_periods     :: [PhyloPeriod]
           , Phylo -> Map Int Double
_phylo_docsByYears :: !(Map Date Double)
           , Phylo -> Map Int (Map (Int, Int) Double)
_phylo_cooc        :: !(Map Date (Map (Int,Int) Double))
           , Phylo -> Map (Int, Int) [PhyloFis]
_phylo_fis         :: !(Map (Date,Date) [PhyloFis])
           , Phylo -> PhyloParam
_phylo_param       :: !PhyloParam
           }
           deriving ((forall x. Phylo -> Rep Phylo x)
-> (forall x. Rep Phylo x -> Phylo) -> Generic Phylo
forall x. Rep Phylo x -> Phylo
forall x. Phylo -> Rep Phylo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Phylo x -> Phylo
$cfrom :: forall x. Phylo -> Rep Phylo x
Generic, Int -> Phylo -> ShowS
[Phylo] -> ShowS
Phylo -> String
(Int -> Phylo -> ShowS)
-> (Phylo -> String) -> ([Phylo] -> ShowS) -> Show Phylo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Phylo] -> ShowS
$cshowList :: [Phylo] -> ShowS
show :: Phylo -> String
$cshow :: Phylo -> String
showsPrec :: Int -> Phylo -> ShowS
$cshowsPrec :: Int -> Phylo -> ShowS
Show, Phylo -> Phylo -> Bool
(Phylo -> Phylo -> Bool) -> (Phylo -> Phylo -> Bool) -> Eq Phylo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Phylo -> Phylo -> Bool
$c/= :: Phylo -> Phylo -> Bool
== :: Phylo -> Phylo -> Bool
$c== :: Phylo -> Phylo -> Bool
Eq)


-- | The foundations of a phylomemy created from a given TermList 
data PhyloFoundations =
  PhyloFoundations { PhyloFoundations -> Vector Text
_phylo_foundationsRoots :: !(Vector Ngrams)
                   , PhyloFoundations -> TermList
_phylo_foundationsTermsList :: !TermList
  } deriving ((forall x. PhyloFoundations -> Rep PhyloFoundations x)
-> (forall x. Rep PhyloFoundations x -> PhyloFoundations)
-> Generic PhyloFoundations
forall x. Rep PhyloFoundations x -> PhyloFoundations
forall x. PhyloFoundations -> Rep PhyloFoundations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PhyloFoundations x -> PhyloFoundations
$cfrom :: forall x. PhyloFoundations -> Rep PhyloFoundations x
Generic, Int -> PhyloFoundations -> ShowS
[PhyloFoundations] -> ShowS
PhyloFoundations -> String
(Int -> PhyloFoundations -> ShowS)
-> (PhyloFoundations -> String)
-> ([PhyloFoundations] -> ShowS)
-> Show PhyloFoundations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhyloFoundations] -> ShowS
$cshowList :: [PhyloFoundations] -> ShowS
show :: PhyloFoundations -> String
$cshow :: PhyloFoundations -> String
showsPrec :: Int -> PhyloFoundations -> ShowS
$cshowsPrec :: Int -> PhyloFoundations -> ShowS
Show, PhyloFoundations -> PhyloFoundations -> Bool
(PhyloFoundations -> PhyloFoundations -> Bool)
-> (PhyloFoundations -> PhyloFoundations -> Bool)
-> Eq PhyloFoundations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhyloFoundations -> PhyloFoundations -> Bool
$c/= :: PhyloFoundations -> PhyloFoundations -> Bool
== :: PhyloFoundations -> PhyloFoundations -> Bool
$c== :: PhyloFoundations -> PhyloFoundations -> Bool
Eq)


-- | Date : a simple Integer
type Date = Int

-- | UTCTime in seconds since UNIX epoch
-- type Start   = POSIXTime
-- type End     = POSIXTime
type Start   = Date
type End     = Date


---------------------
-- | PhyloPeriod | --
---------------------


-- | PhyloStep : steps of phylomemy on temporal axis
-- Period: tuple (start date, end date) of the step of the phylomemy
-- Levels: levels of granularity
data PhyloPeriod =
     PhyloPeriod { PhyloPeriod -> (Int, Int)
_phylo_periodId     :: !PhyloPeriodId
                 , PhyloPeriod -> [PhyloLevel]
_phylo_periodLevels :: ![PhyloLevel]
                 }
                 deriving ((forall x. PhyloPeriod -> Rep PhyloPeriod x)
-> (forall x. Rep PhyloPeriod x -> PhyloPeriod)
-> Generic PhyloPeriod
forall x. Rep PhyloPeriod x -> PhyloPeriod
forall x. PhyloPeriod -> Rep PhyloPeriod x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PhyloPeriod x -> PhyloPeriod
$cfrom :: forall x. PhyloPeriod -> Rep PhyloPeriod x
Generic, Int -> PhyloPeriod -> ShowS
[PhyloPeriod] -> ShowS
PhyloPeriod -> String
(Int -> PhyloPeriod -> ShowS)
-> (PhyloPeriod -> String)
-> ([PhyloPeriod] -> ShowS)
-> Show PhyloPeriod
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhyloPeriod] -> ShowS
$cshowList :: [PhyloPeriod] -> ShowS
show :: PhyloPeriod -> String
$cshow :: PhyloPeriod -> String
showsPrec :: Int -> PhyloPeriod -> ShowS
$cshowsPrec :: Int -> PhyloPeriod -> ShowS
Show, PhyloPeriod -> PhyloPeriod -> Bool
(PhyloPeriod -> PhyloPeriod -> Bool)
-> (PhyloPeriod -> PhyloPeriod -> Bool) -> Eq PhyloPeriod
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhyloPeriod -> PhyloPeriod -> Bool
$c/= :: PhyloPeriod -> PhyloPeriod -> Bool
== :: PhyloPeriod -> PhyloPeriod -> Bool
$c== :: PhyloPeriod -> PhyloPeriod -> Bool
Eq)


--------------------
-- | PhyloLevel | --
--------------------


-- | PhyloLevel : levels of phylomemy on level axis
-- Levels description:
-- Level -1: Ngram equals itself         (by identity) == _phylo_Ngrams
-- Level  0: Group of synonyms           (by stems + by qualitative expert meaning)
-- Level  1: First level of clustering
-- Level  N: Nth   level of clustering
data PhyloLevel =
     PhyloLevel { PhyloLevel -> PhyloLevelId
_phylo_levelId     :: !PhyloLevelId
                , PhyloLevel -> [PhyloGroup]
_phylo_levelGroups :: ![PhyloGroup]
                }
                deriving ((forall x. PhyloLevel -> Rep PhyloLevel x)
-> (forall x. Rep PhyloLevel x -> PhyloLevel) -> Generic PhyloLevel
forall x. Rep PhyloLevel x -> PhyloLevel
forall x. PhyloLevel -> Rep PhyloLevel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PhyloLevel x -> PhyloLevel
$cfrom :: forall x. PhyloLevel -> Rep PhyloLevel x
Generic, Int -> PhyloLevel -> ShowS
[PhyloLevel] -> ShowS
PhyloLevel -> String
(Int -> PhyloLevel -> ShowS)
-> (PhyloLevel -> String)
-> ([PhyloLevel] -> ShowS)
-> Show PhyloLevel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhyloLevel] -> ShowS
$cshowList :: [PhyloLevel] -> ShowS
show :: PhyloLevel -> String
$cshow :: PhyloLevel -> String
showsPrec :: Int -> PhyloLevel -> ShowS
$cshowsPrec :: Int -> PhyloLevel -> ShowS
Show, PhyloLevel -> PhyloLevel -> Bool
(PhyloLevel -> PhyloLevel -> Bool)
-> (PhyloLevel -> PhyloLevel -> Bool) -> Eq PhyloLevel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhyloLevel -> PhyloLevel -> Bool
$c/= :: PhyloLevel -> PhyloLevel -> Bool
== :: PhyloLevel -> PhyloLevel -> Bool
$c== :: PhyloLevel -> PhyloLevel -> Bool
Eq)


--------------------
-- | PhyloGroup | --
--------------------


-- | PhyloGroup : group of ngrams at each level and step
-- Label : maybe has a label as text
-- Ngrams: set of terms that build the group
-- Quality : map of measures (support, etc.) that depict some qualitative aspects of a phylo
-- Period Parents|Childs: weighted link to Parents|Childs (Temporal Period   axis)
-- Level  Parents|Childs: weighted link to Parents|Childs (Level Granularity axis)
-- Pointers are directed link from Self to any PhyloGroup (/= Self ?)
data PhyloGroup =
     PhyloGroup { PhyloGroup -> PhyloGroupId
_phylo_groupId            :: !PhyloGroupId
                , PhyloGroup -> Text
_phylo_groupLabel         :: !Text
                , PhyloGroup -> [Int]
_phylo_groupNgrams        :: ![Int]
                , PhyloGroup -> Map Text [Double]
_phylo_groupNgramsMeta    :: !(Map Text [Double])
                , PhyloGroup -> Map Text Double
_phylo_groupMeta          :: !(Map Text Double)
                , PhyloGroup -> Maybe (Int, Int)
_phylo_groupBranchId      :: !(Maybe PhyloBranchId)
                , PhyloGroup -> Map (Int, Int) Double
_phylo_groupCooc          :: !(Map (Int,Int) Double)

                , PhyloGroup -> [Pointer]
_phylo_groupPeriodParents :: ![Pointer]
                , PhyloGroup -> [Pointer]
_phylo_groupPeriodChilds  :: ![Pointer]

                , PhyloGroup -> [Pointer]
_phylo_groupLevelParents  :: ![Pointer]
                , PhyloGroup -> [Pointer]
_phylo_groupLevelChilds   :: ![Pointer]
                }
                deriving ((forall x. PhyloGroup -> Rep PhyloGroup x)
-> (forall x. Rep PhyloGroup x -> PhyloGroup) -> Generic PhyloGroup
forall x. Rep PhyloGroup x -> PhyloGroup
forall x. PhyloGroup -> Rep PhyloGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PhyloGroup x -> PhyloGroup
$cfrom :: forall x. PhyloGroup -> Rep PhyloGroup x
Generic, PhyloGroup -> ()
(PhyloGroup -> ()) -> NFData PhyloGroup
forall a. (a -> ()) -> NFData a
rnf :: PhyloGroup -> ()
$crnf :: PhyloGroup -> ()
NFData, Int -> PhyloGroup -> ShowS
[PhyloGroup] -> ShowS
PhyloGroup -> String
(Int -> PhyloGroup -> ShowS)
-> (PhyloGroup -> String)
-> ([PhyloGroup] -> ShowS)
-> Show PhyloGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhyloGroup] -> ShowS
$cshowList :: [PhyloGroup] -> ShowS
show :: PhyloGroup -> String
$cshow :: PhyloGroup -> String
showsPrec :: Int -> PhyloGroup -> ShowS
$cshowsPrec :: Int -> PhyloGroup -> ShowS
Show, PhyloGroup -> PhyloGroup -> Bool
(PhyloGroup -> PhyloGroup -> Bool)
-> (PhyloGroup -> PhyloGroup -> Bool) -> Eq PhyloGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhyloGroup -> PhyloGroup -> Bool
$c/= :: PhyloGroup -> PhyloGroup -> Bool
== :: PhyloGroup -> PhyloGroup -> Bool
$c== :: PhyloGroup -> PhyloGroup -> Bool
Eq, Eq PhyloGroup
Eq PhyloGroup
-> (PhyloGroup -> PhyloGroup -> Ordering)
-> (PhyloGroup -> PhyloGroup -> Bool)
-> (PhyloGroup -> PhyloGroup -> Bool)
-> (PhyloGroup -> PhyloGroup -> Bool)
-> (PhyloGroup -> PhyloGroup -> Bool)
-> (PhyloGroup -> PhyloGroup -> PhyloGroup)
-> (PhyloGroup -> PhyloGroup -> PhyloGroup)
-> Ord PhyloGroup
PhyloGroup -> PhyloGroup -> Bool
PhyloGroup -> PhyloGroup -> Ordering
PhyloGroup -> PhyloGroup -> PhyloGroup
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: PhyloGroup -> PhyloGroup -> PhyloGroup
$cmin :: PhyloGroup -> PhyloGroup -> PhyloGroup
max :: PhyloGroup -> PhyloGroup -> PhyloGroup
$cmax :: PhyloGroup -> PhyloGroup -> PhyloGroup
>= :: PhyloGroup -> PhyloGroup -> Bool
$c>= :: PhyloGroup -> PhyloGroup -> Bool
> :: PhyloGroup -> PhyloGroup -> Bool
$c> :: PhyloGroup -> PhyloGroup -> Bool
<= :: PhyloGroup -> PhyloGroup -> Bool
$c<= :: PhyloGroup -> PhyloGroup -> Bool
< :: PhyloGroup -> PhyloGroup -> Bool
$c< :: PhyloGroup -> PhyloGroup -> Bool
compare :: PhyloGroup -> PhyloGroup -> Ordering
$ccompare :: PhyloGroup -> PhyloGroup -> Ordering
$cp1Ord :: Eq PhyloGroup
Ord)

-- instance NFData PhyloGroup


-- | Level : A level of aggregation (-1 = Txt, 0 = Ngrams, 1 = Fis, [2..] = Cluster)
type Level = Int
-- | Index : A generic index of an element (PhyloGroup, PhyloBranch, etc) in a given List
type Index = Int


type PhyloPeriodId = (Start, End)
type PhyloLevelId  = (PhyloPeriodId, Level)
type PhyloGroupId  = (PhyloLevelId, Index)
type PhyloBranchId = (Level, Index)


-- | Weight : A generic mesure that can be associated with an Id
type Weight = Double
-- | Pointer : A weighted linked with a given PhyloGroup
type Pointer = (PhyloGroupId, Weight)
-- | Ngrams : a contiguous sequence of n terms
type Ngrams = Text


--------------------
-- | Aggregates | --
--------------------


-- | Document : a piece of Text linked to a Date
data Document = Document
      { Document -> Int
date :: !Date
      , Document -> [Text]
text :: ![Ngrams]
      } deriving (Int -> Document -> ShowS
[Document] -> ShowS
Document -> String
(Int -> Document -> ShowS)
-> (Document -> String) -> ([Document] -> ShowS) -> Show Document
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Document] -> ShowS
$cshowList :: [Document] -> ShowS
show :: Document -> String
$cshow :: Document -> String
showsPrec :: Int -> Document -> ShowS
$cshowsPrec :: Int -> Document -> ShowS
Show,(forall x. Document -> Rep Document x)
-> (forall x. Rep Document x -> Document) -> Generic Document
forall x. Rep Document x -> Document
forall x. Document -> Rep Document x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Document x -> Document
$cfrom :: forall x. Document -> Rep Document x
Generic,Document -> ()
(Document -> ()) -> NFData Document
forall a. (a -> ()) -> NFData a
rnf :: Document -> ()
$crnf :: Document -> ()
NFData)

-- | Clique : Set of ngrams cooccurring in the same Document
type Clique   = Set Ngrams
-- | Support : Number of Documents where a Clique occurs
type Support  = Int
-- | Fis : Frequent Items Set (ie: the association between a Clique and a Support)
data PhyloFis = PhyloFis
  { PhyloFis -> Clique
_phyloFis_clique  :: !Clique
  , PhyloFis -> Int
_phyloFis_support :: !Support
  , PhyloFis -> (Int, Int)
_phyloFis_period  :: !(Date,Date)
  } deriving ((forall x. PhyloFis -> Rep PhyloFis x)
-> (forall x. Rep PhyloFis x -> PhyloFis) -> Generic PhyloFis
forall x. Rep PhyloFis x -> PhyloFis
forall x. PhyloFis -> Rep PhyloFis x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PhyloFis x -> PhyloFis
$cfrom :: forall x. PhyloFis -> Rep PhyloFis x
Generic,PhyloFis -> ()
(PhyloFis -> ()) -> NFData PhyloFis
forall a. (a -> ()) -> NFData a
rnf :: PhyloFis -> ()
$crnf :: PhyloFis -> ()
NFData,Int -> PhyloFis -> ShowS
[PhyloFis] -> ShowS
PhyloFis -> String
(Int -> PhyloFis -> ShowS)
-> (PhyloFis -> String) -> ([PhyloFis] -> ShowS) -> Show PhyloFis
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhyloFis] -> ShowS
$cshowList :: [PhyloFis] -> ShowS
show :: PhyloFis -> String
$cshow :: PhyloFis -> String
showsPrec :: Int -> PhyloFis -> ShowS
$cshowsPrec :: Int -> PhyloFis -> ShowS
Show,PhyloFis -> PhyloFis -> Bool
(PhyloFis -> PhyloFis -> Bool)
-> (PhyloFis -> PhyloFis -> Bool) -> Eq PhyloFis
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhyloFis -> PhyloFis -> Bool
$c/= :: PhyloFis -> PhyloFis -> Bool
== :: PhyloFis -> PhyloFis -> Bool
$c== :: PhyloFis -> PhyloFis -> Bool
Eq)

-- | A list of clustered PhyloGroup
type PhyloCluster = [PhyloGroup]


-- | A PhyloGroup in a Graph
type GroupNode  = PhyloGroup
-- | A weighted links between two PhyloGroups in a Graph
type GroupEdge  = ((PhyloGroup,PhyloGroup),Weight)
-- | The association as a Graph between a list of Nodes and a list of Edges
type GroupGraph = ([GroupNode],[GroupEdge])


---------------
-- | Error | --
---------------


data PhyloError = LevelDoesNotExist
                | LevelUnassigned
          deriving (Int -> PhyloError -> ShowS
[PhyloError] -> ShowS
PhyloError -> String
(Int -> PhyloError -> ShowS)
-> (PhyloError -> String)
-> ([PhyloError] -> ShowS)
-> Show PhyloError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhyloError] -> ShowS
$cshowList :: [PhyloError] -> ShowS
show :: PhyloError -> String
$cshow :: PhyloError -> String
showsPrec :: Int -> PhyloError -> ShowS
$cshowsPrec :: Int -> PhyloError -> ShowS
Show)


-----------------
-- | Cluster | --
-----------------


-- | Cluster constructors
data Cluster = Fis FisParams
             | RelatedComponents RCParams
             | Louvain LouvainParams
        deriving ((forall x. Cluster -> Rep Cluster x)
-> (forall x. Rep Cluster x -> Cluster) -> Generic Cluster
forall x. Rep Cluster x -> Cluster
forall x. Cluster -> Rep Cluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Cluster x -> Cluster
$cfrom :: forall x. Cluster -> Rep Cluster x
Generic, Int -> Cluster -> ShowS
[Cluster] -> ShowS
Cluster -> String
(Int -> Cluster -> ShowS)
-> (Cluster -> String) -> ([Cluster] -> ShowS) -> Show Cluster
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Cluster] -> ShowS
$cshowList :: [Cluster] -> ShowS
show :: Cluster -> String
$cshow :: Cluster -> String
showsPrec :: Int -> Cluster -> ShowS
$cshowsPrec :: Int -> Cluster -> ShowS
Show, Cluster -> Cluster -> Bool
(Cluster -> Cluster -> Bool)
-> (Cluster -> Cluster -> Bool) -> Eq Cluster
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Cluster -> Cluster -> Bool
$c/= :: Cluster -> Cluster -> Bool
== :: Cluster -> Cluster -> Bool
$c== :: Cluster -> Cluster -> Bool
Eq, ReadPrec [Cluster]
ReadPrec Cluster
Int -> ReadS Cluster
ReadS [Cluster]
(Int -> ReadS Cluster)
-> ReadS [Cluster]
-> ReadPrec Cluster
-> ReadPrec [Cluster]
-> Read Cluster
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Cluster]
$creadListPrec :: ReadPrec [Cluster]
readPrec :: ReadPrec Cluster
$creadPrec :: ReadPrec Cluster
readList :: ReadS [Cluster]
$creadList :: ReadS [Cluster]
readsPrec :: Int -> ReadS Cluster
$creadsPrec :: Int -> ReadS Cluster
Read)

-- | Parameters for Fis clustering
data FisParams = FisParams
  { FisParams -> Bool
_fis_keepMinorFis :: !Bool
  , FisParams -> Int
_fis_minSupport   :: !Support
  , FisParams -> Int
_fis_minSize      :: !Int
  } deriving ((forall x. FisParams -> Rep FisParams x)
-> (forall x. Rep FisParams x -> FisParams) -> Generic FisParams
forall x. Rep FisParams x -> FisParams
forall x. FisParams -> Rep FisParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FisParams x -> FisParams
$cfrom :: forall x. FisParams -> Rep FisParams x
Generic, Int -> FisParams -> ShowS
[FisParams] -> ShowS
FisParams -> String
(Int -> FisParams -> ShowS)
-> (FisParams -> String)
-> ([FisParams] -> ShowS)
-> Show FisParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FisParams] -> ShowS
$cshowList :: [FisParams] -> ShowS
show :: FisParams -> String
$cshow :: FisParams -> String
showsPrec :: Int -> FisParams -> ShowS
$cshowsPrec :: Int -> FisParams -> ShowS
Show, FisParams -> FisParams -> Bool
(FisParams -> FisParams -> Bool)
-> (FisParams -> FisParams -> Bool) -> Eq FisParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FisParams -> FisParams -> Bool
$c/= :: FisParams -> FisParams -> Bool
== :: FisParams -> FisParams -> Bool
$c== :: FisParams -> FisParams -> Bool
Eq, ReadPrec [FisParams]
ReadPrec FisParams
Int -> ReadS FisParams
ReadS [FisParams]
(Int -> ReadS FisParams)
-> ReadS [FisParams]
-> ReadPrec FisParams
-> ReadPrec [FisParams]
-> Read FisParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FisParams]
$creadListPrec :: ReadPrec [FisParams]
readPrec :: ReadPrec FisParams
$creadPrec :: ReadPrec FisParams
readList :: ReadS [FisParams]
$creadList :: ReadS [FisParams]
readsPrec :: Int -> ReadS FisParams
$creadsPrec :: Int -> ReadS FisParams
Read)

-- | Parameters for RelatedComponents clustering
data RCParams = RCParams
  { RCParams -> Proximity
_rc_proximity :: !Proximity } deriving ((forall x. RCParams -> Rep RCParams x)
-> (forall x. Rep RCParams x -> RCParams) -> Generic RCParams
forall x. Rep RCParams x -> RCParams
forall x. RCParams -> Rep RCParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RCParams x -> RCParams
$cfrom :: forall x. RCParams -> Rep RCParams x
Generic, Int -> RCParams -> ShowS
[RCParams] -> ShowS
RCParams -> String
(Int -> RCParams -> ShowS)
-> (RCParams -> String) -> ([RCParams] -> ShowS) -> Show RCParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RCParams] -> ShowS
$cshowList :: [RCParams] -> ShowS
show :: RCParams -> String
$cshow :: RCParams -> String
showsPrec :: Int -> RCParams -> ShowS
$cshowsPrec :: Int -> RCParams -> ShowS
Show, RCParams -> RCParams -> Bool
(RCParams -> RCParams -> Bool)
-> (RCParams -> RCParams -> Bool) -> Eq RCParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RCParams -> RCParams -> Bool
$c/= :: RCParams -> RCParams -> Bool
== :: RCParams -> RCParams -> Bool
$c== :: RCParams -> RCParams -> Bool
Eq, ReadPrec [RCParams]
ReadPrec RCParams
Int -> ReadS RCParams
ReadS [RCParams]
(Int -> ReadS RCParams)
-> ReadS [RCParams]
-> ReadPrec RCParams
-> ReadPrec [RCParams]
-> Read RCParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RCParams]
$creadListPrec :: ReadPrec [RCParams]
readPrec :: ReadPrec RCParams
$creadPrec :: ReadPrec RCParams
readList :: ReadS [RCParams]
$creadList :: ReadS [RCParams]
readsPrec :: Int -> ReadS RCParams
$creadsPrec :: Int -> ReadS RCParams
Read)

-- | Parameters for Louvain clustering
data LouvainParams = LouvainParams
  { LouvainParams -> Proximity
_louvain_proximity :: !Proximity } deriving ((forall x. LouvainParams -> Rep LouvainParams x)
-> (forall x. Rep LouvainParams x -> LouvainParams)
-> Generic LouvainParams
forall x. Rep LouvainParams x -> LouvainParams
forall x. LouvainParams -> Rep LouvainParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LouvainParams x -> LouvainParams
$cfrom :: forall x. LouvainParams -> Rep LouvainParams x
Generic, Int -> LouvainParams -> ShowS
[LouvainParams] -> ShowS
LouvainParams -> String
(Int -> LouvainParams -> ShowS)
-> (LouvainParams -> String)
-> ([LouvainParams] -> ShowS)
-> Show LouvainParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LouvainParams] -> ShowS
$cshowList :: [LouvainParams] -> ShowS
show :: LouvainParams -> String
$cshow :: LouvainParams -> String
showsPrec :: Int -> LouvainParams -> ShowS
$cshowsPrec :: Int -> LouvainParams -> ShowS
Show, LouvainParams -> LouvainParams -> Bool
(LouvainParams -> LouvainParams -> Bool)
-> (LouvainParams -> LouvainParams -> Bool) -> Eq LouvainParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LouvainParams -> LouvainParams -> Bool
$c/= :: LouvainParams -> LouvainParams -> Bool
== :: LouvainParams -> LouvainParams -> Bool
$c== :: LouvainParams -> LouvainParams -> Bool
Eq, ReadPrec [LouvainParams]
ReadPrec LouvainParams
Int -> ReadS LouvainParams
ReadS [LouvainParams]
(Int -> ReadS LouvainParams)
-> ReadS [LouvainParams]
-> ReadPrec LouvainParams
-> ReadPrec [LouvainParams]
-> Read LouvainParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LouvainParams]
$creadListPrec :: ReadPrec [LouvainParams]
readPrec :: ReadPrec LouvainParams
$creadPrec :: ReadPrec LouvainParams
readList :: ReadS [LouvainParams]
$creadList :: ReadS [LouvainParams]
readsPrec :: Int -> ReadS LouvainParams
$creadsPrec :: Int -> ReadS LouvainParams
Read)


-------------------
-- | Proximity | --
-------------------


-- | Proximity constructors
data Proximity = WeightedLogJaccard WLJParams
               | WeightedLogSim WLJParams
               | Hamming HammingParams
               | Filiation
          deriving ((forall x. Proximity -> Rep Proximity x)
-> (forall x. Rep Proximity x -> Proximity) -> Generic Proximity
forall x. Rep Proximity x -> Proximity
forall x. Proximity -> Rep Proximity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Proximity x -> Proximity
$cfrom :: forall x. Proximity -> Rep Proximity x
Generic, Int -> Proximity -> ShowS
[Proximity] -> ShowS
Proximity -> String
(Int -> Proximity -> ShowS)
-> (Proximity -> String)
-> ([Proximity] -> ShowS)
-> Show Proximity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Proximity] -> ShowS
$cshowList :: [Proximity] -> ShowS
show :: Proximity -> String
$cshow :: Proximity -> String
showsPrec :: Int -> Proximity -> ShowS
$cshowsPrec :: Int -> Proximity -> ShowS
Show, Proximity -> Proximity -> Bool
(Proximity -> Proximity -> Bool)
-> (Proximity -> Proximity -> Bool) -> Eq Proximity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Proximity -> Proximity -> Bool
$c/= :: Proximity -> Proximity -> Bool
== :: Proximity -> Proximity -> Bool
$c== :: Proximity -> Proximity -> Bool
Eq, ReadPrec [Proximity]
ReadPrec Proximity
Int -> ReadS Proximity
ReadS [Proximity]
(Int -> ReadS Proximity)
-> ReadS [Proximity]
-> ReadPrec Proximity
-> ReadPrec [Proximity]
-> Read Proximity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Proximity]
$creadListPrec :: ReadPrec [Proximity]
readPrec :: ReadPrec Proximity
$creadPrec :: ReadPrec Proximity
readList :: ReadS [Proximity]
$creadList :: ReadS [Proximity]
readsPrec :: Int -> ReadS Proximity
$creadsPrec :: Int -> ReadS Proximity
Read)

-- | Parameters for WeightedLogJaccard and WeightedLogSim proximity
data WLJParams = WLJParams
  { WLJParams -> Double
_wlj_threshold   :: !Double
  , WLJParams -> Double
_wlj_sensibility :: !Double
  } deriving ((forall x. WLJParams -> Rep WLJParams x)
-> (forall x. Rep WLJParams x -> WLJParams) -> Generic WLJParams
forall x. Rep WLJParams x -> WLJParams
forall x. WLJParams -> Rep WLJParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WLJParams x -> WLJParams
$cfrom :: forall x. WLJParams -> Rep WLJParams x
Generic, Int -> WLJParams -> ShowS
[WLJParams] -> ShowS
WLJParams -> String
(Int -> WLJParams -> ShowS)
-> (WLJParams -> String)
-> ([WLJParams] -> ShowS)
-> Show WLJParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WLJParams] -> ShowS
$cshowList :: [WLJParams] -> ShowS
show :: WLJParams -> String
$cshow :: WLJParams -> String
showsPrec :: Int -> WLJParams -> ShowS
$cshowsPrec :: Int -> WLJParams -> ShowS
Show, WLJParams -> WLJParams -> Bool
(WLJParams -> WLJParams -> Bool)
-> (WLJParams -> WLJParams -> Bool) -> Eq WLJParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WLJParams -> WLJParams -> Bool
$c/= :: WLJParams -> WLJParams -> Bool
== :: WLJParams -> WLJParams -> Bool
$c== :: WLJParams -> WLJParams -> Bool
Eq, ReadPrec [WLJParams]
ReadPrec WLJParams
Int -> ReadS WLJParams
ReadS [WLJParams]
(Int -> ReadS WLJParams)
-> ReadS [WLJParams]
-> ReadPrec WLJParams
-> ReadPrec [WLJParams]
-> Read WLJParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WLJParams]
$creadListPrec :: ReadPrec [WLJParams]
readPrec :: ReadPrec WLJParams
$creadPrec :: ReadPrec WLJParams
readList :: ReadS [WLJParams]
$creadList :: ReadS [WLJParams]
readsPrec :: Int -> ReadS WLJParams
$creadsPrec :: Int -> ReadS WLJParams
Read)

-- | Parameters for Hamming proximity
data HammingParams = HammingParams
  { HammingParams -> Double
_hamming_threshold :: !Double } deriving ((forall x. HammingParams -> Rep HammingParams x)
-> (forall x. Rep HammingParams x -> HammingParams)
-> Generic HammingParams
forall x. Rep HammingParams x -> HammingParams
forall x. HammingParams -> Rep HammingParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HammingParams x -> HammingParams
$cfrom :: forall x. HammingParams -> Rep HammingParams x
Generic, Int -> HammingParams -> ShowS
[HammingParams] -> ShowS
HammingParams -> String
(Int -> HammingParams -> ShowS)
-> (HammingParams -> String)
-> ([HammingParams] -> ShowS)
-> Show HammingParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HammingParams] -> ShowS
$cshowList :: [HammingParams] -> ShowS
show :: HammingParams -> String
$cshow :: HammingParams -> String
showsPrec :: Int -> HammingParams -> ShowS
$cshowsPrec :: Int -> HammingParams -> ShowS
Show, HammingParams -> HammingParams -> Bool
(HammingParams -> HammingParams -> Bool)
-> (HammingParams -> HammingParams -> Bool) -> Eq HammingParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HammingParams -> HammingParams -> Bool
$c/= :: HammingParams -> HammingParams -> Bool
== :: HammingParams -> HammingParams -> Bool
$c== :: HammingParams -> HammingParams -> Bool
Eq, ReadPrec [HammingParams]
ReadPrec HammingParams
Int -> ReadS HammingParams
ReadS [HammingParams]
(Int -> ReadS HammingParams)
-> ReadS [HammingParams]
-> ReadPrec HammingParams
-> ReadPrec [HammingParams]
-> Read HammingParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HammingParams]
$creadListPrec :: ReadPrec [HammingParams]
readPrec :: ReadPrec HammingParams
$creadPrec :: ReadPrec HammingParams
readList :: ReadS [HammingParams]
$creadList :: ReadS [HammingParams]
readsPrec :: Int -> ReadS HammingParams
$creadsPrec :: Int -> ReadS HammingParams
Read)


----------------
-- | Filter | --
----------------


-- | Filter constructors
data Filter = LonelyBranch LBParams
            | SizeBranch SBParams
            deriving ((forall x. Filter -> Rep Filter x)
-> (forall x. Rep Filter x -> Filter) -> Generic Filter
forall x. Rep Filter x -> Filter
forall x. Filter -> Rep Filter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Filter x -> Filter
$cfrom :: forall x. Filter -> Rep Filter x
Generic, Int -> Filter -> ShowS
[Filter] -> ShowS
Filter -> String
(Int -> Filter -> ShowS)
-> (Filter -> String) -> ([Filter] -> ShowS) -> Show Filter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Filter] -> ShowS
$cshowList :: [Filter] -> ShowS
show :: Filter -> String
$cshow :: Filter -> String
showsPrec :: Int -> Filter -> ShowS
$cshowsPrec :: Int -> Filter -> ShowS
Show, Filter -> Filter -> Bool
(Filter -> Filter -> Bool)
-> (Filter -> Filter -> Bool) -> Eq Filter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Filter -> Filter -> Bool
$c/= :: Filter -> Filter -> Bool
== :: Filter -> Filter -> Bool
$c== :: Filter -> Filter -> Bool
Eq)

-- | Parameters for LonelyBranch filter
data LBParams = LBParams
  { LBParams -> Int
_lb_periodsInf :: !Int
  , LBParams -> Int
_lb_periodsSup :: !Int
  , LBParams -> Int
_lb_minNodes   :: !Int } deriving ((forall x. LBParams -> Rep LBParams x)
-> (forall x. Rep LBParams x -> LBParams) -> Generic LBParams
forall x. Rep LBParams x -> LBParams
forall x. LBParams -> Rep LBParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LBParams x -> LBParams
$cfrom :: forall x. LBParams -> Rep LBParams x
Generic, Int -> LBParams -> ShowS
[LBParams] -> ShowS
LBParams -> String
(Int -> LBParams -> ShowS)
-> (LBParams -> String) -> ([LBParams] -> ShowS) -> Show LBParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LBParams] -> ShowS
$cshowList :: [LBParams] -> ShowS
show :: LBParams -> String
$cshow :: LBParams -> String
showsPrec :: Int -> LBParams -> ShowS
$cshowsPrec :: Int -> LBParams -> ShowS
Show, LBParams -> LBParams -> Bool
(LBParams -> LBParams -> Bool)
-> (LBParams -> LBParams -> Bool) -> Eq LBParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LBParams -> LBParams -> Bool
$c/= :: LBParams -> LBParams -> Bool
== :: LBParams -> LBParams -> Bool
$c== :: LBParams -> LBParams -> Bool
Eq)

-- | Parameters for SizeBranch filter
data SBParams = SBParams
  { SBParams -> Int
_sb_minSize :: !Int } deriving ((forall x. SBParams -> Rep SBParams x)
-> (forall x. Rep SBParams x -> SBParams) -> Generic SBParams
forall x. Rep SBParams x -> SBParams
forall x. SBParams -> Rep SBParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SBParams x -> SBParams
$cfrom :: forall x. SBParams -> Rep SBParams x
Generic, Int -> SBParams -> ShowS
[SBParams] -> ShowS
SBParams -> String
(Int -> SBParams -> ShowS)
-> (SBParams -> String) -> ([SBParams] -> ShowS) -> Show SBParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SBParams] -> ShowS
$cshowList :: [SBParams] -> ShowS
show :: SBParams -> String
$cshow :: SBParams -> String
showsPrec :: Int -> SBParams -> ShowS
$cshowsPrec :: Int -> SBParams -> ShowS
Show, SBParams -> SBParams -> Bool
(SBParams -> SBParams -> Bool)
-> (SBParams -> SBParams -> Bool) -> Eq SBParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SBParams -> SBParams -> Bool
$c/= :: SBParams -> SBParams -> Bool
== :: SBParams -> SBParams -> Bool
$c== :: SBParams -> SBParams -> Bool
Eq)


----------------
-- | Metric | --
----------------


-- | Metric constructors
data Metric = BranchAge | BranchBirth | BranchGroups deriving ((forall x. Metric -> Rep Metric x)
-> (forall x. Rep Metric x -> Metric) -> Generic Metric
forall x. Rep Metric x -> Metric
forall x. Metric -> Rep Metric x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Metric x -> Metric
$cfrom :: forall x. Metric -> Rep Metric x
Generic, Int -> Metric -> ShowS
[Metric] -> ShowS
Metric -> String
(Int -> Metric -> ShowS)
-> (Metric -> String) -> ([Metric] -> ShowS) -> Show Metric
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Metric] -> ShowS
$cshowList :: [Metric] -> ShowS
show :: Metric -> String
$cshow :: Metric -> String
showsPrec :: Int -> Metric -> ShowS
$cshowsPrec :: Int -> Metric -> ShowS
Show, Metric -> Metric -> Bool
(Metric -> Metric -> Bool)
-> (Metric -> Metric -> Bool) -> Eq Metric
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Metric -> Metric -> Bool
$c/= :: Metric -> Metric -> Bool
== :: Metric -> Metric -> Bool
$c== :: Metric -> Metric -> Bool
Eq, ReadPrec [Metric]
ReadPrec Metric
Int -> ReadS Metric
ReadS [Metric]
(Int -> ReadS Metric)
-> ReadS [Metric]
-> ReadPrec Metric
-> ReadPrec [Metric]
-> Read Metric
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Metric]
$creadListPrec :: ReadPrec [Metric]
readPrec :: ReadPrec Metric
$creadPrec :: ReadPrec Metric
readList :: ReadS [Metric]
$creadList :: ReadS [Metric]
readsPrec :: Int -> ReadS Metric
$creadsPrec :: Int -> ReadS Metric
Read)


----------------
-- | Tagger | --
----------------


-- | Tagger constructors
data Tagger = BranchPeakFreq | BranchPeakCooc | BranchPeakInc
            | GroupLabelCooc | GroupLabelInc  | GroupLabelIncDyn deriving (Int -> Tagger -> ShowS
[Tagger] -> ShowS
Tagger -> String
(Int -> Tagger -> ShowS)
-> (Tagger -> String) -> ([Tagger] -> ShowS) -> Show Tagger
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Tagger] -> ShowS
$cshowList :: [Tagger] -> ShowS
show :: Tagger -> String
$cshow :: Tagger -> String
showsPrec :: Int -> Tagger -> ShowS
$cshowsPrec :: Int -> Tagger -> ShowS
Show,(forall x. Tagger -> Rep Tagger x)
-> (forall x. Rep Tagger x -> Tagger) -> Generic Tagger
forall x. Rep Tagger x -> Tagger
forall x. Tagger -> Rep Tagger x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Tagger x -> Tagger
$cfrom :: forall x. Tagger -> Rep Tagger x
Generic,ReadPrec [Tagger]
ReadPrec Tagger
Int -> ReadS Tagger
ReadS [Tagger]
(Int -> ReadS Tagger)
-> ReadS [Tagger]
-> ReadPrec Tagger
-> ReadPrec [Tagger]
-> Read Tagger
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Tagger]
$creadListPrec :: ReadPrec [Tagger]
readPrec :: ReadPrec Tagger
$creadPrec :: ReadPrec Tagger
readList :: ReadS [Tagger]
$creadList :: ReadS [Tagger]
readsPrec :: Int -> ReadS Tagger
$creadsPrec :: Int -> ReadS Tagger
Read)


--------------
-- | Sort | --
--------------


-- | Sort constructors
data Sort  = ByBranchAge | ByBranchBirth deriving ((forall x. Sort -> Rep Sort x)
-> (forall x. Rep Sort x -> Sort) -> Generic Sort
forall x. Rep Sort x -> Sort
forall x. Sort -> Rep Sort x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Sort x -> Sort
$cfrom :: forall x. Sort -> Rep Sort x
Generic, Int -> Sort -> ShowS
[Sort] -> ShowS
Sort -> String
(Int -> Sort -> ShowS)
-> (Sort -> String) -> ([Sort] -> ShowS) -> Show Sort
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Sort] -> ShowS
$cshowList :: [Sort] -> ShowS
show :: Sort -> String
$cshow :: Sort -> String
showsPrec :: Int -> Sort -> ShowS
$cshowsPrec :: Int -> Sort -> ShowS
Show, ReadPrec [Sort]
ReadPrec Sort
Int -> ReadS Sort
ReadS [Sort]
(Int -> ReadS Sort)
-> ReadS [Sort] -> ReadPrec Sort -> ReadPrec [Sort] -> Read Sort
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Sort]
$creadListPrec :: ReadPrec [Sort]
readPrec :: ReadPrec Sort
$creadPrec :: ReadPrec Sort
readList :: ReadS [Sort]
$creadList :: ReadS [Sort]
readsPrec :: Int -> ReadS Sort
$creadsPrec :: Int -> ReadS Sort
Read, Int -> Sort
Sort -> Int
Sort -> [Sort]
Sort -> Sort
Sort -> Sort -> [Sort]
Sort -> Sort -> Sort -> [Sort]
(Sort -> Sort)
-> (Sort -> Sort)
-> (Int -> Sort)
-> (Sort -> Int)
-> (Sort -> [Sort])
-> (Sort -> Sort -> [Sort])
-> (Sort -> Sort -> [Sort])
-> (Sort -> Sort -> Sort -> [Sort])
-> Enum Sort
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Sort -> Sort -> Sort -> [Sort]
$cenumFromThenTo :: Sort -> Sort -> Sort -> [Sort]
enumFromTo :: Sort -> Sort -> [Sort]
$cenumFromTo :: Sort -> Sort -> [Sort]
enumFromThen :: Sort -> Sort -> [Sort]
$cenumFromThen :: Sort -> Sort -> [Sort]
enumFrom :: Sort -> [Sort]
$cenumFrom :: Sort -> [Sort]
fromEnum :: Sort -> Int
$cfromEnum :: Sort -> Int
toEnum :: Int -> Sort
$ctoEnum :: Int -> Sort
pred :: Sort -> Sort
$cpred :: Sort -> Sort
succ :: Sort -> Sort
$csucc :: Sort -> Sort
Enum, Sort
Sort -> Sort -> Bounded Sort
forall a. a -> a -> Bounded a
maxBound :: Sort
$cmaxBound :: Sort
minBound :: Sort
$cminBound :: Sort
Bounded)
data Order = Asc | Desc  deriving ((forall x. Order -> Rep Order x)
-> (forall x. Rep Order x -> Order) -> Generic Order
forall x. Rep Order x -> Order
forall x. Order -> Rep Order x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Order x -> Order
$cfrom :: forall x. Order -> Rep Order x
Generic, Int -> Order -> ShowS
[Order] -> ShowS
Order -> String
(Int -> Order -> ShowS)
-> (Order -> String) -> ([Order] -> ShowS) -> Show Order
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Order] -> ShowS
$cshowList :: [Order] -> ShowS
show :: Order -> String
$cshow :: Order -> String
showsPrec :: Int -> Order -> ShowS
$cshowsPrec :: Int -> Order -> ShowS
Show, ReadPrec [Order]
ReadPrec Order
Int -> ReadS Order
ReadS [Order]
(Int -> ReadS Order)
-> ReadS [Order]
-> ReadPrec Order
-> ReadPrec [Order]
-> Read Order
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Order]
$creadListPrec :: ReadPrec [Order]
readPrec :: ReadPrec Order
$creadPrec :: ReadPrec Order
readList :: ReadS [Order]
$creadList :: ReadS [Order]
readsPrec :: Int -> ReadS Order
$creadsPrec :: Int -> ReadS Order
Read)


--------------------
-- | PhyloQuery | --
--------------------


-- | A Phyloquery describes a phylomemic reconstruction
data PhyloQueryBuild = PhyloQueryBuild
    { PhyloQueryBuild -> Text
_q_phyloTitle :: !Text
    , PhyloQueryBuild -> Text
_q_phyloDesc  :: !Text

    -- Grain and Steps for the PhyloPeriods
    , PhyloQueryBuild -> Int
_q_periodGrain :: !Int
    , PhyloQueryBuild -> Int
_q_periodSteps :: !Int

    -- Clustering method for building the contextual unit of Phylo (ie: level 1)
    , PhyloQueryBuild -> Cluster
_q_contextualUnit :: !Cluster
    , PhyloQueryBuild -> [Metric]
_q_contextualUnitMetrics :: ![Metric]
    , PhyloQueryBuild -> [Filter]
_q_contextualUnitFilters :: ![Filter]

    -- Inter-temporal matching method of the Phylo
    , PhyloQueryBuild -> Proximity
_q_interTemporalMatching :: !Proximity
    , PhyloQueryBuild -> Int
_q_interTemporalMatchingFrame :: !Int
    , PhyloQueryBuild -> Double
_q_interTemporalMatchingFrameTh :: !Double

    , PhyloQueryBuild -> Double
_q_reBranchThr :: !Double
    , PhyloQueryBuild -> Int
_q_reBranchNth :: !Int

    -- Last level of reconstruction
    , PhyloQueryBuild -> Int
_q_nthLevel   :: !Level
    -- Clustering method used from level 1 to nthLevel
    , PhyloQueryBuild -> Cluster
_q_nthCluster :: !Cluster
    } deriving ((forall x. PhyloQueryBuild -> Rep PhyloQueryBuild x)
-> (forall x. Rep PhyloQueryBuild x -> PhyloQueryBuild)
-> Generic PhyloQueryBuild
forall x. Rep PhyloQueryBuild x -> PhyloQueryBuild
forall x. PhyloQueryBuild -> Rep PhyloQueryBuild x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PhyloQueryBuild x -> PhyloQueryBuild
$cfrom :: forall x. PhyloQueryBuild -> Rep PhyloQueryBuild x
Generic, Int -> PhyloQueryBuild -> ShowS
[PhyloQueryBuild] -> ShowS
PhyloQueryBuild -> String
(Int -> PhyloQueryBuild -> ShowS)
-> (PhyloQueryBuild -> String)
-> ([PhyloQueryBuild] -> ShowS)
-> Show PhyloQueryBuild
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhyloQueryBuild] -> ShowS
$cshowList :: [PhyloQueryBuild] -> ShowS
show :: PhyloQueryBuild -> String
$cshow :: PhyloQueryBuild -> String
showsPrec :: Int -> PhyloQueryBuild -> ShowS
$cshowsPrec :: Int -> PhyloQueryBuild -> ShowS
Show, PhyloQueryBuild -> PhyloQueryBuild -> Bool
(PhyloQueryBuild -> PhyloQueryBuild -> Bool)
-> (PhyloQueryBuild -> PhyloQueryBuild -> Bool)
-> Eq PhyloQueryBuild
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhyloQueryBuild -> PhyloQueryBuild -> Bool
$c/= :: PhyloQueryBuild -> PhyloQueryBuild -> Bool
== :: PhyloQueryBuild -> PhyloQueryBuild -> Bool
$c== :: PhyloQueryBuild -> PhyloQueryBuild -> Bool
Eq)

-- | To choose the Phylo edge you want to export : --> <-- <--> <=>
data Filiation = Ascendant | Descendant | Merge | Complete deriving ((forall x. Filiation -> Rep Filiation x)
-> (forall x. Rep Filiation x -> Filiation) -> Generic Filiation
forall x. Rep Filiation x -> Filiation
forall x. Filiation -> Rep Filiation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Filiation x -> Filiation
$cfrom :: forall x. Filiation -> Rep Filiation x
Generic, Int -> Filiation -> ShowS
[Filiation] -> ShowS
Filiation -> String
(Int -> Filiation -> ShowS)
-> (Filiation -> String)
-> ([Filiation] -> ShowS)
-> Show Filiation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Filiation] -> ShowS
$cshowList :: [Filiation] -> ShowS
show :: Filiation -> String
$cshow :: Filiation -> String
showsPrec :: Int -> Filiation -> ShowS
$cshowsPrec :: Int -> Filiation -> ShowS
Show, ReadPrec [Filiation]
ReadPrec Filiation
Int -> ReadS Filiation
ReadS [Filiation]
(Int -> ReadS Filiation)
-> ReadS [Filiation]
-> ReadPrec Filiation
-> ReadPrec [Filiation]
-> Read Filiation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Filiation]
$creadListPrec :: ReadPrec [Filiation]
readPrec :: ReadPrec Filiation
$creadPrec :: ReadPrec Filiation
readList :: ReadS [Filiation]
$creadList :: ReadS [Filiation]
readsPrec :: Int -> ReadS Filiation
$creadsPrec :: Int -> ReadS Filiation
Read)
data EdgeType  = PeriodEdge | LevelEdge deriving ((forall x. EdgeType -> Rep EdgeType x)
-> (forall x. Rep EdgeType x -> EdgeType) -> Generic EdgeType
forall x. Rep EdgeType x -> EdgeType
forall x. EdgeType -> Rep EdgeType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EdgeType x -> EdgeType
$cfrom :: forall x. EdgeType -> Rep EdgeType x
Generic, Int -> EdgeType -> ShowS
[EdgeType] -> ShowS
EdgeType -> String
(Int -> EdgeType -> ShowS)
-> (EdgeType -> String) -> ([EdgeType] -> ShowS) -> Show EdgeType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EdgeType] -> ShowS
$cshowList :: [EdgeType] -> ShowS
show :: EdgeType -> String
$cshow :: EdgeType -> String
showsPrec :: Int -> EdgeType -> ShowS
$cshowsPrec :: Int -> EdgeType -> ShowS
Show, EdgeType -> EdgeType -> Bool
(EdgeType -> EdgeType -> Bool)
-> (EdgeType -> EdgeType -> Bool) -> Eq EdgeType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EdgeType -> EdgeType -> Bool
$c/= :: EdgeType -> EdgeType -> Bool
== :: EdgeType -> EdgeType -> Bool
$c== :: EdgeType -> EdgeType -> Bool
Eq)

-------------------
-- | PhyloView | --
-------------------


-- | A PhyloView is the output type of a Phylo
data PhyloView = PhyloView
  { PhyloView -> PhyloParam
_pv_param       :: !PhyloParam
  , PhyloView -> Text
_pv_title       :: !Text
  , PhyloView -> Text
_pv_description :: !Text
  , PhyloView -> Filiation
_pv_filiation   :: !Filiation
  , PhyloView -> Int
_pv_level       :: !Level
  , PhyloView -> [(Int, Int)]
_pv_periods     :: ![PhyloPeriodId]
  , PhyloView -> Map Text [Double]
_pv_metrics     :: !(Map Text [Double])
  , PhyloView -> [PhyloBranch]
_pv_branches    :: ![PhyloBranch]
  , PhyloView -> [PhyloNode]
_pv_nodes       :: ![PhyloNode]
  , PhyloView -> [PhyloEdge]
_pv_edges       :: ![PhyloEdge]
  } deriving ((forall x. PhyloView -> Rep PhyloView x)
-> (forall x. Rep PhyloView x -> PhyloView) -> Generic PhyloView
forall x. Rep PhyloView x -> PhyloView
forall x. PhyloView -> Rep PhyloView x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PhyloView x -> PhyloView
$cfrom :: forall x. PhyloView -> Rep PhyloView x
Generic, Int -> PhyloView -> ShowS
[PhyloView] -> ShowS
PhyloView -> String
(Int -> PhyloView -> ShowS)
-> (PhyloView -> String)
-> ([PhyloView] -> ShowS)
-> Show PhyloView
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhyloView] -> ShowS
$cshowList :: [PhyloView] -> ShowS
show :: PhyloView -> String
$cshow :: PhyloView -> String
showsPrec :: Int -> PhyloView -> ShowS
$cshowsPrec :: Int -> PhyloView -> ShowS
Show)

-- | A phyloview is made of PhyloBranches, edges and nodes
data PhyloBranch = PhyloBranch
  { PhyloBranch -> (Int, Int)
_pb_id      :: !PhyloBranchId
  , PhyloBranch -> Text
_pb_peak    :: !Text
  , PhyloBranch -> Map Text [Double]
_pb_metrics :: !(Map Text [Double])
  } deriving ((forall x. PhyloBranch -> Rep PhyloBranch x)
-> (forall x. Rep PhyloBranch x -> PhyloBranch)
-> Generic PhyloBranch
forall x. Rep PhyloBranch x -> PhyloBranch
forall x. PhyloBranch -> Rep PhyloBranch x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PhyloBranch x -> PhyloBranch
$cfrom :: forall x. PhyloBranch -> Rep PhyloBranch x
Generic, Int -> PhyloBranch -> ShowS
[PhyloBranch] -> ShowS
PhyloBranch -> String
(Int -> PhyloBranch -> ShowS)
-> (PhyloBranch -> String)
-> ([PhyloBranch] -> ShowS)
-> Show PhyloBranch
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhyloBranch] -> ShowS
$cshowList :: [PhyloBranch] -> ShowS
show :: PhyloBranch -> String
$cshow :: PhyloBranch -> String
showsPrec :: Int -> PhyloBranch -> ShowS
$cshowsPrec :: Int -> PhyloBranch -> ShowS
Show)

data PhyloEdge = PhyloEdge
  { PhyloEdge -> PhyloGroupId
_pe_source :: !PhyloGroupId
  , PhyloEdge -> PhyloGroupId
_pe_target :: !PhyloGroupId
  , PhyloEdge -> EdgeType
_pe_type   :: !EdgeType
  , PhyloEdge -> Double
_pe_weight :: !Weight
  } deriving ((forall x. PhyloEdge -> Rep PhyloEdge x)
-> (forall x. Rep PhyloEdge x -> PhyloEdge) -> Generic PhyloEdge
forall x. Rep PhyloEdge x -> PhyloEdge
forall x. PhyloEdge -> Rep PhyloEdge x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PhyloEdge x -> PhyloEdge
$cfrom :: forall x. PhyloEdge -> Rep PhyloEdge x
Generic, Int -> PhyloEdge -> ShowS
[PhyloEdge] -> ShowS
PhyloEdge -> String
(Int -> PhyloEdge -> ShowS)
-> (PhyloEdge -> String)
-> ([PhyloEdge] -> ShowS)
-> Show PhyloEdge
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhyloEdge] -> ShowS
$cshowList :: [PhyloEdge] -> ShowS
show :: PhyloEdge -> String
$cshow :: PhyloEdge -> String
showsPrec :: Int -> PhyloEdge -> ShowS
$cshowsPrec :: Int -> PhyloEdge -> ShowS
Show)

data PhyloNode = PhyloNode
  { PhyloNode -> PhyloGroupId
_pn_id      :: !PhyloGroupId
  , PhyloNode -> Maybe (Int, Int)
_pn_bid     :: !(Maybe PhyloBranchId)
  , PhyloNode -> Text
_pn_label   :: !Text
  , PhyloNode -> [Int]
_pn_idx     :: ![Int]
  , PhyloNode -> Maybe [Text]
_pn_ngrams  :: !(Maybe [Ngrams])
  , PhyloNode -> Map Text [Double]
_pn_metrics :: !(Map Text [Double])
  , PhyloNode -> Map (Int, Int) Double
_pn_cooc    :: !(Map (Int,Int) Double)
  , PhyloNode -> Maybe [PhyloGroupId]
_pn_parents :: !(Maybe [PhyloGroupId])
  , PhyloNode -> [PhyloNode]
_pn_childs  :: ![PhyloNode]
  } deriving ((forall x. PhyloNode -> Rep PhyloNode x)
-> (forall x. Rep PhyloNode x -> PhyloNode) -> Generic PhyloNode
forall x. Rep PhyloNode x -> PhyloNode
forall x. PhyloNode -> Rep PhyloNode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PhyloNode x -> PhyloNode
$cfrom :: forall x. PhyloNode -> Rep PhyloNode x
Generic, Int -> PhyloNode -> ShowS
[PhyloNode] -> ShowS
PhyloNode -> String
(Int -> PhyloNode -> ShowS)
-> (PhyloNode -> String)
-> ([PhyloNode] -> ShowS)
-> Show PhyloNode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhyloNode] -> ShowS
$cshowList :: [PhyloNode] -> ShowS
show :: PhyloNode -> String
$cshow :: PhyloNode -> String
showsPrec :: Int -> PhyloNode -> ShowS
$cshowsPrec :: Int -> PhyloNode -> ShowS
Show)

------------------------
-- | PhyloQueryView | --
------------------------


data ExportMode = Json | Dot | Svg
  deriving ((forall x. ExportMode -> Rep ExportMode x)
-> (forall x. Rep ExportMode x -> ExportMode) -> Generic ExportMode
forall x. Rep ExportMode x -> ExportMode
forall x. ExportMode -> Rep ExportMode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExportMode x -> ExportMode
$cfrom :: forall x. ExportMode -> Rep ExportMode x
Generic, Int -> ExportMode -> ShowS
[ExportMode] -> ShowS
ExportMode -> String
(Int -> ExportMode -> ShowS)
-> (ExportMode -> String)
-> ([ExportMode] -> ShowS)
-> Show ExportMode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExportMode] -> ShowS
$cshowList :: [ExportMode] -> ShowS
show :: ExportMode -> String
$cshow :: ExportMode -> String
showsPrec :: Int -> ExportMode -> ShowS
$cshowsPrec :: Int -> ExportMode -> ShowS
Show, ReadPrec [ExportMode]
ReadPrec ExportMode
Int -> ReadS ExportMode
ReadS [ExportMode]
(Int -> ReadS ExportMode)
-> ReadS [ExportMode]
-> ReadPrec ExportMode
-> ReadPrec [ExportMode]
-> Read ExportMode
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExportMode]
$creadListPrec :: ReadPrec [ExportMode]
readPrec :: ReadPrec ExportMode
$creadPrec :: ReadPrec ExportMode
readList :: ReadS [ExportMode]
$creadList :: ReadS [ExportMode]
readsPrec :: Int -> ReadS ExportMode
$creadsPrec :: Int -> ReadS ExportMode
Read)
data DisplayMode = Flat | Nested
  deriving ((forall x. DisplayMode -> Rep DisplayMode x)
-> (forall x. Rep DisplayMode x -> DisplayMode)
-> Generic DisplayMode
forall x. Rep DisplayMode x -> DisplayMode
forall x. DisplayMode -> Rep DisplayMode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DisplayMode x -> DisplayMode
$cfrom :: forall x. DisplayMode -> Rep DisplayMode x
Generic, Int -> DisplayMode -> ShowS
[DisplayMode] -> ShowS
DisplayMode -> String
(Int -> DisplayMode -> ShowS)
-> (DisplayMode -> String)
-> ([DisplayMode] -> ShowS)
-> Show DisplayMode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisplayMode] -> ShowS
$cshowList :: [DisplayMode] -> ShowS
show :: DisplayMode -> String
$cshow :: DisplayMode -> String
showsPrec :: Int -> DisplayMode -> ShowS
$cshowsPrec :: Int -> DisplayMode -> ShowS
Show, ReadPrec [DisplayMode]
ReadPrec DisplayMode
Int -> ReadS DisplayMode
ReadS [DisplayMode]
(Int -> ReadS DisplayMode)
-> ReadS [DisplayMode]
-> ReadPrec DisplayMode
-> ReadPrec [DisplayMode]
-> Read DisplayMode
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisplayMode]
$creadListPrec :: ReadPrec [DisplayMode]
readPrec :: ReadPrec DisplayMode
$creadPrec :: ReadPrec DisplayMode
readList :: ReadS [DisplayMode]
$creadList :: ReadS [DisplayMode]
readsPrec :: Int -> ReadS DisplayMode
$creadsPrec :: Int -> ReadS DisplayMode
Read)

-- | A PhyloQueryView describes a Phylo as an output view
data PhyloQueryView = PhyloQueryView
  { PhyloQueryView -> Int
_qv_lvl    :: !Level

  -- Does the PhyloGraph contain ascendant, descendant or a complete Filiation ? Complet redondant et merge (avec le max)
  , PhyloQueryView -> Filiation
_qv_filiation :: !Filiation

  -- Does the PhyloGraph contain some levelChilds ? How deep must it go ?
  , PhyloQueryView -> Bool
_qv_levelChilds      :: !Bool
  , PhyloQueryView -> Int
_qv_levelChildsDepth :: !Level

  -- Ordered lists of filters, taggers and metrics to be applied to the PhyloGraph
  -- Firstly the metrics, then the filters and the taggers
  , PhyloQueryView -> [Metric]
_qv_metrics :: ![Metric]
  , PhyloQueryView -> [Filter]
_qv_filters :: ![Filter]
  , PhyloQueryView -> [Tagger]
_qv_taggers :: ![Tagger]

  -- An asc or desc sort to apply to the PhyloGraph
  , PhyloQueryView -> Maybe (Sort, Order)
_qv_sort :: !(Maybe (Sort,Order))

  -- A display mode to apply to the PhyloGraph, ie: [Node[Node,Edge],Edge] or [[Node,Node],[Edge,Edge]]
  , PhyloQueryView -> ExportMode
_qv_export  :: !ExportMode
  , PhyloQueryView -> DisplayMode
_qv_display :: !DisplayMode
  , PhyloQueryView -> Bool
_qv_verbose :: !Bool
  }


----------------
-- | Lenses | --
----------------


makeLenses ''PhyloParam
makeLenses ''Software
--
makeLenses ''Phylo
makeLenses ''PhyloFoundations
makeLenses ''PhyloGroup
makeLenses ''PhyloLevel
makeLenses ''PhyloPeriod
makeLenses ''PhyloFis
--
makeLenses ''Proximity
makeLenses ''Cluster
makeLenses ''Filter
--
makeLenses ''PhyloQueryBuild
makeLenses ''PhyloQueryView
--
makeLenses ''PhyloView
makeLenses ''PhyloBranch
makeLenses ''PhyloNode
makeLenses ''PhyloEdge


------------------------
-- | JSON instances | --
------------------------


$(deriveJSON (unPrefix "_phylo_"       ) ''Phylo       )
$(deriveJSON (unPrefix "_phylo_foundations"  ) ''PhyloFoundations  )
$(deriveJSON (unPrefix "_phylo_period" ) ''PhyloPeriod )
$(deriveJSON (unPrefix "_phylo_level"  ) ''PhyloLevel  )
$(deriveJSON (unPrefix "_phylo_group"  ) ''PhyloGroup  )
$(deriveJSON (unPrefix "_phyloFis_"    ) ''PhyloFis    )
--
$(deriveJSON (unPrefix "_software_"    ) ''Software    )
$(deriveJSON (unPrefix "_phyloParam_"  ) ''PhyloParam  )
--
$(deriveJSON defaultOptions ''Filter    )
$(deriveJSON defaultOptions ''Metric    )
$(deriveJSON defaultOptions ''Cluster   )
$(deriveJSON defaultOptions ''Proximity )
--
$(deriveJSON (unPrefix "_fis_" )     ''FisParams     )
$(deriveJSON (unPrefix "_hamming_" ) ''HammingParams )
$(deriveJSON (unPrefix "_louvain_" ) ''LouvainParams )
$(deriveJSON (unPrefix "_rc_" )      ''RCParams      )
$(deriveJSON (unPrefix "_wlj_" )     ''WLJParams     )
--
$(deriveJSON (unPrefix "_lb_" )      ''LBParams      )
$(deriveJSON (unPrefix "_sb_" )      ''SBParams      )
--
$(deriveJSON (unPrefix "_q_" )  ''PhyloQueryBuild  )
$(deriveJSON (unPrefix "_pv_" ) ''PhyloView   )
$(deriveJSON (unPrefix "_pb_" ) ''PhyloBranch )
$(deriveJSON (unPrefix "_pe_" ) ''PhyloEdge   )
$(deriveJSON (unPrefix "_pn_" ) ''PhyloNode   )

$(deriveJSON defaultOptions ''Filiation )
$(deriveJSON defaultOptions ''EdgeType  )

---------------------------
-- | Swagger instances | --
---------------------------

instance ToSchema Phylo where
  declareNamedSchema :: Proxy Phylo -> Declare (Definitions Schema) NamedSchema
declareNamedSchema = SchemaOptions
-> Proxy Phylo -> Declare (Definitions Schema) NamedSchema
forall a.
(Generic a, GToSchema (Rep a),
 TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
SchemaOptions
-> Proxy a -> Declare (Definitions Schema) NamedSchema
genericDeclareNamedSchema (String -> SchemaOptions
unPrefixSwagger String
"_phylo_")
instance ToSchema PhyloFoundations where
  declareNamedSchema :: Proxy PhyloFoundations -> Declare (Definitions Schema) NamedSchema
declareNamedSchema = SchemaOptions
-> Proxy PhyloFoundations
-> Declare (Definitions Schema) NamedSchema
forall a.
(Generic a, GToSchema (Rep a),
 TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
SchemaOptions
-> Proxy a -> Declare (Definitions Schema) NamedSchema
genericDeclareNamedSchema (String -> SchemaOptions
unPrefixSwagger String
"_phylo_foundations")
instance ToSchema PhyloPeriod where
  declareNamedSchema :: Proxy PhyloPeriod -> Declare (Definitions Schema) NamedSchema
declareNamedSchema = SchemaOptions
-> Proxy PhyloPeriod -> Declare (Definitions Schema) NamedSchema
forall a.
(Generic a, GToSchema (Rep a),
 TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
SchemaOptions
-> Proxy a -> Declare (Definitions Schema) NamedSchema
genericDeclareNamedSchema (String -> SchemaOptions
unPrefixSwagger String
"_phylo_period")
instance ToSchema PhyloLevel where
  declareNamedSchema :: Proxy PhyloLevel -> Declare (Definitions Schema) NamedSchema
declareNamedSchema = SchemaOptions
-> Proxy PhyloLevel -> Declare (Definitions Schema) NamedSchema
forall a.
(Generic a, GToSchema (Rep a),
 TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
SchemaOptions
-> Proxy a -> Declare (Definitions Schema) NamedSchema
genericDeclareNamedSchema (String -> SchemaOptions
unPrefixSwagger String
"_phylo_level")
instance ToSchema PhyloGroup where
  declareNamedSchema :: Proxy PhyloGroup -> Declare (Definitions Schema) NamedSchema
declareNamedSchema = SchemaOptions
-> Proxy PhyloGroup -> Declare (Definitions Schema) NamedSchema
forall a.
(Generic a, GToSchema (Rep a),
 TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
SchemaOptions
-> Proxy a -> Declare (Definitions Schema) NamedSchema
genericDeclareNamedSchema (String -> SchemaOptions
unPrefixSwagger String
"_phylo_group")
instance ToSchema PhyloFis where
  declareNamedSchema :: Proxy PhyloFis -> Declare (Definitions Schema) NamedSchema
declareNamedSchema = SchemaOptions
-> Proxy PhyloFis -> Declare (Definitions Schema) NamedSchema
forall a.
(Generic a, GToSchema (Rep a),
 TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
SchemaOptions
-> Proxy a -> Declare (Definitions Schema) NamedSchema
genericDeclareNamedSchema (String -> SchemaOptions
unPrefixSwagger String
"_phyloFis_")
instance ToSchema Software where
  declareNamedSchema :: Proxy Software -> Declare (Definitions Schema) NamedSchema
declareNamedSchema = SchemaOptions
-> Proxy Software -> Declare (Definitions Schema) NamedSchema
forall a.
(Generic a, GToSchema (Rep a),
 TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
SchemaOptions
-> Proxy a -> Declare (Definitions Schema) NamedSchema
genericDeclareNamedSchema (String -> SchemaOptions
unPrefixSwagger String
"_software_")
instance ToSchema PhyloParam where
  declareNamedSchema :: Proxy PhyloParam -> Declare (Definitions Schema) NamedSchema
declareNamedSchema = SchemaOptions
-> Proxy PhyloParam -> Declare (Definitions Schema) NamedSchema
forall a.
(Generic a, GToSchema (Rep a),
 TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
SchemaOptions
-> Proxy a -> Declare (Definitions Schema) NamedSchema
genericDeclareNamedSchema (String -> SchemaOptions
unPrefixSwagger String
"_phyloParam_")
instance ToSchema Filter
instance ToSchema Metric
instance ToSchema Cluster
instance ToSchema Proximity where
  declareNamedSchema :: Proxy Proximity -> Declare (Definitions Schema) NamedSchema
declareNamedSchema = SchemaOptions
-> Proxy Proximity -> Declare (Definitions Schema) NamedSchema
forall a.
(Generic a, GToSchema (Rep a)) =>
SchemaOptions
-> Proxy a -> Declare (Definitions Schema) NamedSchema
genericDeclareNamedSchemaUnrestricted SchemaOptions
defaultSchemaOptions
instance ToSchema FisParams where
  declareNamedSchema :: Proxy FisParams -> Declare (Definitions Schema) NamedSchema
declareNamedSchema = SchemaOptions
-> Proxy FisParams -> Declare (Definitions Schema) NamedSchema
forall a.
(Generic a, GToSchema (Rep a),
 TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
SchemaOptions
-> Proxy a -> Declare (Definitions Schema) NamedSchema
genericDeclareNamedSchema (String -> SchemaOptions
unPrefixSwagger String
"_fis_")
instance ToSchema HammingParams where
  declareNamedSchema :: Proxy HammingParams -> Declare (Definitions Schema) NamedSchema
declareNamedSchema = SchemaOptions
-> Proxy HammingParams -> Declare (Definitions Schema) NamedSchema
forall a.
(Generic a, GToSchema (Rep a),
 TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
SchemaOptions
-> Proxy a -> Declare (Definitions Schema) NamedSchema
genericDeclareNamedSchema (String -> SchemaOptions
unPrefixSwagger String
"_hamming_")
instance ToSchema LouvainParams where
  declareNamedSchema :: Proxy LouvainParams -> Declare (Definitions Schema) NamedSchema
declareNamedSchema = SchemaOptions
-> Proxy LouvainParams -> Declare (Definitions Schema) NamedSchema
forall a.
(Generic a, GToSchema (Rep a),
 TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
SchemaOptions
-> Proxy a -> Declare (Definitions Schema) NamedSchema
genericDeclareNamedSchema (String -> SchemaOptions
unPrefixSwagger String
"_louvain_")
instance ToSchema RCParams where
  declareNamedSchema :: Proxy RCParams -> Declare (Definitions Schema) NamedSchema
declareNamedSchema = SchemaOptions
-> Proxy RCParams -> Declare (Definitions Schema) NamedSchema
forall a.
(Generic a, GToSchema (Rep a),
 TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
SchemaOptions
-> Proxy a -> Declare (Definitions Schema) NamedSchema
genericDeclareNamedSchema (String -> SchemaOptions
unPrefixSwagger String
"_rc_")
instance ToSchema WLJParams where
  declareNamedSchema :: Proxy WLJParams -> Declare (Definitions Schema) NamedSchema
declareNamedSchema = SchemaOptions
-> Proxy WLJParams -> Declare (Definitions Schema) NamedSchema
forall a.
(Generic a, GToSchema (Rep a),
 TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
SchemaOptions
-> Proxy a -> Declare (Definitions Schema) NamedSchema
genericDeclareNamedSchema (String -> SchemaOptions
unPrefixSwagger String
"_wlj_")
instance ToSchema LBParams where
  declareNamedSchema :: Proxy LBParams -> Declare (Definitions Schema) NamedSchema
declareNamedSchema = SchemaOptions
-> Proxy LBParams -> Declare (Definitions Schema) NamedSchema
forall a.
(Generic a, GToSchema (Rep a),
 TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
SchemaOptions
-> Proxy a -> Declare (Definitions Schema) NamedSchema
genericDeclareNamedSchema (String -> SchemaOptions
unPrefixSwagger String
"_lb_")
instance ToSchema SBParams where
  declareNamedSchema :: Proxy SBParams -> Declare (Definitions Schema) NamedSchema
declareNamedSchema = SchemaOptions
-> Proxy SBParams -> Declare (Definitions Schema) NamedSchema
forall a.
(Generic a, GToSchema (Rep a),
 TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
SchemaOptions
-> Proxy a -> Declare (Definitions Schema) NamedSchema
genericDeclareNamedSchema (String -> SchemaOptions
unPrefixSwagger String
"_sb_")
instance ToSchema PhyloQueryBuild where
  declareNamedSchema :: Proxy PhyloQueryBuild -> Declare (Definitions Schema) NamedSchema
declareNamedSchema = SchemaOptions
-> Proxy PhyloQueryBuild
-> Declare (Definitions Schema) NamedSchema
forall a.
(Generic a, GToSchema (Rep a),
 TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
SchemaOptions
-> Proxy a -> Declare (Definitions Schema) NamedSchema
genericDeclareNamedSchema (String -> SchemaOptions
unPrefixSwagger String
"_q_")
instance ToSchema PhyloView where
  declareNamedSchema :: Proxy PhyloView -> Declare (Definitions Schema) NamedSchema
declareNamedSchema = SchemaOptions
-> Proxy PhyloView -> Declare (Definitions Schema) NamedSchema
forall a.
(Generic a, GToSchema (Rep a),
 TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
SchemaOptions
-> Proxy a -> Declare (Definitions Schema) NamedSchema
genericDeclareNamedSchema (String -> SchemaOptions
unPrefixSwagger String
"_pv_")
instance ToSchema PhyloBranch where
  declareNamedSchema :: Proxy PhyloBranch -> Declare (Definitions Schema) NamedSchema
declareNamedSchema = SchemaOptions
-> Proxy PhyloBranch -> Declare (Definitions Schema) NamedSchema
forall a.
(Generic a, GToSchema (Rep a),
 TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
SchemaOptions
-> Proxy a -> Declare (Definitions Schema) NamedSchema
genericDeclareNamedSchema (String -> SchemaOptions
unPrefixSwagger String
"_pb_")
instance ToSchema PhyloEdge where
  declareNamedSchema :: Proxy PhyloEdge -> Declare (Definitions Schema) NamedSchema
declareNamedSchema = SchemaOptions
-> Proxy PhyloEdge -> Declare (Definitions Schema) NamedSchema
forall a.
(Generic a, GToSchema (Rep a),
 TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
SchemaOptions
-> Proxy a -> Declare (Definitions Schema) NamedSchema
genericDeclareNamedSchema (String -> SchemaOptions
unPrefixSwagger String
"_pe_")
instance ToSchema PhyloNode where
  declareNamedSchema :: Proxy PhyloNode -> Declare (Definitions Schema) NamedSchema
declareNamedSchema = SchemaOptions
-> Proxy PhyloNode -> Declare (Definitions Schema) NamedSchema
forall a.
(Generic a, GToSchema (Rep a),
 TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
SchemaOptions
-> Proxy a -> Declare (Definitions Schema) NamedSchema
genericDeclareNamedSchema (String -> SchemaOptions
unPrefixSwagger String
"_pn_")
instance ToSchema Filiation
instance ToSchema EdgeType

----------------------------
-- | TODO XML instances | --
----------------------------