Skip to content

Commit 65c1d63

Browse files
Improvements in documentation
1 parent 6d66bde commit 65c1d63

File tree

6 files changed

+174
-27
lines changed

6 files changed

+174
-27
lines changed

Diff for: datasail/parsers.py

+7
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ def parse_datasail_args(args) -> Dict[str, object]:
2525
"clusters within the dataset.",
2626
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
2727
)
28+
parser.add_argument(
29+
"--cc",
30+
default=False,
31+
action='store_true',
32+
dest=KW_CC,
33+
help="List available clustering algorithms."
34+
)
2835
parser.add_argument(
2936
"-o",
3037
"--output",

Diff for: datasail/routine.py

+19-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import time
2-
from typing import Dict, Tuple
2+
from typing import Dict, Tuple, Optional
33

44
from datasail.argparse_patch import remove_patch
55
from datasail.cluster.clustering import cluster
@@ -8,18 +8,34 @@
88
from datasail.report import report
99
from datasail.settings import LOGGER, KW_TECHNIQUES, KW_EPSILON, KW_RUNS, KW_SPLITS, KW_NAMES, \
1010
KW_MAX_SEC, KW_MAX_SOL, KW_SOLVER, KW_LOGDIR, NOT_ASSIGNED, KW_OUTDIR, MODE_E, MODE_F, DIM_2, SRC_CL, KW_DELTA, \
11-
KW_E_CLUSTERS, KW_F_CLUSTERS
11+
KW_E_CLUSTERS, KW_F_CLUSTERS, KW_CC, CDHIT, INSTALLED, FOLDSEEK, TMALIGN, CDHIT_EST, DIAMOND, MMSEQS, MASH
1212
from datasail.solver.solve import run_solver
1313

1414

15-
def datasail_main(**kwargs) -> Tuple[Dict, Dict, Dict]:
15+
def list_cluster_algos():
16+
"""
17+
List all available clustering algorithms.
18+
"""
19+
20+
print("Available clustering algorithms:", "\tECFP", sep="\n")
21+
for algo, name in [(CDHIT, "CD-HIT"), (CDHIT_EST, "CD-HIT-EST"), (DIAMOND, "DIAMOND"), (MMSEQS, "MMseqs, MMseqs2"),
22+
(MASH, "MASH"), (FOLDSEEK, "FoldSeek"), (TMALIGN, "TMalign")]:
23+
if INSTALLED[algo]:
24+
print("\t", name, sep="")
25+
26+
27+
def datasail_main(**kwargs) -> Optional[Tuple[Dict, Dict, Dict]]:
1628
"""
1729
Main routine of DataSAIL. Here the parsed input is aggregated into structures and then split and saved.
1830
1931
Args:
2032
**kwargs: Parsed commandline arguments to DataSAIL.
2133
"""
2234
kwargs = remove_patch(**kwargs)
35+
if kwargs[KW_CC]:
36+
list_cluster_algos()
37+
return None
38+
2339
start = time.time()
2440
LOGGER.info("Read data")
2541

Diff for: datasail/settings.py

+1
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ def format2ending(fmt: str) -> str:
148148

149149
KW_CACHE = "cache"
150150
KW_CACHE_DIR = "cache_dir"
151+
KW_CC = "cc"
151152
KW_CLI = "cli"
152153
KW_DELTA = "delta"
153154
KW_EPSILON = "epsilon"

Diff for: docs/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import sphinx_rtd_theme
77

88
sys.path.insert(0, os.path.abspath("./.."))
9+
sys.path.insert(0, os.path.abspath("./."))
910

1011
import datasail
1112
from datasail.version import __version__
@@ -21,7 +22,7 @@
2122
"sphinx.ext.githubpages",
2223
"nbsphinx",
2324
"nbsphinx_link",
24-
"IPython.sphinxext.ipython_console_highlighting"
25+
"IPython.sphinxext.ipython_console_highlighting",
2526
]
2627

2728
autosummary_generate = True
@@ -45,7 +46,6 @@
4546
intersphinx_mapping = {
4647
"python": ("https://docs.python.org/", None),
4748
"numpy": ("https://numpy.org/doc/stable/", None),
48-
# "numpy": ("http://docs.scipy.org/doc/numpy", None),
4949
}
5050

