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

Anvi'o backend for 'genome view' #1712

Open
wants to merge 1,071 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1071 commits
Select commit Hold shift + click to select a range
95e8c50
load correct viewport frame for proportional scale
isaacfink21 Mar 13, 2023
eb47bde
port all relevant global variables from main.js into state
isaacfink21 Mar 14, 2023
732db04
update
isaacfink21 Mar 14, 2023
cf72057
fix showAllADLPtsPerLayer()
isaacfink21 Mar 14, 2023
7ea6821
Merge branch 'master' into genomeview-backend
isaacfink21 Mar 14, 2023
e59435c
set viewport correctly for proportional scale
isaacfink21 Mar 16, 2023
449de21
save current function color db to state
isaacfink21 Mar 17, 2023
3d2d6ac
cleanup
isaacfink21 Mar 17, 2023
4ad4906
trigger redraw immediately after using color pickers
isaacfink21 Mar 17, 2023
61394b9
feature flag proportional scale & genome dragging functionality
isaacfink21 Mar 17, 2023
18bc6aa
fix for background shades
isaacfink21 Mar 18, 2023
1706c27
housekeeping
isaacfink21 Mar 18, 2023
b2ada7d
Merge branch 'master' into genomeview-backend
isaacfink21 Mar 18, 2023
2796bcd
calculate canvas height correctly
isaacfink21 Mar 18, 2023
f41c4bd
clean
isaacfink21 Mar 18, 2023
c548e9d
deepdive and tabular modal color pickers show real color of genes; sa…
isaacfink21 Mar 19, 2023
bc61cad
export to SVG function
isaacfink21 Mar 19, 2023
7ebd396
add export as SVG button and remove invisible objects from export
isaacfink21 Mar 20, 2023
e3ee2fd
remove deprecated settings panel function
isaacfink21 Mar 20, 2023
dd91a68
fix settings tab name bug
isaacfink21 Mar 20, 2023
4ea224b
fix mouseover panel bug
isaacfink21 Mar 20, 2023
c3415c4
show correct color in group layers table picker
isaacfink21 Mar 20, 2023
6dd612c
hook in genome and gene label colors
isaacfink21 Mar 20, 2023
88762d0
fix gene coloring by source to show grey arrows
isaacfink21 Mar 21, 2023
d2f1c92
color genes by either functional annotation OR user-defined colors
isaacfink21 Mar 22, 2023
42ded6d
Merge branch 'master' into genomeview-backend
isaacfink21 Mar 22, 2023
bac5b81
disable color pickers when user-defined colors is turned off
isaacfink21 Mar 22, 2023
0b30820
Merge branch 'master' into genomeview-backend
isaacfink21 Mar 22, 2023
1ed57f7
typo
isaacfink21 Mar 29, 2023
54fec57
add new canvas for sticky genome labels
isaacfink21 Mar 29, 2023
24ea547
cosmetics
isaacfink21 Mar 29, 2023
8241d60
Merge branch 'master' into genomeview-backend
isaacfink21 Mar 29, 2023
30fb1d7
update toggle genome labels
isaacfink21 Mar 29, 2023
eeda009
recalculate canvas width on toggle genome labels
isaacfink21 Mar 29, 2023
983db63
fix
isaacfink21 Mar 29, 2023
527c464
fix
isaacfink21 Mar 29, 2023
51cf65a
refactor drawing genome labels into new function
isaacfink21 Mar 29, 2023
a0be9b6
update genome label colors automatically
isaacfink21 Mar 29, 2023
41d843f
update genome label colors automatically (actually)
isaacfink21 Mar 29, 2023
5c94712
load genome label color correctly and use hardcoded labelCanvas width
isaacfink21 Mar 29, 2023
4cfbf24
`setEventListeners` and `setCanvasListeners` should be separate funct…
isaacfink21 Mar 29, 2023
62404d7
fix
isaacfink21 Mar 29, 2023
56e3ecd
update checkbox values in processState
isaacfink21 Mar 29, 2023
ce9bb61
dispose old labelCanvas
isaacfink21 Mar 29, 2023
8fcdb4b
temp fix for load state with genome labels off
isaacfink21 Mar 29, 2023
862a558
reordering genomes triggers label redraw
isaacfink21 Mar 29, 2023
b578c1f
set genome label font size dynamically to match spacing
isaacfink21 Mar 29, 2023
d6ff7ba
update label canvas width dynamically
isaacfink21 Mar 30, 2023
2c65f18
deprecated
isaacfink21 Mar 30, 2023
8306a19
disable genome label selection
isaacfink21 Mar 30, 2023
e2d4ae6
fix layer height calculation
isaacfink21 Mar 30, 2023
8ef988e
fix
isaacfink21 Mar 30, 2023
dc3fa25
fix duplicate gene labels select
isaacfink21 Mar 30, 2023
800f98c
render nothing for blank user labels
matthewlawrenceklein Mar 30, 2023
94e3ede
save user-defined colors of multiple genomes to state
isaacfink21 Mar 30, 2023
03b1e4b
Merge branch 'genomeview-backend' of https://github.com/merenlab/anvi…
isaacfink21 Mar 30, 2023
12d0626
add genome margin as user-defined setting
isaacfink21 Apr 6, 2023
39c0da5
rotate genome labels
isaacfink21 Apr 9, 2023
1297757
truncate genome labels to character limit
isaacfink21 Apr 9, 2023
6e274d4
looser limit
isaacfink21 Apr 9, 2023
a80bb31
replace pink shade with group border
isaacfink21 Apr 10, 2023
3479675
fix
isaacfink21 Apr 10, 2023
a6c5351
cosmetics
isaacfink21 Apr 10, 2023
6a68f95
gene cosmetics
isaacfink21 Apr 10, 2023
cb5208c
fix
isaacfink21 Apr 10, 2023
806d049
merge labels SVG with main SVG
isaacfink21 Apr 17, 2023
73ab6e6
cleanup genomes table
isaacfink21 Apr 17, 2023
94c2653
Merge branch 'master' into genomeview-backend
isaacfink21 Apr 17, 2023
e4dc8fb
filter out description metadata from query
matthewlawrenceklein Apr 20, 2023
d68e22b
distinguish metadata tag vs description in DD table
matthewlawrenceklein Apr 20, 2023
e9522ac
remove metadata from table + state
matthewlawrenceklein Apr 20, 2023
75c17d1
hook in multiselect in viewport
isaacfink21 Apr 22, 2023
29032aa
change multiselect color when button is clicked rather than instantly
isaacfink21 Apr 22, 2023
3abda80
cleaner
isaacfink21 Apr 22, 2023
ea6ae5e
refactor add metadata tag into new function
isaacfink21 Apr 22, 2023
ed621be
add metadata tag to selected in tabular modal
isaacfink21 Apr 22, 2023
7b1b8a0
clean
isaacfink21 Apr 22, 2023
3f253fb
only show gene labels for nt window < 10k
isaacfink21 Apr 22, 2023
3d2cdbe
cosmetics for pentagon gene labels
isaacfink21 Apr 22, 2023
75131b1
gene labels are no longer editable
isaacfink21 Apr 22, 2023
b754202
show all GC content
isaacfink21 Apr 22, 2023
d187e7e
left/right arrow keys jump down/upstream 1k nucleotides
isaacfink21 Apr 22, 2023
a85dde9
cleanup
isaacfink21 Apr 22, 2023
b0c67b6
show/hide genomes in settings
isaacfink21 Apr 22, 2023
0fb1989
V is for viewport
isaacfink21 Apr 22, 2023
ef7cfaf
move all multiselect tabular modal functionality into the same function
isaacfink21 Apr 23, 2023
24d15e6
add checkbox to tabular modal to select all genes in a given genome
isaacfink21 Apr 23, 2023
01bf8f0
fix ADL graph so it's not upside down!
isaacfink21 Apr 23, 2023
4d926df
fix GC content path
isaacfink21 Apr 23, 2023
08bd91c
center gene labels and do not show the if label width > gene width
isaacfink21 Apr 24, 2023
4536967
this is too strict
isaacfink21 Apr 24, 2023
2008fad
fix
isaacfink21 Apr 24, 2023
4fcde75
fix
isaacfink21 Apr 25, 2023
7379422
do not error if there are no functional annotations
isaacfink21 Apr 26, 2023
26c5545
check for annotations properly
isaacfink21 Apr 26, 2023
561cd1b
cleaner
isaacfink21 Apr 26, 2023
2bb5d4b
only include genome labels in SVG if turned on
isaacfink21 Apr 26, 2023
c97648b
restyle bookmark descriptions
isaacfink21 Apr 26, 2023
bf676ba
clear multiselect text field after use
isaacfink21 Apr 26, 2023
b4c4774
add bookmarks table to query pane; allow user to remove bookmarks
isaacfink21 Apr 27, 2023
3f172dd
Merge branch 'master' into genomeview-backend
isaacfink21 Apr 27, 2023
9c737a5
store a separate genomeMax for each genome
isaacfink21 Apr 27, 2023
e14de22
fix
isaacfink21 Apr 27, 2023
c25d502
new function `calcXBoundsForGenome`
isaacfink21 Apr 27, 2023
27f1f66
only draw genome line within its own nt boundaries
isaacfink21 Apr 27, 2023
d7bb12d
updateRenderWindow takes into account local genome max
isaacfink21 Apr 27, 2023
e0104fd
testing
isaacfink21 Apr 27, 2023
2ca8f7d
more test logs
isaacfink21 Apr 27, 2023
0c58f50
more tests
isaacfink21 Apr 27, 2023
a344fbd
even more
isaacfink21 Apr 27, 2023
82bdf60
more
isaacfink21 Apr 27, 2023
54064b0
test ADL
isaacfink21 Apr 27, 2023
6127edf
clean
isaacfink21 Apr 28, 2023
35241ad
ensure # points graphed on ADLs <= genome length
isaacfink21 Apr 28, 2023
7f01ad8
cleanup
isaacfink21 Apr 28, 2023
1584e19
hook in genome label size to settings & state
isaacfink21 Apr 28, 2023
f837eee
more sensible genome label size range
isaacfink21 Apr 28, 2023
48917ce
fix groupBorder sizes
isaacfink21 Apr 29, 2023
62b1748
total select fix
isaacfink21 Apr 29, 2023
bb985a9
query/remove tag buttons are classes not ids
isaacfink21 Apr 29, 2023
83868b6
refactor nt scale movement into new functions
isaacfink21 Apr 29, 2023
b1f176b
only show deepdive metadata table header if the gene has labels
isaacfink21 Apr 30, 2023
135294b
don't show deepdive annotations header if no annotations
isaacfink21 Apr 30, 2023
e211408
deepdive cleanup
isaacfink21 Apr 30, 2023
a3c8f6c
deepdive cosmetics
isaacfink21 May 1, 2023
b7a8e91
remove settings UI for incomplete features
isaacfink21 May 1, 2023
8fbfae3
comment out align rulers button
isaacfink21 May 1, 2023
67bcee1
remove rect style gene arrows, change arrow style names, disable gene…
isaacfink21 May 1, 2023
d3786cb
Rename gene arrows features for clarity
isaacfink21 May 1, 2023
e332719
only show categories in selected nt range, not render window
isaacfink21 May 1, 2023
af7c481
shift+scroll is now required to zoom
isaacfink21 May 1, 2023
a270b67
make scale opaque
isaacfink21 May 1, 2023
5e1b7ae
settings cosmetics
isaacfink21 May 1, 2023
6af7411
goto button for bookmarks table
isaacfink21 May 1, 2023
f6b369b
fix
isaacfink21 May 1, 2023
f1deda2
Merge branch 'master' into genomeview-backend
isaacfink21 May 1, 2023
b222ab3
fix
isaacfink21 May 1, 2023
4d79f6d
don't allow empty tags or duplicate tags
isaacfink21 May 1, 2023
34bc95c
settings cosmetics
isaacfink21 May 2, 2023
023c003
save/load state footer cosmetics
isaacfink21 May 2, 2023
5c156d3
metadata notes, saving to state, querying separately
matthewlawrenceklein May 2, 2023
8b83fad
Merge branch 'genomeview-backend' into genomeview/metadata-notes-refa…
isaacfink21 May 3, 2023
dcdd770
replace existing metadata notes rather than adding new ones
isaacfink21 May 3, 2023
e40b048
save metadata note automatically when user closes deepdive
isaacfink21 May 3, 2023
8e45b8e
Merge pull request #2073 from merenlab/genomeview/metadata-notes-refa…
isaacfink21 May 3, 2023
2dba56f
cleaner
isaacfink21 May 4, 2023
ea67e1e
extraneous
isaacfink21 May 4, 2023
b571efe
more descriptive
isaacfink21 May 4, 2023
431832f
fix
isaacfink21 May 4, 2023
b551f65
specify metadata queries
isaacfink21 May 4, 2023
1a42636
clear query results button
isaacfink21 May 4, 2023
e9de020
show all tags button in query pane
isaacfink21 May 4, 2023
e6de274
fix
isaacfink21 May 4, 2023
c2ca579
fix
isaacfink21 May 4, 2023
70bd5dd
better name
isaacfink21 May 4, 2023
8c70b89
center Scale in window
isaacfink21 May 4, 2023
fdcee0a
center genome labels on Genome group layer rather than entire group
isaacfink21 May 4, 2023
2859ddf
clean
isaacfink21 May 4, 2023
a6467df
variable cleanup
isaacfink21 May 4, 2023
1a7341f
add user-defined annotations in deepdive
isaacfink21 May 5, 2023
c4e2ef0
new query option for user-defined annotations
isaacfink21 May 5, 2023
4e503c8
query user-defined annotations using `queryMetadata` function
isaacfink21 May 5, 2023
d1c6c32
deepdive remove user-defined annotation button
isaacfink21 May 5, 2023
a2bd19b
clear annotation input on setting
isaacfink21 May 5, 2023
afa82f3
populate deepdive with user-defined annotation when applicable
isaacfink21 May 5, 2023
58993b4
can add annotations to genes without functions
isaacfink21 May 5, 2023
a2c7dee
remove annotation header if no more left
isaacfink21 May 5, 2023
f01cefa
show user-defined annotations in mouseover panel
isaacfink21 May 5, 2023
b320f36
fix
isaacfink21 May 5, 2023
8b2119e
show all user defined annotations btn in query panel
isaacfink21 May 5, 2023
52f836b
use arrow functions
isaacfink21 May 5, 2023
eac55f7
add annotation to selected in viewport
isaacfink21 May 5, 2023
d5b4f70
use the same accession value for the identical annotation descriptions
isaacfink21 May 5, 2023
89d2b21
hook in user-defined annotations to gene labels!
isaacfink21 May 5, 2023
0a0b2a5
update `redrawSingleGenome`
isaacfink21 May 5, 2023
bbad57c
redraw upon adding/removing annotation
isaacfink21 May 5, 2023
5d1f0f3
empty query results on load state
isaacfink21 May 5, 2023
ee60c57
Merge pull request #2075 from merenlab/genomeview/user-defined-annota…
isaacfink21 May 5, 2023
37e197e
show all metadata notes
isaacfink21 May 5, 2023
90f7481
xDisps -> nt_disps; start new suite of `utils` fns for genome sliding
isaacfink21 May 8, 2023
a0ec11a
basic genome sliding functionality: toggle Scale when sliding is active
isaacfink21 May 8, 2023
49cd735
note potentially deprecated `percentScale` utils fns
isaacfink21 May 8, 2023
2b18d24
fix genome sliding warning msg
isaacfink21 May 8, 2023
f61c981
disable bookmarks during genome sliding
isaacfink21 May 8, 2023
3933dde
cleaner
isaacfink21 May 8, 2023
3e494fd
add warning info msg for disabled bookmarks
isaacfink21 May 8, 2023
da0b51d
+= `toggleGenomeSliding`
isaacfink21 May 8, 2023
9d5eed3
persist sliding in state
isaacfink21 May 8, 2023
307de65
rename
isaacfink21 May 8, 2023
c563f30
toggle bookmarks table in query pane
isaacfink21 May 8, 2023
f0d517f
fix to use correct nt or x scale
isaacfink21 May 8, 2023
0b0388a
move to location on a specific genome
isaacfink21 May 8, 2023
309d1fd
fix querying for genome sliding
isaacfink21 May 8, 2023
9dc20fb
center genes function
isaacfink21 May 11, 2023
9c3aa6f
get genes with annotation or metadata utils fns
isaacfink21 May 11, 2023
2f91861
allow centering to gene start instead of mid
isaacfink21 May 11, 2023
ace2c28
fix
isaacfink21 May 11, 2023
7fa8162
center genes to prop
isaacfink21 May 11, 2023
20bdd57
pass centerToGeneStart
isaacfink21 May 11, 2023
56cde2d
allow lower case in `getGenesWithAnnotation`
isaacfink21 May 11, 2023
3a7f8f9
add gene centering UI
isaacfink21 May 11, 2023
c0d9ee4
center to gene start UI
isaacfink21 May 11, 2023
e6da486
center to gene start in state
isaacfink21 May 11, 2023
3b7584e
update hidden scale UI on moveTo for genome sliding
isaacfink21 May 11, 2023
f28b339
reenable scale if genomes align perfectly
isaacfink21 May 11, 2023
6206600
fix
isaacfink21 May 11, 2023
54475ff
fix genome label alignment with genome layer
isaacfink21 May 11, 2023
64a8aa2
Merge branch 'genomeview-backend' into genomeview/genome-sliding
isaacfink21 May 11, 2023
cc56862
fix
isaacfink21 May 12, 2023
b38765a
Make --genome-view-db argument abbreviation more unique
mschecht May 14, 2023
fda1765
fix component test
mschecht May 14, 2023
fcab8a2
genome-view only works with contigs-dbs with ONE contig
mschecht May 14, 2023
f2895f8
Remove unused help menu items
mschecht May 14, 2023
73dc6f7
fix
isaacfink21 May 17, 2023
1246115
Merge branch 'genomeview-backend' of https://github.com/merenlab/anvi…
mschecht May 17, 2023
9c4c397
Merge branch 'genomeview-backend' into genomeview/genome-sliding
isaacfink21 May 17, 2023
b81bd0a
show genome in mouseover panel
isaacfink21 May 17, 2023
ecbc7cc
do not truncate genome labels
isaacfink21 May 18, 2023
748ac17
fix gene label x-pos
isaacfink21 May 18, 2023
71da855
dynamically add more chars to gene labels when font size changes to m…
isaacfink21 May 18, 2023
8b88b9a
Merge branch 'genomeview-backend' into genomeview/genome-sliding
isaacfink21 May 18, 2023
a288be0
combine mouse:down listeners
isaacfink21 May 18, 2023
f008bb5
disable shift + click multiselection
isaacfink21 May 18, 2023
abcfdd2
slide genomes on alt+click and drag
isaacfink21 May 18, 2023
58f4dfb
fix alt+click dragging + consolidate keydown listeners into one
isaacfink21 May 18, 2023
e8b0661
clean
isaacfink21 May 18, 2023
85a992c
shift+alt drag bug fix
isaacfink21 May 18, 2023
f65472a
clean
isaacfink21 May 18, 2023
c044eb8
clamp moveTo to genome bounds
isaacfink21 May 19, 2023
ce710d2
Revert "clamp moveTo to genome bounds"
isaacfink21 May 19, 2023
4738af3
search accession AND annotation for alignment
isaacfink21 May 19, 2023
cb0ecc8
load in maxGroupSize
isaacfink21 May 19, 2023
152ec31
update query+alignment UI
isaacfink21 May 19, 2023
7f477fb
wrap text for genome name in mouseover panel
isaacfink21 May 19, 2023
fb1c66f
calculate genomeMax as end of contig not end of last gene
isaacfink21 May 19, 2023
c4e9688
keep zoom level the same when gene centering
isaacfink21 May 19, 2023
6dd1104
fix shift+alt bug
isaacfink21 May 19, 2023
bca7b3b
Merge pull request #2078 from merenlab/genomeview/genome-sliding
isaacfink21 May 19, 2023
5211f17
fix alt+drag duplication bug
isaacfink21 May 19, 2023
5dcbe8c
warning message if multiple genes per genome
isaacfink21 May 19, 2023
6464fd6
final gv fix: lasso menu
isaacfink21 Jun 10, 2023
44b5a78
final gv fix: query/center by accession _then_ annotation
isaacfink21 Jun 10, 2023
8938071
final gv fix: set label cosmetics
isaacfink21 Jun 10, 2023
f3e0f2f
final gv fix: allocate colors in table by order of count
isaacfink21 Jun 14, 2023
a18208d
final gv fix: comma-separated annotations
isaacfink21 Jun 14, 2023
7f31c24
final gv fix: sliding
isaacfink21 Jun 20, 2023
6655cba
final gv fix: more specific
isaacfink21 Jun 21, 2023
12365a7
final gv fix: allow user to select anchor gene for multiple hits duri…
isaacfink21 Jun 22, 2023
8d7e514
final gv fix: option to always center to first hit
isaacfink21 Jun 22, 2023
78113e1
final gv fix: cosmetics
isaacfink21 Jun 22, 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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@
[submodule "anvio/data/interactive/lib/JavaScript-MD5"]
path = anvio/data/interactive/lib/JavaScript-MD5
url = https://github.com/blueimp/JavaScript-MD5.git
[submodule "anvio/data/interactive/lib/fabric.js"]
path = anvio/data/interactive/lib/fabric
url = https://github.com/fabricjs/fabric.js.git
18 changes: 14 additions & 4 deletions anvio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ def TABULATE(table, header, numalign="right", max_width=0):
'required': True,
'help': "Anvi'o structure database."}
),
'genome-view-db': (
['-V', '--genome-view-db'],
{'metavar': "GENOME_VIEW_DB",
'required': True,
'help': "Anvi'o genome view database."}
),
'only-if-structure': (
['--only-if-structure'],
{'default': False,
Expand Down Expand Up @@ -3560,7 +3566,8 @@ def set_version():
t.genomes_storage_vesion, \
t.structure_db_version, \
t.metabolic_modules_db_version, \
t.trnaseq_db_version
t.trnaseq_db_version, \
t.genome_view_db_version


def get_version_tuples():
Expand All @@ -3573,7 +3580,8 @@ def get_version_tuples():
("Genome data storage version", __genomes_storage_version__),
("Structure DB version", __structure__version__),
("KEGG Modules DB version", __kegg_modules_version__),
("tRNA-seq DB version", __trnaseq__version__)]
("tRNA-seq DB version", __trnaseq__version__),
("Genome view DB version", __genome_view_db__version__)]


