This documentation is intended to present the outputs of a sample dataset.

Launch the workflow to find the motifs

The workflow consists of 3 steps described in the main package documentation. These 3 steps will be applied on our sample.

  1. The function NormSAX allows the normalization and SAX indexing of the dataset:

# The process is launched on the provided example dataset
dim(D <- STMotif::example_dataset)
#> [1] 100  50


# Normalizartion and SAX indexing
DS <- NormSAX(D = STMotif::example_dataset,a =7)

# Information of the normalized and SAX indexing dataset 
# The candidates built 
head(NormSAX(D = STMotif::example_dataset, a = 7)[,1:10])
#>   1 2 3 4 5 6 7 8 9 10
#> 1 e f e e f e f f d  d
#> 2 d e e d f f d b b  e
#> 3 d c c c e e b b c  e
#> 4 c b c b c c c f f  e
#> 5 c c d c b b e f f  d
#> 6 e d d e b b c c c  c
  1. The function SearchSTMotifs allows to check and filter the stmotifs, grouping the motifs from the neighboring block.
# The list of motifs 
# stmotifs <- SearchSTMotifs(D,DS,w,a,sb,tb,si,ka)
head(stmotifs <- SearchSTMotifs(D,DS,3,7,10,10,3,10))
#> $aaa
#> $aaa$isaxcod
#> [1] "aaa"
#> 
#> $aaa$recmatrix
#>       [,1] [,2] [,3] [,4] [,5]
#>  [1,]    0    0    0    0    0
#>  [2,]    0    0    0    0    0
#>  [3,]    0    0    0    0    0
#>  [4,]    0    0    0    0    0
#>  [5,]    0    0    0    0    0
#>  [6,]    0    0    0    0    0
#>  [7,]    0    0    0    0    0
#>  [8,]    1    0    0    0    0
#>  [9,]    0    0    0    0    0
#> [10,]    0    0    0    0    0
#> 
#> $aaa$vecst
#>     s  t
#> 1   1 73
#> 2   2 74
#> 3   3 74
#> 4   4 75
#> 5   5 76
#> 6   6 77
#> 7   7 77
#> 8   8 77
#> 9   9 78
#> 10 10 78
#> 
#> 
#> $aaa
#> $aaa$isaxcod
#> [1] "aaa"
#> 
#> $aaa$recmatrix
#>       [,1] [,2] [,3] [,4] [,5]
#>  [1,]    0    0    0    0    0
#>  [2,]    0    0    0    0    0
#>  [3,]    0    0    0    0    0
#>  [4,]    0    0    0    0    0
#>  [5,]    0    0    0    0    0
#>  [6,]    0    0    0    0    0
#>  [7,]    0    0    0    0    0
#>  [8,]    0    0    0    0    0
#>  [9,]    0    0    2    2    2
#> [10,]    0    0    0    0    0
#> 
#> $aaa$vecst
#>     s  t
#> 11 21 86
#> 12 22 87
#> 13 23 87
#> 14 24 87
#> 15 25 87
#> 16 26 86
#> 17 27 85
#> 18 28 85
#> 19 29 85
#> 20 30 85
#> 21 31 85
#> 22 32 85
#> 23 33 84
#> 24 34 84
#> 25 35 83
#> 26 35 84
#> 27 36 83
#> 28 37 83
#> 29 38 83
#> 30 39 83
#> 31 40 83
#> 32 41 83
#> 33 42 83
#> 34 43 82
#> 35 44 82
#> 36 45 82
#> 37 46 82
#> 38 47 82
#> 39 48 82
#> 40 49 82
#> 41 50 82
#> 
#> 
#> $ggg
#> $ggg$isaxcod
#> [1] "ggg"
#> 
#> $ggg$recmatrix
#>       [,1] [,2] [,3] [,4] [,5]
#>  [1,]    0    0    0    0    0
#>  [2,]    0    0    0    0    0
#>  [3,]    0    0    0    0    0
#>  [4,]    0    0    0    0    0
#>  [5,]    0    0    0    0    0
#>  [6,]    0    0    0    0    0
#>  [7,]    0    0    0    0    0
#>  [8,]    0    0    0    0    0
#>  [9,]    0    0    1    0    0
#> [10,]    0    0    0    0    0
#> 
#> $ggg$vecst
#>     s  t
#> 1  21 81
#> 2  21 82
#> 3  21 83
#> 4  22 81
#> 5  22 82
#> 6  22 83
#> 7  23 82
#> 8  23 83
#> 9  23 84
#> 10 24 82
#> 11 24 83
#> 12 24 84
#> 13 25 82
#> 14 25 83
#> 15 26 81
#> 16 26 82
#> 17 26 83
#> 18 27 81
#> 19 27 82
#> 20 28 81
#> 21 28 82
#> 22 29 81
#> 23 29 82
#> 24 30 81
#> 
#> 
#> $ggg
#> $ggg$isaxcod
#> [1] "ggg"
#> 
#> $ggg$recmatrix
#>       [,1] [,2] [,3] [,4] [,5]
#>  [1,]    0    0    0    0    0
#>  [2,]    0    0    0    0    0
#>  [3,]    0    0    0    0    0
#>  [4,]    0    0    0    0    0
#>  [5,]    0    0    0    0    0
#>  [6,]    0    0    0    0    0
#>  [7,]    0    0    0    0    0
#>  [8,]    0    0    0    0    2
#>  [9,]    0    0    0    0    0
#> [10,]    0    0    0    0    0
#> 
#> $ggg$vecst
#>     s  t
#> 25 41 77
#> 26 41 78
#> 27 42 77
#> 28 42 78
#> 29 43 76
#> 30 43 77
#> 31 43 78
#> 32 44 76
#> 33 44 77
#> 34 44 78
#> 35 45 76
#> 36 45 77
#> 37 45 78
#> 38 46 77
#> 39 46 78
#> 40 47 76
#> 41 47 77
#> 42 47 78
#> 43 48 76
#> 44 48 77
#> 45 48 78
#> 46 49 76
#> 47 49 77
#> 48 49 78
#> 49 50 76
#> 50 50 77
#> 51 50 78
  1. The function RankSTMotifs allows to rank the stmotifs list, making a balance between distance among the occurrences of a motif with the encoded information on the motif itself and his quantity.
