Skip to content

Commit

Permalink
interface improvments, release 0.8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ialbert committed Apr 15, 2024
1 parent 46a7f1a commit 3292075
Show file tree
Hide file tree
Showing 12 changed files with 539 additions and 536 deletions.
37 changes: 20 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,33 @@ When executed from the command line:

More details in [Install](#installation) section below.

## Quick start
## Quickstart

Download the latest binary release for your platform

* [GeneScape Releases][releases]

[releases]: https://www.github.com/ialbert/genescape-central/releases

**Windows**: Unzip then double-click the executable to start the program. You may need to give permission to run the software. In the future you can double-click the executable to start the program.
**Windows**: Unzip then double-click the executable to start the program. You may need to give permission to run the software. Once you allow the software to run subsequently you can double-click the executable to start the program.

**MacOS** The first time around unzip the program, then right-click and select **Open**. You then again have to agree to run the software. In the future you can double-click the executable to start the program.
**MacOS** The first time around unzip the program, then right-click and select **Open**. You then again have to agree to run the software. After allowing the program to run once you can in the future double-click the executable to start the program.

On all platforms you may also use `pip install genescape` to install the software then run `genescape web` to start the web interface.

## Accessing the graphical interface

## Accessing the interface

Once the program runs, visit the `http://localhost:8000` in your browser:
The user interface is browser-based. Once the program runs, visit the `http://localhost:8000` URL in your browser:

* [http://localhost:8000](http://localhost:8000)

the page you see should look like this:
The page you see should look similar to the image below:

![GeneScape interface][iface1]

[iface1]: https://raw.githubusercontent.com/ialbert/genescape-central/main/docs/images/interface-empty.png

When you are done with the program, close the terminal that started the program to stop the server.
Once you are done running with the program, you will need to close the terminal that started the program or press CTRL+C to stop the program from running.

## Using the interface

Expand All @@ -59,13 +58,17 @@ The program will generate a tree visualization of the functional elements of the

![GeneScape][tree]

**GeneScape** does the following:
**GeneScape** works the following way:

1. It first reads genes from an **Input List**
1. Then extracts the **Annotations** associated with the input genes
1. Finallyit builds and visualizes the functional subtree tree based on these Annotations.

1. Reads genes from an **Input list**
1. Extracts the **Functional Annotations** associated with the input genes
1. Builds and visualizes a tree based on these GO terms
> **Note**
>
> Even short lists of genes (under ten genes) can create large trees. Filter by minimum counts (how many genes share the function) or functional patterns (functions that match a pattern).
## Node labeling
## Node Labeling

The labels in the graph carry additional information on the number of genes in the input that carry that function as well as an indicator for the specificity of the function in the organism. For example, the label:

Expand All @@ -76,13 +79,13 @@ The labels in the graph carry additional information on the number of genes in t
(1/5)
```

Indicates that the function `endopeptidase inhibitor activity` was seen as an annotation to `39` of *all genes* in the original association file (for the human there are over 19K gene symbols). Thus, the `[39]` is a characteristic of annotation of the organism.
Indicates that the function `endopeptidase inhibitor activity` was seen as an annotation to `39` of *all genes* in the original association file (for the human there are over 19K gene symbols). Thus, the `[39]` is a characteristic of annotation of the organism.

The `(1/5)` means that `1` out of `5` genes in the input list carry this function. Thus it is a characteristic of the input list.
The `(1/5)` means that `1` out of `5` genes in the input list carry this annotation. Thus the value is a characteristic of the input list. The `mincount` filter is applied to the count value to filter out functions that are under a threshold.

You are welcome to apply a p-value to this difference to determine whether it is statistically significant. Note that assigning p-value to enrichment counts is fraught with challenges, as in our opinion, GO annotations are neither complete, nor independent nor accurate enough to make such determination.
You are welcome to apply a p-value to the differences in counts to determine whether it is statistically significant. Note that assigning p-value to enrichment counts is fraught with many challenges, as in our opinion, GO annotations are neither complete, nor independent nor accurate enough to make such determination. The selection of the background to correct p-values for multiple comparisons is also an additional challenge. For these reasons, we do not compute p-values in the application.

## Node coloring
## Node Coloring

The colors in the tree carry additional meaning:

Expand Down
2 changes: 1 addition & 1 deletion src/genescape/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.8.2"
__version__ = "0.8.3"
6 changes: 3 additions & 3 deletions src/genescape/annot.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def go2ns(goid):

# Create the data object
res = []
data_fields = [utils.GID, "root", "count", "function", utils.SOURCE, "count", "size", utils.LABEL]
data_fields = ["count", "root", utils.GID, "function", utils.SOURCE, "count", "size", utils.LABEL]


for goid, cnt, func in counts:
Expand All @@ -123,7 +123,7 @@ def go2ns(goid):
if root != utils.NS_ALL and root != root_code:
continue

name = dict(zip(data_fields, [goid, root_code, cnt, func, funcs, cnt, n_size, label], strict=False))
name = dict(zip(data_fields, [cnt, root_code, goid, func, funcs, cnt, n_size, label], strict=False))

res.append(name)

Expand All @@ -150,7 +150,7 @@ def ann2csv(ann):
rc[utils.SOURCE] = ";".join(row.get(utils.SOURCE, []))
write.writerow(rc)
text = stream.getvalue()

text = text.strip()
return text


Expand Down
4 changes: 1 addition & 3 deletions src/genescape/data/web/draw.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<pre id="dot" style="display: none;">{{dot}}</pre>

<textarea class="input" hx-swap-oob="true" name="terms" id="terms">
{{input}}
</textarea>
<pre hx-swap-oob="true" id="terms">{{input}}</pre>
15 changes: 7 additions & 8 deletions src/genescape/data/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
<div class="grow">

<div class="header">
Input List
Input
</div>

<textarea class="input" name="input" id="input"
Expand All @@ -118,15 +118,14 @@
PSG5
</textarea>

<div class="header">Function Annotations
<div class="header">Annotations
<span id="loadingFile" class="htmx-indicator">
<span class="mark"> ... processing</span>
</span>
<span class="mark"> ... processing</span>
</span>
</div>

<textarea class="input" name="terms" id="terms"
hx-swap-oob="true">
</textarea>
<pre id="terms" hx-swap-oob="true">
</pre>

</div>

Expand All @@ -150,7 +149,7 @@
<div class="growX">

<div class="header">
Function Tree
Functions
<!-- Loading indicator -->
<span id="loadingImage" class="htmx-indicator">
<span class="mark">... processing</span>
Expand Down
5 changes: 4 additions & 1 deletion src/genescape/data/web/static/genescape.css
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,12 @@ svg {
flex-grow: 1;
}


pre {
margin: 0;
}
#terms {
height: 50%;
#width: 100%;
min-height:300px;
border: var(--border-color) solid 1px;
}
Expand Down
2 changes: 1 addition & 1 deletion src/genescape/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def cache(key, func):

#key = str(key)

utils.info(f"cache key: {key}")
utils.debug(f"cache: {key}")

if key not in CACHE:
CACHE[key] = func()
Expand Down
4 changes: 2 additions & 2 deletions src/genescape/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def stop(msg):
STATUS_FIELD, DATA_FIELD, CODE_FIELD, ERROR_FIELD, INVALID_FIELD = "status", "data", "code", "errors", "unknown_terms"

# The name of the columns in the annotation CSV file
GID, LABEL, SOURCE = "gid", "label", "source"
GID, LABEL, SOURCE = "goid", "label", "source"

# A few handy constants
DEGREE, COUNT_DESC, INPUT, NAME, NAMESPACE = "degree", "count_desc", "input", "name", "namespace"
Expand Down Expand Up @@ -262,7 +262,7 @@ def index_stats(index, verbose=False):
go_count = len(go2sym)

if verbose:
info(f"index: {map_count:,} mappings, {sym_count:,} symbols, {go_count:,} terms,")
info(f"index: {map_count:,} mappings, {sym_count:,} symbols, {go_count:,} terms")

return map_count, sym_count, go_count

Expand Down
Loading

0 comments on commit 3292075

Please sign in to comment.