@@ -22,6 +22,20 @@ such as [msprime](https://tskit.dev/msprime), that use them.
22
22
If you are new to the world of tree sequences, we suggest you start with the
23
23
first tutorial: {ref}` sec_what_is `
24
24
25
+ :::{note}
26
+ Tutorials are under constant development. Those that are still a work in progress and
27
+ not yet ready for use are shown in _ italics_ in the list of tutorials.
28
+
29
+ We very much welcome help developing existing tutorials or writing new ones. Please open
30
+ or contribute to a [ GitHub issue] ( https://github.com/tskit-dev/tutorials/issues ) if you
31
+ would like to help out.
32
+ :::
33
+
34
+ ## Other sources of help
35
+
36
+ Videos and publications about tree sequences are listed on our
37
+ [ Learn page] ( https://tskit.dev/learn.html ) .
38
+
25
39
We aim to be a friendly, welcoming open source community.
26
40
Questions and discussion about using {program}` tskit ` , the tree sequence toolkit
27
41
should be directed to the
@@ -30,11 +44,55 @@ similar forums for other software in the tree sequence [development community](h
30
44
such as for [ msprime] ( https://github.com/tskit-dev/msprime/discussions ) and
31
45
[ tsinfer] ( https://github.com/tskit-dev/tsinfer/discussions ) .
32
46
33
- :::{note}
34
- Tutorials are under constant development. Those that are still a work in progress and
35
- not yet ready for use are shown in _ italics_ in the list of tutorials.
36
47
37
- We very much welcome help developing existing tutorials or writing new ones. Please open
38
- or contribute to a [ GitHub issue] ( https://github.com/tskit-dev/tutorials/issues ) if you
39
- would like to help out.
40
- :::
48
+ (sec_intro_running)=
49
+
50
+ ## Running tutorial code
51
+
52
+ It is not necessary to run code in the tutorials yourself: tutorials can be followed by
53
+ simply reading each page. However, it is also possible to run the tutorial code
54
+ on your own computer, which will allow you to experiment with the examples provided.
55
+ The recommended way to do this is from within a
56
+ [ Jupyter notebook] ( https://jupyter.org ) . As well as installing Jupyter, you will also
57
+ need to install the various Python libraries, most importantly
58
+ `` tskit `` , `` msprime `` , `` numpy `` , and `` matplotlib `` . These and other packages are
59
+ listed in the [ requirements.txt] ( https://raw.githubusercontent.com/tskit-dev/tutorials/main/requirements.txt )
60
+ file; a shortcut to installing the necessary software is therefore:
61
+
62
+ ```
63
+ python3 -m pip install -r https://raw.githubusercontent.com/tskit-dev/tutorials/main/requirements.txt
64
+ ```
65
+
66
+ In addition, to run the {ref}` R tutorial<sec_tskit_r> ` you will need to install the R
67
+ [ reticulate] ( https://rstudio.github.io/reticulate/ ) library, and if running in a Jupyter,
68
+ the [ IRkernel] ( https://irkernel.github.io ) library. This can be done by running the
69
+ following command within R:
70
+
71
+ ```
72
+ install.packages(c("reticulate", "IRkernel")); IRkernel::installspec()
73
+ ```
74
+
75
+ (sec_intro_downloading_datafiles)=
76
+
77
+ ### Downloading tutorial datafiles
78
+
79
+ Many of the tutorials use pre-existing tree sequences stored in the `` data `` directory.
80
+ These can be downloaded from the internet by running the script stored in
81
+ [ https://tskit-dev/tutorials/_static/download_data.py ] ( https://tskit-dev/tutorials/_static/download_data.py ) .
82
+ If you are running the code in the tutorials from within a Jupyter notebook
83
+ then you can simply load this code into a new cell by using the
84
+ [ %load cell magic] ( https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-load ) .
85
+ Just run the following in a Jupyter code cell:
86
+
87
+ ```
88
+ %load https://tskit-dev/tutorials/_static/download_data.py
89
+ ```
90
+
91
+ Executing the resulting Python code should download the data files, allowing code like
92
+ the following to run successfully
93
+
94
+ ``` {code-cell} ipython3
95
+ import tskit
96
+ ts = tskit.load("data/basics.trees")
97
+ print(f"The file 'data/basics.trees' exists, and contains {ts.num_trees} trees")
98
+ ```
0 commit comments