5151
html_theme_options = {

Diff for: docs/index.rst

+17-22
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,30 @@ datasets. However, its versatility extends beyond biology, making it applicable
88
utilized through its command line interface or integrated as a Python package, DataSAIL stands out for its
99
user-friendly design and adaptability. Licensed under the MIT license, it is open source and conveniently accessible on
1010
`GitHub <https://github.com/kalininalab/datasail>`_. Installation is made simple through
11-
`conda <https://anaconda.org/kalininalab/datasail>`_, utilizing
12-
`mamba <https://mamba.readthedocs.io/en/latest/installation.html#existing-conda-install>`_.
11+
`conda <https://anaconda.org/kalininalab/datasail>`_.
1312

14-
Quick Start
15-
###########
16-
17-
DataSAIL is available for all modern versions of Pytion (v3.8 or newer). Other than described on the conda-website,
18-
the command to install DataSAIL within your just created environment is
19-
20-
.. code-block:: shell
13+
Install
14+
#######
2115

22-
mamba install -c kalininalab -c conda-forge -c bioconda datasail
23-
pip install grakel
16+
DataSAIL is available for all modern versions of Pytion (v3.8 or newer).
2417

25-
The second command is necessary to run WLK clustering as the grakel library is not available on conda for python 3.10
26-
or newer. Alternatively, one can install :code:`DataSAIL-lite` from conda as
18+
.. note::
19+
It is recommended to use `mamba <https://mamba.readthedocs.io/en/latest/installation.html#existing-conda-install>`_
20+
for the installation because conda might not be able to resolve the dependencies of DataSAIL successfully.
2721

28-
.. code-block:: shell
22+
.. raw:: html
23+
:file: install.html
2924

30-
mamba install -c kalininalab -c conda-forge -c bioconda datasail-lite
31-
pip install grakel
25+
DataSAIL vs. DataSAIL-lite
26+
--------------------------
3227

33-
.. note::
34-
It is important to use mamba for the installation because conda might not be able to resolve the dependencies of
35-
DataSAIL successfully.
28+
The difference between :code:`DataSAIL` and :code:`DataSAIL-lite` is that the latter does not include most of the
29+
clustering algorithms as they are not provide on conda for all OSs. Therefore, the user is required to the user to
30+
install them manually as needed. DataSAIL will work even if not all clustering are installed. For the installation, is
31+
it necessary to be able to call them. You can test which are available by running :code:`datasail --cc`.
3632

37-
The difference between :code:`DataSAIL` and :code:`DataSAIL-lite` is that the latter does not include the clustering
38-
algorithms and requires the user to install them manually as needed. The reason for this is that the clustering
39-
algorithms are not available for all OS and we want to make DataSAIL available for all OS.
33+
Quick Start
34+
###########
4035

4136
Regardless of which installation command was used, DataSAIL can be executed by running
4237

Diff for: docs/install.html

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
<style>
2+
.quick-start {
3+
display: flex;
4+
flex-direction: row;
5+
flex-wrap: nowrap;
6+
margin-bottom: 20px;
7+
}
8+
9+
.title-column {
10+
flex-grow: 0;
11+
}
12+
13+
.content-column {
14+
flex-grow: 1;
15+
}
16+
17+
.row {
18+
display: flex;
19+
flex-direction: row;
20+
flex-wrap: nowrap;
21+
}
22+
23+
.title-column div, .row div {
24+
white-space: nowrap;
25+
}
26+
27+
.title-column div {
28+
padding: 14px 10px 12px 0;
29+
font-weight: 700;
30+
}
31+
32+
.row div {
33+
flex-grow: 1;
34+
text-align: center;
35+
margin: 2px;
36+
padding: 12px 0 10px 0;
37+
background: #e3e3e3;
38+
cursor: pointer;
39+
}
40+
41+
.row div.selected {
42+
background: rgba(59,155,239,0.7);
43+
color: #ffffff;
44+
}
45+
46+
#command {
47+
margin: 2px;
48+
padding: 12px 10px 10px 10px;
49+
}
50+
51+
#command pre {
52+
padding: 0;
53+
margin: 0;
54+
white-space: pre-wrap;
55+
}
56+
</style>
57+
58+
<div class="quick-start">
59+
<div class="title-column">
60+
<div>OS</div>
61+
<div>Package</div>
62+
<div>Run:</div>
63+
</div>
64+
<div class="content-column">
65+
<div class="row" id="os">
66+
<div id="linux">Linux</div>
67+
<div id="osx">OSX</div>
68+
<div id="arm">OSX-ARM</div>
69+
<div id="win">Windows</div>
70+
</div>
71+
<div class="row" id="package">
72+
<div id="conda">Conda</div>
73+
<div id="pip">Pip</div>
74+
</div>
75+
<div class="row" id="command">
76+
<pre id="commandText">Command</pre>
77+
</div>
78+
</div>
79+
</div>
80+
81+
<script type="text/javascript">
82+
function updateCommand() {
83+
// Get the attributes from the #command element
84+
var commandElement = document.getElementById("command");
85+
var os = commandElement.getAttribute("os");
86+
var package = commandElement.getAttribute("package");
87+
88+
// Get the <pre> element inside the #command element
89+
var preElement = commandElement.querySelector("pre");
90+
91+
// Update the text based on the conditions
92+
if (package === "pip") {
93+
preElement.textContent = '# datasail is not yet available on pip';
94+
}
95+
else if (os === "linux" || os === "osx") {
96+
preElement.textContent = 'mamba install -c conda-force -c bioconda -c kalininalab datasail # or datasail-lite\n\npip install grakel<0.1.10';
97+
}
98+
else {
99+
preElement.textContent = `mamba install -c conda-force -c bioconda -c kalininalab datasail-lite\n\npip install grakel<0.1.10`;
100+
}
101+
}
102+
103+
document.querySelectorAll(".quick-start .content-column .row div").forEach(function(element) {
104+
element.addEventListener("click", function() {
105+
// Remove the 'selected' class from all siblings
106+
let siblings = this.parentNode.querySelectorAll('div');
107+
siblings.forEach(function(sibling) {
108+
sibling.classList.remove('selected');
109+
});
110+
111+
// Add the 'selected' class to the clicked element
112+
this.classList.add('selected');
113+
114+
// Get the parent row's id and the clicked element's id
115+
let parentId = this.parentNode.id;
116+
let elementId = this.id;
117+
118+
// Set the corresponding attribute on the #command element
119+
document.getElementById("command").setAttribute(parentId, elementId);
120+
121+
// Call the updateCommand function
122+
updateCommand();
123+
});
124+
});
125+
126+
document.getElementById("os").children[0].click();
127+
document.getElementById("package").children[0].click();
128+
</script>

0 commit comments

Comments
 (0)