def print_version():
Expand All @@ -3585,7 +3593,8 @@ def print_version():
run.info("Auxiliary data storage", __auxiliary_data_version__)
run.info("Structure database", __structure__version__)
run.info("Metabolic modules database", __kegg_modules_version__)
run.info("tRNA-seq database", __trnaseq__version__, nl_after=1)
run.info("tRNA-seq database", __trnaseq__version__)
run.info("Genome view database", __genome_view_db__version__, nl_after=1)


__version__, \
Expand All @@ -3598,7 +3607,8 @@ def print_version():
__genomes_storage_version__ , \
__structure__version__, \
__kegg_modules_version__, \
__trnaseq__version__ = set_version()
__trnaseq__version__, \
__genome_view_db__version__ = set_version()


if '-v' in sys.argv or '--version' in sys.argv:
Expand Down
28 changes: 27 additions & 1 deletion anvio/bottleroutes.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ def register_routes(self):
self.route('/data/reroot_tree', callback=self.reroot_tree, method='POST')
self.route('/data/save_tree', callback=self.save_tree, method='POST')
self.route('/data/check_homogeneity_info', callback=self.check_homogeneity_info, method='POST')
self.route('/data/get_genome_view_data', callback=self.get_genome_view_data, method='POST')
self.route('/data/get_genome_view_adl', callback=self.get_genome_view_continuous_data_layers, method='POST')
self.route('/data/search_items', callback=self.search_items_by_name, method='POST')
self.route('/data/get_taxonomy', callback=self.get_taxonomy, method='POST')
self.route('/data/get_functions_for_gene_clusters', callback=self.get_functions_for_gene_clusters, method='POST')
Expand Down Expand Up @@ -264,6 +266,8 @@ def redirect_to_app(self):
homepage = 'metabolism.html'
elif self.interactive.mode == 'inspect':
redirect('/app/charts.html?id=%s&show_snvs=true&rand=%s' % (self.interactive.inspect_split_name, self.random_hash(8)))
elif self.interactive.mode == 'genome-view':
homepage = 'genomeview.html'

