Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reworking the documentation #9

Merged
merged 86 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
15c7fb2
general setup of a sphinx documentation page
nevrome Sep 29, 2023
5dc476d
experimenting with sphinx
nevrome Sep 29, 2023
cef52a1
figured out how development and deployment have to handled with sphinx
nevrome Sep 29, 2023
891e1c1
started to work on the actual documentation and solved various techni…
nevrome Sep 29, 2023
016f260
work on the installation documentation
nevrome Sep 29, 2023
9ed35f6
completed a first draft of the install instructions
nevrome Sep 29, 2023
e964399
thought about the required sections
nevrome Sep 29, 2023
b3ac4e1
started to dismantle the README in favor of the new documentation
nevrome Sep 29, 2023
b4791ed
distributed the current README into the new documentation sections
nevrome Sep 29, 2023
01a3c47
some small additions to the documentation
nevrome Sep 30, 2023
3782649
started to work on the basic similarity search explanation
nevrome Oct 2, 2023
2d18ace
work on the spatial data preparation
nevrome Oct 2, 2023
a6f223b
wrestling with map projections
nevrome Oct 2, 2023
1aa5739
prepared the headings for tomorrow
nevrome Oct 2, 2023
eaba1cd
filled one more section
nevrome Oct 2, 2023
91c77f6
getting the data ready for the basic analysis example
nevrome Oct 4, 2023
47ba389
more work on presenting the input data
nevrome Oct 4, 2023
6f6dda7
figured out how to reference sections
nevrome Oct 4, 2023
a1d0ef3
documented the necessary coordinate transformation for the input samples
nevrome Oct 4, 2023
04e6db9
on selecting the search sample
nevrome Oct 4, 2023
aacf8bb
started to define the locate arguments
nevrome Oct 4, 2023
a93c98c
some text on kernel parameter estimation
nevrome Oct 5, 2023
6bae4fb
more text to explain the search space and time selection
nevrome Oct 5, 2023
f65ff5a
some sentences about normalization
nevrome Oct 5, 2023
f92bca3
finally reached the call to mobest::locate()
nevrome Oct 5, 2023
283a984
started to document the output of locate()
nevrome Oct 5, 2023
4e4f2e6
copied the code from basic.md into the dedicated script
nevrome Oct 6, 2023
1926994
documentation of more output parameters
nevrome Oct 6, 2023
cb548b9
showed how to count iterations
nevrome Oct 6, 2023
ab0602d
started to think about plotting - probably it's best to first make th…
nevrome Oct 6, 2023
e628882
first plot
nevrome Oct 6, 2023
f89f62e
combining the similarity search results for different dependent varia…
nevrome Oct 6, 2023
9784406
removed the extra plot chapter in favour of a simple section in basic.md
nevrome Oct 6, 2023
9e2d964
made a more beautiful version of the result plot
nevrome Oct 6, 2023
f1a1413
a small amount of text just to make some progress
nevrome Oct 9, 2023
3d50dbc
typos
nevrome Oct 9, 2023
134496a
added some code and a new figure for multiple search timeslices
nevrome Oct 9, 2023
7f7a231
tiny change in the facet labels
nevrome Oct 9, 2023
682fd3d
experimenting with a multi search sample example
nevrome Oct 10, 2023
48d939a
completed the first draft of the basic tutorial
nevrome Oct 10, 2023
c2850a9
started to structure the parameter estimation chapter
nevrome Oct 10, 2023
1895e8a
started to fill estimation.md with life
nevrome Oct 10, 2023
3b98c07
more preparation for the estimation section
nevrome Oct 10, 2023
d98fb00
work on the parameter estimation
nevrome Oct 11, 2023
b5f58b8
completed a first draft of the nugget estimation section
nevrome Oct 11, 2023
f4074d3
started to work on the write-up for the crossvalidation
nevrome Oct 11, 2023
824db7a
work on the crossvalidation documentation
nevrome Oct 11, 2023
fe1d918
completed the first draft of the crossvalidation analysis section
nevrome Oct 11, 2023
8db72d7
completed table and figure
nevrome Oct 11, 2023
e1d69fb
foundational work on the hpc setup
nevrome Oct 11, 2023
384f890
work on the hpc crossvalidation setup
nevrome Oct 12, 2023
136ab3f
individual script to test crossvalidation setup
nevrome Oct 12, 2023
c0da60d
more work on the crossvalidation scripts
nevrome Oct 12, 2023
5515b18
more small adjustments
nevrome Oct 12, 2023
b11ac8d
wrong variable name
nevrome Oct 12, 2023
7f3a292
missing dot
nevrome Oct 12, 2023
e626d15
increased memory per job
nevrome Oct 12, 2023
db5bb42
better order of output files
nevrome Oct 12, 2023
dcf8aa8
formatC failed for some (maybe complex) reason
nevrome Oct 12, 2023
4a20e20
forgot that run is of type character
nevrome Oct 12, 2023
35c0b44
some code to compile the result in the end
nevrome Oct 12, 2023
f601460
tested and completed the hpc scripts
nevrome Oct 12, 2023
281d525
completed first draft of the parameter estimation section
nevrome Oct 12, 2023
f76384a
started to think about the advanced section
nevrome Oct 12, 2023
88ca60b
some more documenation of advanced details
nevrome Oct 13, 2023
1717fa8
theoretical intro to locate_multi
nevrome Oct 13, 2023
4e6356b
justification of temporal resampling
nevrome Oct 13, 2023
ff5b554
preparing advanced data table for the resampling adventure
nevrome Oct 13, 2023
0ae07d1
code to calibrate radiocarbon ages and draw age samples
nevrome Oct 13, 2023
7516f6c
dumped the relevant code samples into the temporal resampling script …
nevrome Oct 13, 2023
049e6a5
more work on the temporal resampling script
nevrome Oct 14, 2023
d889c80
more text on age resampling
nevrome Oct 14, 2023
73a02a7
more
nevrome Oct 14, 2023
d6af9dd
found a solution for passing the variables from the simple workflow t…
nevrome Oct 14, 2023
30382e1
more
nevrome Oct 14, 2023
05236e4
completed the first draft of the temporal resampling analysis
nevrome Oct 15, 2023
39e85be
small reorganization of the main sections
nevrome Oct 15, 2023
9567812
more consolidation work to get the origin vector concept in
nevrome Oct 15, 2023
36781d3
completed the first draft of the whole page - many little ToDos remai…
nevrome Oct 15, 2023
68d0e1f
small changes upon rereading
nevrome Oct 15, 2023
27c79ab
added headings and plot commands to the simple script
nevrome Oct 16, 2023
7e2f718
renamed main scripts
nevrome Oct 16, 2023
da94009
ggsave should be commented
nevrome Oct 16, 2023
1b04463
better time slice 6500 -> 6800
nevrome Oct 16, 2023
c9d6748
better second example search sample
nevrome Oct 16, 2023
36ce635
rereading
nevrome Oct 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
535 changes: 0 additions & 535 deletions README.Rmd