# The rank list of stmotifs 
# rstmotifs <- RankSTMotifs(stmotifs)
head(rstmotifs <- RankSTMotifs(stmotifs))
#> [[1]]
#> [[1]]$isaxcod
#> [1] "aaa"
#> 
#> [[1]]$recmatrix
#>       [,1] [,2] [,3] [,4] [,5]
#>  [1,]    0    0    0    0    0
#>  [2,]    0    0    0    0    0
#>  [3,]    0    0    0    0    0
#>  [4,]    0    0    0    0    0
#>  [5,]    0    0    0    0    0
#>  [6,]    0    0    0    0    0
#>  [7,]    0    0    0    0    0
#>  [8,]    1    0    0    0    0
#>  [9,]    0    0    0    0    0
#> [10,]    0    0    0    0    0
#> 
#> [[1]]$vecst
#>     s  t
#> 1   1 73
#> 2   2 74
#> 3   3 74
#> 4   4 75
#> 5   5 76
#> 6   6 77
#> 7   7 77
#> 8   8 77
#> 9   9 78
#> 10 10 78
#> 
#> [[1]]$rank
#> [[1]]$rank$dist
#> [1] 0.8492424
#> 
#> [[1]]$rank$word
#> [1] 0
#> 
#> [[1]]$rank$qtd
#> [1] 3.321928
#> 
#> [[1]]$rank$proj
#>   [,1]
#> 1  NaN
#> 
#> 
#> 
#> [[2]]
#> [[2]]$isaxcod
#> [1] "aaa"
#> 
#> [[2]]$recmatrix
#>       [,1] [,2] [,3] [,4] [,5]
#>  [1,]    0    0    0    0    0
#>  [2,]    0    0    0    0    0
#>  [3,]    0    0    0    0    0
#>  [4,]    0    0    0    0    0
#>  [5,]    0    0    0    0    0
#>  [6,]    0    0    0    0    0
#>  [7,]    0    0    0    0    0
#>  [8,]    0    0    0    0    0
#>  [9,]    0    0    2    2    2
#> [10,]    0    0    0    0    0
#> 
#> [[2]]$vecst
#>     s  t
#> 11 21 86
#> 12 22 87
#> 13 23 87
#> 14 24 87
#> 15 25 87
#> 16 26 86
#> 17 27 85
#> 18 28 85
#> 19 29 85
#> 20 30 85
#> 21 31 85
#> 22 32 85
#> 23 33 84
#> 24 34 84
#> 25 35 83
#> 26 35 84
#> 27 36 83
#> 28 37 83
#> 29 38 83
#> 30 39 83
#> 31 40 83
#> 32 41 83
#> 33 42 83
#> 34 43 82
#> 35 44 82
#> 36 45 82
#> 37 46 82
#> 38 47 82
#> 39 48 82
#> 40 49 82
#> 41 50 82
#> 
#> [[2]]$rank
#> [[2]]$rank$dist
#> [1] 0.9702309
#> 
#> [[2]]$rank$word
#> [1] 0
#> 
#> [[2]]$rank$qtd
#> [1] 4.954196
#> 
#> [[2]]$rank$proj
#>   [,1]
#> 2  NaN
#> 
#> 
#> 
#> [[3]]
#> [[3]]$isaxcod
#> [1] "ggg"
#> 
#> [[3]]$recmatrix
#>       [,1] [,2] [,3] [,4] [,5]
#>  [1,]    0    0    0    0    0
#>  [2,]    0    0    0    0    0
#>  [3,]    0    0    0    0    0
#>  [4,]    0    0    0    0    0
#>  [5,]    0    0    0    0    0
#>  [6,]    0    0    0    0    0
#>  [7,]    0    0    0    0    0
#>  [8,]    0    0    0    0    0
#>  [9,]    0    0    1    0    0
#> [10,]    0    0    0    0    0
#> 
#> [[3]]$vecst
#>     s  t
#> 1  21 81
#> 2  21 82
#> 3  21 83
#> 4  22 81
#> 5  22 82
#> 6  22 83
#> 7  23 82
#> 8  23 83
#> 9  23 84
#> 10 24 82
#> 11 24 83
#> 12 24 84
#> 13 25 82
#> 14 25 83
#> 15 26 81
#> 16 26 82
#> 17 26 83
#> 18 27 81
#> 19 27 82
#> 20 28 81
#> 21 28 82
#> 22 29 81
#> 23 29 82
#> 24 30 81
#> 
#> [[3]]$rank
#> [[3]]$rank$dist
#> [1] 1
#> 
#> [[3]]$rank$word
#> [1] 0
#> 
#> [[3]]$rank$qtd
#> [1] 4.584963
#> 
#> [[3]]$rank$proj
#>   [,1]
#> 3  NaN
#> 
#> 
#> 
#> [[4]]
#> [[4]]$isaxcod
#> [1] "ggg"
#> 
#> [[4]]$recmatrix
#>       [,1] [,2] [,3] [,4] [,5]
#>  [1,]    0    0    0    0    0
#>  [2,]    0    0    0    0    0
#>  [3,]    0    0    0    0    0
#>  [4,]    0    0    0    0    0
#>  [5,]    0    0    0    0    0
#>  [6,]    0    0    0    0    0
#>  [7,]    0    0    0    0    0
#>  [8,]    0    0    0    0    2
#>  [9,]    0    0    0    0    0
#> [10,]    0    0    0    0    0
#> 
#> [[4]]$vecst
#>     s  t
#> 25 41 77
#> 26 41 78
#> 27 42 77
#> 28 42 78
#> 29 43 76
#> 30 43 77
#> 31 43 78
#> 32 44 76
#> 33 44 77
#> 34 44 78
#> 35 45 76
#> 36 45 77
#> 37 45 78
#> 38 46 77
#> 39 46 78
#> 40 47 76
#> 41 47 77
#> 42 47 78
#> 43 48 76
#> 44 48 77
#> 45 48 78
#> 46 49 76
#> 47 49 77
#> 48 49 78
#> 49 50 76
#> 50 50 77
#> 51 50 78
#> 
#> [[4]]$rank
#> [[4]]$rank$dist
#> [1] 1
#> 
#> [[4]]$rank$word
#> [1] 0
#> 
#> [[4]]$rank$qtd
#> [1] 4.754888
#> 
#> [[4]]$rank$proj
#>   [,1]
#> 4  NaN

Plot the result

The function runVisualization allows to launch the shiny application to see the result. There are two ways to visualize the result.

# Plot the intensity of the dataset and highlight the motifs from the rankList
intensityDataset(dataset = D,rankList = rstmotifs,alpha = 7)
#> Warning: Removed 4908 rows containing missing values (geom_point).

plot of chunk fig

# Plot five specific spatial-series which some of them contain the best motif
displayPlotSeries(dataset = D, rmotifs = rstmotifs ,position = 1 ,space = c(1,2,5:7))

plot of chunk fig1