redirect('/app/%s?rand=%s' % (homepage, self.random_hash(8)))

Expand Down Expand Up @@ -469,9 +473,13 @@ def save_state(self, state_name):

def get_state(self, state_name):
if state_name in self.interactive.states_table.states:

state = self.interactive.states_table.states[state_name]
state_dict = json.loads(state['content'])

if self.interactive.mode == 'genome-view':
return json.dumps({'content' : state_dict})

if self.interactive.mode == 'structure':
return json.dumps({'content': state['content']})
else:
Expand Down Expand Up @@ -1361,6 +1369,24 @@ def get_initial_data(self):
return json.dumps(self.interactive.get_initial_data())


def get_genome_view_data(self):
try:
return json.dumps({'genomes': self.interactive.genomes,
'gene_associations': self.interactive.gene_associations})
except Exception as e:
return json.dumps({'error': f"Something went wrong at the backend :( Here is the error message: '{e}'"})


def get_genome_view_continuous_data_layers(self):
"""populate continuous data layers, and send them back to the frontend"""

try:
self.interactive.populate_genome_continuous_data_layers()
return json.dumps(self.interactive.continuous_data_layers)
except Exception as e:
return json.dumps({'error': f"Something went wrong at the backend :( Here is the error message: '{e}'"})


def get_column_info(self):
gene_callers_id = int(request.forms.get('gene_callers_id'))
engine = request.forms.get('engine')
Expand Down Expand Up @@ -1481,7 +1507,7 @@ def get_functions_for_gene_clusters(self):
message = (f"At least one of the gene clusters in your list (e.g., {gene_cluster_name}) is missing in "
f"the functions summary dict :/")
return json.dumps({'status': 1, 'message': message})

d[gene_cluster_name] = self.interactive.gene_clusters_functions_summary_dict[gene_cluster_name]

return json.dumps({'functions': d, 'sources': list(self.interactive.gene_clusters_function_sources)})
Loading