This file was deleted.

5 changes: 5 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# sphinx build folder
_build

# singularity images
*.sif
23 changes: 23 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
This is the code for the mobest documentation website. It uses the [Sphinx documentation generator](https://www.sphinx-doc.org/en/master).

To build the website you need the sphinx CLI tool and a number of extensions for it. `sphinx.def` defines an [apptainer](https://apptainer.org) image with the complete setup.

The image can be build with
```
apptainer build docs/sphinx.sif docs/sphinx.def
```

For development the latest state of the documentation can be rendered with
```
apptainer exec docs/sphinx.sif sphinx-build docs docs/_build/html
```

For deployment it should be build with [sphinx-multiversion](https://holzhaus.github.io/sphinx-multiversion/master/index.html), which will build separate documentation folders for each git tag (considers only committed changes!)
```
apptainer exec docs/sphinx.sif sphinx-multiversion docs docs/_build/html
```

To see the automatically generated label section to reference them (as described [here](https://docs.readthedocs.io/en/stable/guides/cross-referencing-with-sphinx.html)):
```
apptainer exec docs/sphinx.sif python -m sphinx.ext.intersphinx docs/_build/html/objects.inv
```
27 changes: 27 additions & 0 deletions docs/_templates/versions.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{%- if current_version %}
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions">
<span class="rst-current-version" data-toggle="rst-current-version">
<span class="fa fa-book"> Other Versions</span>
v: {{ current_version.name }}
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
{%- if versions.tags %}
<dl>
<dt>Tags</dt>
{%- for item in versions.tags %}
<dd><a href="{{ item.url }}">{{ item.name }}</a></dd>
{%- endfor %}
</dl>
{%- endif %}
{%- if versions.branches %}
<dl>
<dt>Branches</dt>
{%- for item in versions.branches %}
<dd><a href="{{ item.url }}">{{ item.name }}</a></dd>
{%- endfor %}
</dl>
{%- endif %}
</div>
</div>
{%- endif %}
522 changes: 522 additions & 0 deletions docs/advanced.md

Large diffs are not rendered by default.

536 changes: 536 additions & 0 deletions docs/basic.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions docs/bibliography.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Bibliography

```{bibliography} references.bib
```
29 changes: 29 additions & 0 deletions docs/citation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# How to cite mobest

If you use mobest for a scientific publication, please cite {cite:p}`Schmid2023`:

```none
@article{Schmid2023,
doi = {10.1073/pnas.2218375120},
url = {https://doi.org/10.1073/pnas.2218375120},
year = {2023},
month = feb,
publisher = {Proceedings of the National Academy of Sciences},
volume = {120},
number = {9},
author = {Clemens Schmid and Stephan Schiffels},
title = {Estimating human mobility in Holocene Western Eurasia with large-scale ancient genomic data},
journal = {Proceedings of the National Academy of Sciences}
}
```

In the **materials section** you should

- document the specific software version you used
- explain the input data, specifically
- how the input data was prepared and selected
- how the spatial and temporal positions for each input sample was defined
- how the position in dependent variable space was obtained (e.g. PCA on genotype data)
- list the kernel parameter settings and explain how they were obtained

Naturally **all code and data used to generate the mobest results should be shared** with the publication to ensure computational reproducibility.
41 changes: 41 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'mobest'
copyright = '2023, Clemens Schmid'
author = 'Clemens Schmid'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
'myst_parser',
'sphinx_rtd_theme',
'sphinx_multiversion',
'sphinxcontrib.bibtex',
'sphinx.ext.autosectionlabel'
]

myst_enable_extensions = [
"dollarmath"
]

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

exclude_patterns = ['README.md']

bibtex_bibfiles = ['references.bib']

# make sure the autosectionlabel targets are unique
autosectionlabel_prefix_document = True

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_rtd_theme'
3 changes: 3 additions & 0 deletions docs/data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Dataset_S1.csv
Dataset_S2.csv
*.zip
10 changes: 10 additions & 0 deletions docs/data/hpc_crossvalidation/compile.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
kernel_grid <- purrr::map_dfr(
list.files(
path = "docs/data/hpc_crossvalidation",
pattern = "*.csv",
full.names = TRUE
),
function(x) {
readr::read_csv(x, show_col_types = FALSE)
}
)
67 changes: 67 additions & 0 deletions docs/data/hpc_crossvalidation/cross.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
library(magrittr)

args <- unlist(strsplit(commandArgs(trailingOnly = TRUE), " "))
run <- args[1]
ds_for_this_run <- as.numeric(args[2])
dt_for_this_run <- as.numeric(args[3])

samples_projected <- readr::read_csv(
"docs/data/samples_projected.csv"
)

ind <- mobest::create_spatpos(
id = samples_projected$Sample_ID,
x = samples_projected$x,
y = samples_projected$y,
z = samples_projected$Date_BC_AD_Median
)
dep <- mobest::create_obs(
C1 = samples_projected$MDS_C1,
C2 = samples_projected$MDS_C2
)

kernel_for_this_run <- mobest::create_kernset_multi(
mobest::create_kernset(
C1 = mobest::create_kernel(
dsx = ds_for_this_run*1000,
dsy = ds_for_this_run*1000,
dt = dt_for_this_run,
g = 0.071
),
C2 = mobest::create_kernel(
dsx = ds_for_this_run*1000,
dsy = ds_for_this_run*1000,
dt = dt_for_this_run,
g = 0.059
)
),
.names = paste0("kernel_", run)
)

set.seed(123)

interpol_comparison <- mobest::crossvalidate(
independent = ind,
dependent = dep,
kernel = kernel_for_this_run,
iterations = 10,
groups = 10,
quiet = F
)

kernel_grid <- interpol_comparison %>%
dplyr::group_by(
dependent_var_id, ds = dsx, dt) %>%
dplyr::summarise(
mean_squared_difference = mean(difference^2),
.groups = "drop"
)

readr::write_csv(
kernel_grid,
file = paste0(
"docs/data/hpc_crossvalidation/kernel_grid_",
sprintf("%06d", as.integer(run)),
".csv"
)
)
45 changes: 45 additions & 0 deletions docs/data/hpc_crossvalidation/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash
#
#$ -S /bin/bash # defines bash as the shell for execution
#$ -N cross # name of the command that will be listed in the queue
#$ -cwd # change to the current directory
#$ -j y # join error and standard output in one file
#$ -o ~/log # standard output file or directory
#$ -q archgen.q # queue
#$ -pe smp 2 # use X CPU cores
#$ -l h_vmem=10G # request XGb of memory
#$ -V # load personal profile
#$ -t 1-225 # array job length
#$ -tc 25 # number of concurrently submitted tasks

date

echo Task in Array: ${SGE_TASK_ID}
i=$((SGE_TASK_ID - 1))

ds_to_explore=($(seq 100 100 1500))
dt_to_explore=($(seq 100 100 1500))
dss=()
dts=()
for ds in "${ds_to_explore[@]}"
do
for dt in "${dt_to_explore[@]}"
do
dss+=($ds)
dts+=($dt)
done
done
current_ds=${dss[${i}]}
current_dt=${dts[${i}]}

echo ds: ${current_ds}
echo dt: ${current_dt}

apptainer exec \
--bind=/mnt/archgen/users/schmid/mobest \
/mnt/archgen/users/schmid/mobest/apptainer_mobest.sif \
Rscript /mnt/archgen/users/schmid/mobest/docs/data/hpc_crossvalidation/cross.R ${i} ${current_ds} ${current_dt} \
/

date
exit 0
Loading