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

TASK-7097 - Port Patch 3.3.0 -> 4.0.0 Xetabase 2.3.0 -> 3.0.0 #996

Merged
merged 192 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
192 commits
Select commit Hold shift + click to select a range
b72ff8f
wp - Checking member permissions at study and group level. Considered…
gpveronica Mar 28, 2024
56c6f49
Merge branch 'release-2.12.x' into TASK-5245
imedina Apr 1, 2024
b49f91f
Merge branch 'release-2.12.x' into TASK-5245
gpveronica Sep 3, 2024
752fd41
Merge 'release-3.2.x' into TASK-5245
gpveronica Sep 5, 2024
e6ad086
wc: split variants track into small variants and structural variants …
jmjuanes Sep 6, 2024
a57a79b
gb: Add check to prevent rendering variants twice #TASK-5769
jmjuanes Sep 6, 2024
452af6b
gb: Fix hide/show content in feature track #TASK-5769
jmjuanes Sep 6, 2024
5890c3c
Merge branch 'release-3.2.x' into TASK-5769
jmjuanes Sep 9, 2024
c5cc5e7
wc: Add missing 'v' character to IVA version in footer #TASK-4985
jmjuanes Sep 10, 2024
3869c75
Merge branch 'release-3.2.x' into TASK-4985
jmjuanes Sep 10, 2024
2952507
wc: hide lollipos section in large variants track #TASK-5769
jmjuanes Sep 10, 2024
abb9a91
wc: Unbind select2 events in select-field-filter #TASK-6543
jmjuanes Sep 11, 2024
f86bec5
wc: Fix displaying local variants in rearrangement grid #TASK-6849
jmjuanes Sep 11, 2024
7632b48
wc: Fix displaying actions column in rearrangement grid #TASK-6849
jmjuanes Sep 11, 2024
e0df358
gb: Allow to display lollipops for only some variant types #TASK-5769
jmjuanes Sep 11, 2024
36fd66c
gb: Fix bug getting lollipop position of the feature #TASK-5769
jmjuanes Sep 11, 2024
61e38e6
gb: Fix typo in allowed variant types for lollipops #TASK-5769
jmjuanes Sep 11, 2024
2816761
wc: Add new track for displaying rearrangements in GB #TASK-5769
jmjuanes Sep 11, 2024
8447740
gb: Fix bug with displaced lollipops in variant track #TASK-5769
jmjuanes Sep 11, 2024
ffed4a1
wc: Remove debugger line in clinical-analysis-grid #TASK-6702
jmjuanes Sep 11, 2024
7784bcb
wc: Fix grid types in steiner report #TASK-6702
jmjuanes Sep 12, 2024
be5cd86
core: WIP Re-implement permissions implementation, #TASK-5245
gpveronica Sep 12, 2024
443cdbf
wc: WIP Add simplifyPermissions, #TASK-5245
gpveronica Sep 12, 2024
03b6956
wc: Fix bug displaying variant review modal in rearrangement grid #TA…
jmjuanes Sep 13, 2024
2c178b5
wc: Add missing clincial variant permission #TASK-6850
jmjuanes Sep 13, 2024
8c65d18
wc: Remove commented code and fix lint in rearrangement grid #TASK-6850
jmjuanes Sep 13, 2024
7afcb22
wc: Fix style of review modal in rearrangement grid #TASK-6850
jmjuanes Sep 13, 2024
6bb78d3
wc: Add missing close button in variant evidence review modal #TASK-6850
jmjuanes Sep 13, 2024
0dea70f
wc: Remove unused config modal in rearrangement grid #TASK-6850
jmjuanes Sep 13, 2024
4ebf9e5
wc: Remove unused columns in rearrangement grid #TASK-6850
jmjuanes Sep 13, 2024
72530ad
wc: Clean and remove unused code in rearrangement grid #TASK-6850
jmjuanes Sep 13, 2024
8554e1d
wc: Fix disabling edit action in interpreter grid #TASK-6850
jmjuanes Sep 13, 2024
cbfa532
wc: Fix disabling edit action in rearrangement grid #TASK-6850
jmjuanes Sep 13, 2024
8ce33c6
wc: Fix columns in rearrangement grid #TASK-6850
jmjuanes Sep 13, 2024
5166c00
wc: Fix enabling and disabling edit action in interpreter grid #TASK-…
jmjuanes Sep 13, 2024
5281d6d
wc: Fix enabling and disabling edit action in rearrangement grid #TAS…
jmjuanes Sep 13, 2024
0e872d6
wc: Add simplifyPermissions, #TASK-5245
gpveronica Sep 13, 2024
9565638
wc: Add simplifyPermissions and fix algorithm, #TASK-5245
gpveronica Sep 13, 2024
07f2124
wc: WiP Fix NONE case, #TASK-5245
gpveronica Sep 13, 2024
bef2b1a
wc: Fix class of buttons group in variant browser #TASK-6839
jmjuanes Sep 16, 2024
25f758a
wc: Remove useless class content-pills in variant browser buttons #TA…
jmjuanes Sep 16, 2024
41a5c02
wc: Fix class of buttons group in interpreter browser #TASK-6839
jmjuanes Sep 16, 2024
5f4cd19
wc: Minor code style fix in interpreter browser template #TASK-6839
jmjuanes Sep 16, 2024
9d4061b
wc: Fix class of buttons group in catalog browsers #TASK-6839
jmjuanes Sep 16, 2024
efa9d54
wc: Consider EXECUTE_JOBS and minor changes requested, #TASK-5245
gpveronica Sep 16, 2024
dfe7db8
wc: Minor clean, #TASK-5245
gpveronica Sep 16, 2024
0f27a16
SDLC: Prepare release 2.3.0 of Xetabase #TASK-6879
juanfeSanahuja Sep 16, 2024
02ba778
wc: Allow to show or hide gb tracks using a visible configuration fie…
jmjuanes Sep 16, 2024
42ef36f
wc: Restore default variants track only for single or family cases #T…
jmjuanes Sep 16, 2024
e3e10f8
wc: Set condition to hide cancer tracks of genome browser #TASK-5769
jmjuanes Sep 16, 2024
4f68d7c
wc: Fix query for structural variants track #TASK-5769
jmjuanes Sep 16, 2024
c0bd0f4
SDLC: Prepare release 2.3.0 of Xetabase #TASK-6879
juanfeSanahuja Sep 16, 2024
4a38648
wc: Fix tracks names in interpreter browser #TASK-5769
jmjuanes Sep 16, 2024
d64cf30
wc: Refactor permissions method name and add simplifyPermission param…
gpveronica Sep 16, 2024
a6c5ca6
wc: Fix label and input unique id, #TASK-6854
gpveronica Sep 18, 2024
86f5676
wc: Fix class in label, #TASK-6854
gpveronica Sep 18, 2024
8cb446d
wc: Change name default filter in SVBs, #TASK-6869
gpveronica Sep 19, 2024
f0d8329
Merge pull request #972 from opencb/TASK-6879
juanfeSanahuja Sep 19, 2024
9b2ff8b
wc: Fix resource permissions error, #TASK-6867
gpveronica Sep 19, 2024
fc9e73b
wc: Remove duplicated selections, #TASK-6867
gpveronica Sep 19, 2024
31f27dc
Merge branch 'release-3.x.x' into TASK-6854
jmjuanes Sep 19, 2024
272d853
wc: Add method to get status configuration to be displayed ina dropdo…
jmjuanes Sep 19, 2024
f75c3c7
wc: Get allowed values for status field using grouped status method #…
jmjuanes Sep 19, 2024
01a75d4
wc: Fix update method to refresh config when opencgaSession changes #…
jmjuanes Sep 19, 2024
e2babe2
Merge branch 'release-3.x.x' into TASK-6808
jmjuanes Sep 19, 2024
3f8a9e2
Merge branch 'release-3.x.x' into TASK-6702
jmjuanes Sep 19, 2024
a77abb3
Merge branch 'release-3.x.x' into TASK-6850
jmjuanes Sep 19, 2024
daf0296
Merge branch 'release-3.x.x' into TASK-6839
jmjuanes Sep 19, 2024
fa47175
Merge branch 'release-3.x.x' into TASK-6849
jmjuanes Sep 19, 2024
41ac089
Merge branch 'release-3.x.x' into TASK-6543
jmjuanes Sep 19, 2024
4ea8285
Merge branch 'release-3.x.x' into TASK-4985
jmjuanes Sep 19, 2024
ac623a8
wc: Force to round all scores values to the 2nd decimal point in hrde…
jmjuanes Sep 20, 2024
8956403
wc: Remove commented code in hrdetect-view #TASK-6927 #TASK-6838
jmjuanes Sep 20, 2024
b3b830d
wc: Remove intercept row in scores table of hrdetect-view #TASK-6927 …
jmjuanes Sep 20, 2024
c36b90f
wc: Promote Probability to a separate field in hrdetect-view #TASK-69…
jmjuanes Sep 20, 2024
c6b053b
wc: Remove Probability row from scores table #TASK-6927 #TASK-6838
jmjuanes Sep 20, 2024
1ef296d
wc: Minor code style fix in hrdetect-view #TASK-6927 #TASK-6838
jmjuanes Sep 20, 2024
7b2c8ec
wc: Fix extra curly brace in filter method of scores table config #TA…
jmjuanes Sep 20, 2024
ff3a9e5
wc: Add transform method to sort scores table in hrdetect-view #TASK-…
jmjuanes Sep 20, 2024
a199b9b
wc: Rename Scores section title to Contributions #TASK-6927 #TASK-6838
jmjuanes Sep 20, 2024
920c580
wc: Remove the field Fit Signatures File from mutational signatures a…
jmjuanes Sep 20, 2024
5fb76fa
wc: Remove the field Fit Rare Signatures File from mutational signatu…
jmjuanes Sep 20, 2024
45f962f
wc: Remove some fields in hrdetect analysis form #TASK-6927 #TASK-6838
jmjuanes Sep 20, 2024
24cba8a
wc: Rename advanced parameters section in hrdetect analysis form #TAS…
jmjuanes Sep 20, 2024
530c8cb
gb: Make navigation bar always visible at the top of the viewport #TA…
jmjuanes Sep 20, 2024
671baa7
Merge branch 'release-3.x.x' into TASK-5769
jmjuanes Sep 20, 2024
2f38744
Merge pull request #966 from opencb/TASK-4985
jmjuanes Sep 20, 2024
1a4b42e
wc: Rename study to entry in cosmic column formatter #TASK-6942 #TASK…
jmjuanes Sep 20, 2024
80fb652
wc: Include the total count of traits with source cosmic in column te…
jmjuanes Sep 20, 2024
d1de693
wc: Minor code style fix in cosmic column formatter #TASK-6942 #TASK-…
jmjuanes Sep 20, 2024
2aa66d4
Merge branch 'release-3.x.x' into TASK-6869
jmjuanes Sep 20, 2024
1e82342
wc: Move check permissions to variable for clarity, #TASK-5245
gpveronica Sep 20, 2024
89dff07
wc: Minor style fix, #TASK-5245
gpveronica Sep 20, 2024
aa83305
Merge branch 'release-3.x.x' into TASK-5245
jmjuanes Sep 20, 2024
5dae217
Merge branch 'release-3.x.x' into TASK-6838
jmjuanes Sep 20, 2024
4319c7f
wc: Fix priority badge colours, #TASK-5245
gpveronica Sep 20, 2024
b0b78eb
wc: Remove debugger, #TASK-6867
gpveronica Sep 20, 2024
e0da9b4
Merge branch 'release-3.x.x' into TASK-6694
jmjuanes Sep 23, 2024
9ab118e
Merge branch 'release-3.x.x' into TASK-6867
jmjuanes Sep 23, 2024
b0f0c9f
Merge branch 'release-3.x.x' into TASK-6312
gpveronica Sep 23, 2024
76b473a
wc: Factorize priority rank map into web utils method, #TASK-6867
gpveronica Sep 23, 2024
fdea43a
test: fix test for karyotype panel #TASK-6694
jmjuanes Sep 23, 2024
cfccd7a
wc: Tiny code fixes, #TASK-6312
gpveronica Sep 23, 2024
0b4e9a0
gb: add current region to the options provided to renderers #TASK-125…
jmjuanes Sep 23, 2024
2510904
gb: Display a tooltip with the current coverage value #TASK-1251 #TAS…
jmjuanes Sep 23, 2024
0a8fa44
Merge branch 'release-3.x.x' into TASK-6839
jmjuanes Sep 23, 2024
3679752
wc: Fix validation in variant interpreter grid config #TASK-5589
jmjuanes Sep 23, 2024
4bd0018
wc: Fix validation message in variant interpreter grid config #TASK-5589
jmjuanes Sep 23, 2024
5d3c226
Merge pull request #971 from opencb/TASK-6839
jmjuanes Sep 23, 2024
086f6ea
Merge branch 'release-3.x.x' into TASK-6543
jmjuanes Sep 23, 2024
3a5b085
test: add tests for cosmic column #TASK-6942 #TASK-6700
jmjuanes Sep 23, 2024
850ce4a
Merge branch 'release-3.x.x' into TASK-6700
jmjuanes Sep 23, 2024
9a2a51c
Merge branch 'release-3.x.x' into TASK-5589
jmjuanes Sep 23, 2024
f32c42b
Merge pull request #967 from opencb/TASK-6543
jmjuanes Sep 23, 2024
116bfd6
Merge branch 'release-3.x.x' into TASK-6849
jmjuanes Sep 23, 2024
a61760a
Merge pull request #968 from opencb/TASK-6849
jmjuanes Sep 23, 2024
2d7c4fa
Merge branch 'release-3.x.x' into TASK-5589
jmjuanes Sep 23, 2024
4c2cc57
Merge branch 'release-3.x.x' into TASK-6700
jmjuanes Sep 23, 2024
d764e89
Merge branch 'release-3.x.x' into TASK-6702
jmjuanes Sep 23, 2024
6dae7aa
Merge branch 'release-3.x.x' into TASK-6850
jmjuanes Sep 23, 2024
724ec68
wc: Tiny code fixe, #TASK-6312
gpveronica Sep 23, 2024
d416977
Merge branch 'release-3.x.x' into TASK-6312
jmjuanes Sep 23, 2024
53bb862
Merge pull request #970 from opencb/TASK-6850
jmjuanes Sep 23, 2024
57c1090
Merge branch 'release-3.x.x' into TASK-6702
jmjuanes Sep 23, 2024
cce98e0
Merge pull request #969 from opencb/TASK-6702
jmjuanes Sep 23, 2024
8b2e3e5
Merge branch 'release-3.x.x' into TASK-5769
jmjuanes Sep 24, 2024
2696118
Merge branch 'release-3.x.x' into TASK-6694
jmjuanes Sep 24, 2024
3ee1bd4
wc: Fix getting samples when variant id is too long #TASK-6635
jmjuanes Sep 24, 2024
a5c2f02
Merge branch 'release-3.x.x' into TASK-1232
jmjuanes Sep 24, 2024
5be55c0
test-app: Fix missing import of genome browser styles #TASK-1251 #TAS…
jmjuanes Sep 24, 2024
ed88d7f
gb: Add labels for cypress in coverage tooltip #TASK-1251 #TASK-1232
jmjuanes Sep 24, 2024
0578640
test: Add test for coverage tooltip #TASK-1251 #TASK-1232
jmjuanes Sep 24, 2024
2c0bfe6
Merge pull request #980 from opencb/TASK-6694
jmjuanes Sep 24, 2024
826916a
Merge branch 'release-3.x.x' into TASK-6312
gpveronica Sep 24, 2024
dcc987c
Merge branch 'release-3.x.x' into TASK-6854
gpveronica Sep 24, 2024
c650145
Merge pull request #974 from opencb/TASK-6854
gpveronica Sep 24, 2024
8cf5e02
Merge branch 'release-3.x.x' into TASK-6312
gpveronica Sep 24, 2024
378b095
Merge pull request #981 from opencb/TASK-6312
gpveronica Sep 24, 2024
eafc35b
Merge branch 'release-3.x.x' into TASK-5769
jmjuanes Sep 24, 2024
a0346ae
Merge pull request #978 from opencb/TASK-5769
jmjuanes Sep 24, 2024
55da40a
Merge branch 'release-3.x.x' into TASK-6700
jmjuanes Sep 24, 2024
0d42375
Merge pull request #983 from opencb/TASK-6700
jmjuanes Sep 24, 2024
7529011
Merge branch 'release-3.x.x' into TASK-5589
jmjuanes Sep 24, 2024
2294ddc
Merge branch 'release-3.x.x' into TASK-1232
jmjuanes Sep 24, 2024
a69ef5d
Merge pull request #982 from opencb/TASK-5589
jmjuanes Sep 24, 2024
1f3fc4b
Merge branch 'release-3.x.x' into TASK-6869
gpveronica Sep 25, 2024
6fc4d97
Merge branch 'release-3.x.x' into TASK-6838
jmjuanes Sep 25, 2024
d5e279e
wc: Convert files section to a table in clinical analysis view #TASK-…
jmjuanes Sep 25, 2024
05b15cb
wc: Remove commented code in clinical analysis view #TASK-6841
jmjuanes Sep 25, 2024
b45bf93
Merge pull request #976 from opencb/TASK-6869
gpveronica Sep 25, 2024
83f0c76
Merge branch 'release-3.x.x' into TASK-6838
jmjuanes Sep 25, 2024
8d848fd
Merge pull request #979 from opencb/TASK-6838
jmjuanes Sep 25, 2024
12f7630
Merge branch 'release-3.x.x' into TASK-6841
jmjuanes Sep 25, 2024
d8d1c3c
Merge branch 'release-3.x.x' into TASK-6635
jmjuanes Sep 25, 2024
0611f98
Merge branch 'release-3-x.x' into TASK-6867
gpveronica Sep 25, 2024
33a2112
Merge pull request #977 from opencb/TASK-6867
gpveronica Sep 25, 2024
be8f657
Merge branch 'release-3.x.x' into TASK-6635
jmjuanes Sep 25, 2024
71d29a7
wc: Change order in fetchData of variant-samples #TASK-6635
jmjuanes Sep 25, 2024
259020e
wc: Minor code fixes in variant-samples #TASK-6635
jmjuanes Sep 25, 2024
e3310c6
wc: Set a maximum length of the ID displayed in the title of the deta…
jmjuanes Sep 25, 2024
2e1438a
wc: Fix wrong condition in fetchData method of variant-samples #TASK-…
jmjuanes Sep 26, 2024
1efdf7c
wc: Fix wrong condition in fetchData method of variant-samples #TASK-…
jmjuanes Sep 26, 2024
9108e50
wc: Fix filtering by genotype in variant-samples when variant ID is t…
jmjuanes Sep 26, 2024
3c12429
Merge branch 'release-3.x.x' into TASK-6808
jmjuanes Sep 26, 2024
95089ff
Merge branch 'release-3.x.x' into TASK-6841
jmjuanes Sep 26, 2024
6228824
Merge pull request #975 from opencb/TASK-6808
jmjuanes Sep 26, 2024
ee315d8
Merge branch 'release-3.x.x' into TASK-1232
jmjuanes Sep 26, 2024
0407e48
Merge branch 'release-3.x.x' into TASK-6635
gpveronica Sep 26, 2024
99f8079
Merge pull request #984 from opencb/TASK-1232
jmjuanes Sep 27, 2024
1bb1e3e
Merge branch 'release-3.x.x' into TASK-6841
jmjuanes Sep 27, 2024
28521b6
Merge pull request #985 from opencb/TASK-6841
jmjuanes Sep 27, 2024
c8f4884
Merge branch 'release-3-x.x' into TASK-5245
gpveronica Oct 1, 2024
9030183
Merge pull request #899 from opencb/TASK-5245
gpveronica Oct 1, 2024
1d97358
wc - Query clinical analysis if there is at least one individual. #TA…
gpveronica Oct 1, 2024
34601a8
wc - View specific message when no individuals or clinical cases. #TA…
gpveronica Oct 1, 2024
7e74855
Merge branch 'release-3.x.x' into TASK-6631
gpveronica Oct 1, 2024
2ede06b
Merge branch 'release-3.x.x' into TASK-6635
jmjuanes Oct 1, 2024
21e73c5
wc - Refactor clinical analysis configuration to an update. #TASK-6631
gpveronica Oct 1, 2024
aca6fdc
wc - Tiny clean. #TASK-6986
gpveronica Oct 1, 2024
dc26ff6
wc - Refactor clinical analysis configuration operation to update. #T…
gpveronica Oct 1, 2024
66ae98f
wc - Refactor clinical analysis configuration operation to update. #T…
gpveronica Oct 1, 2024
6e180d6
wc - Tiny clean. #TASK-6986
gpveronica Oct 1, 2024
ac404d2
wc - Config visibility of job inputs and return promise on submit. #T…
gpveronica Oct 1, 2024
6c01699
wc - Fix issues in variant secondary sample index #TASK-6986
gpveronica Oct 2, 2024
274a1c1
Merge pull request #987 from opencb/TASK-6631
gpveronica Oct 3, 2024
014f6cb
Merge branch 'release-3.x.x' into TASK-6635
jmjuanes Oct 4, 2024
0ec22dc
Merge pull request #986 from opencb/TASK-6635
jmjuanes Oct 4, 2024
1f9a0a3
Merge branch 'release-3.x.x' into TASK-6986
gpveronica Oct 4, 2024
a1438e3
Merge pull request #988 from opencb/TASK-6986
gpveronica Oct 4, 2024
c411ef5
Prepare new release 3.3.0
jmjuanes Oct 16, 2024
b77cc6b
Prepare Port Patch 3.3.0 -> 4.0.0
jmjuanes Oct 17, 2024
ddfafc4
Merge branch 'develop' into TASK-7097
jmjuanes Oct 17, 2024
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
13 changes: 12 additions & 1 deletion cypress/e2e/iva/genome-browser.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ context("GenomeBrowser", () => {

cy.get("@karyotype")
.find(`div[data-cy="gb-karyotype-toggle"]`)
.trigger("click");
.trigger("click", {force: true});

cy.get("@karyotypeContent")
.invoke("css", "display")
Expand Down Expand Up @@ -763,6 +763,17 @@ context("GenomeBrowser", () => {
.find("polyline")
.should("exist");
});

it("should display a tooltip when hovering the coverage", () => {
// eslint-disable-next-line cypress/no-force
cy.get("@coverage")
.find(`rect[data-cy="gb-coverage-tooltip-mask"]`)
.trigger("mouseenter", {force: true});

cy.get("@coverage")
.find(`text[data-cy="gb-coverage-tooltip-text"]`)
.should("not.have.css", "display", "none");
});
});

context("alignments", () => {
Expand Down
32 changes: 32 additions & 0 deletions cypress/e2e/iva/variant-browser-grid.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,38 @@ context("Variant Browser Grid", () => {
});
});

context("clinical info", () => {
context("cosmic column", () => {
const columnIndex = 18;
it("should display an 'x' icon if no cosmic information is available", () => {
cy.get("@variantBrowser")
.find(`tbody > tr[data-uniqueid="14:91649938:A:G"] > td`)
.eq(columnIndex)
.find("i")
.should("have.class", "fa-times");
});

it("should display the number of entries and total trait associations", () => {
cy.get("@variantBrowser")
.find("tbody tr:first > td")
.eq(columnIndex)
.should("contain.text", "1 entry (1)");
});

it("should display a tooltip with a link to cosmic", () => {
cy.get("@variantBrowser")
.find("tbody tr:first > td")
.eq(columnIndex)
.find("a")
.trigger("mouseover");

cy.get(`div[class="qtip-content"]`)
.find(`a[href^="https://cancer.sanger.ac.uk/cosmic/search?q="]`)
.should("exist");
});
});
});

context("actions", () => {
const variant = "14:91649858:C:T";
beforeEach(() => {
Expand Down
119 changes: 77 additions & 42 deletions src/core/clients/opencga/opencga-catalog-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,58 +53,93 @@ export default class OpencgaCatalogUtils {
}

// Check if the user has the right the permissions in the study.
static checkPermissions(study, user, permissions) {
if (!study || !user || !permissions) {
console.error(`No valid parameters, study: ${study}, user: ${user}, permissions: ${permissions}`);
static getStudyEffectivePermission(study, userId, permission, simplifyPermissions = false) {
// Caution 1 20240916 Vero:
// As discussed and agreed, this method is considering the VIEW, WRITE, DELETE permissions of all catalog entities in addition to the EXECUTE_JOBS.
// The rest of permissions described in the following link are not currently needed in IVA for now:
// https://github.com/opencb/opencga/blob/develop/docs/manual/data-management/sharing-and-permissions/permissions.md
// Caution w 20240916 Vero:
// As discussed and agreed, the optimization parameter simplifyPermissions is set as false by default according to the default value in OpenCGA.

// Get the resource from the provided permission, that has the structure '{OPERATION}_{RESOURCE}'. E.g:
// "WRITE_SAMPLES" --> "SAMPLES"
// "VIEW_CLINICAL_ANALYSIS" --> "CLINICAL_ANALYSIS"
const resource = permission.split("_").slice(1).join("_");

// VALIDATION
if (!study || !userId || !permission || !resource) {
console.error(`No valid parameters, study: ${study}, user: ${userId}, permission: ${permission}, catalogEntity: ${resource}`);
return false;
}
// Check if user is a Study admin, belongs to @admins group
const admins = study.groups.find(group => group.id === "@admins");
if (admins.userIds.includes(user)) {
return true;
const permissionLevel = {};
permissionLevel["NONE"] = 1;
if (permission !== "EXECUTE_JOBS") {
permissionLevel[`VIEW_${resource}`] = 2;
permissionLevel[`WRITE_${resource}`] = 3;
permissionLevel[`DELETE_${resource}`] = 4;
} else {
// Check if user is in acl
const aclUserIds = study.groups
.filter(group => group.userIds.includes(user))
.map(group => group.id);
aclUserIds.push(user);
for (const aclId of aclUserIds) {
// Find the permissions for this user
const userPermissions = study?.acl
?.find(acl => acl.member === user)?.groups
?.find(group => group.id === aclId)?.permissions || [];
if (Array.isArray(permissions)) {
for (const permission of permissions) {
if (userPermissions?.includes(permission)) {
return true;
}
}
permissionLevel[permission] = 2;
}

const getPermissionLevel = permissionList => {
const levels = permissionList
.map(p => permissionLevel[p])
.filter(p => typeof p === "number");
return levels.length > 0 ? Math.max(...levels) : 0;
};

const getEffectivePermission = (userPermission, groupPermissions) => {
// It is possible to simplify permissions.
if (!simplifyPermissions) {
// First, find permission level at user level
const userPermissionLevel = getPermissionLevel(userPermission);
if (userPermissionLevel) {
// If the permission level at user level is greater than 0, return this permission level because it has priority over groups.
return userPermissionLevel;
} else {
if (userPermissions?.includes(permissions)) {
return true;
}
// Check permission level at groups level. No hierarchy defined here. Example:
// If a user belongs to two groups:
// - groupA - Has permission VIEW_SAMPLES
// - groupB - Has permission WRITE_SAMPLES
// The dominant permission will be the highest, i.e. WRITE_SAMPLES
return Math.max(0, ...groupPermissions.map(g => getPermissionLevel(g)));
}
} else {
// If "simplifyPermissions = true" permissions become more flexible.
// As long as the user has the necessary permission at the user or group level it'll be able to perform the action.
// I.e., there's no hierarchy where user-level permissions override group-level ones
groupPermissions.push(userPermission);
return Math.max(0, ...groupPermissions.map(g => getPermissionLevel(g)));
}
}
return false;
}
};

// Check if the provided user is admin in the organization
static isOrganizationAdmin(organization, userId) {
if (!organization || !userId) {
return false;
// ALGORITHM
// 1. If userId is the installation admin grant permission
if (userId === "opencga") {
return true;
}
// 1. Check if user is the organization admin
if (organization?.owner === userId) {
// 2. If userId is a Study admin, belongs to @admins group. Grant permission
const admins = study.groups.find(group => group.id === "@admins");
if (admins.userIds.includes(userId)) {
return true;
} else {
// Check if user is an admin of the organization
if (organization?.admins?.includes?.(userId)) {
return true;
}
}
// Other case, user is not admin of the organization
return false;
// 3. Permissions for member
const userPermissionsStudy = study?.acl
?.find(acl => acl.member === userId)
?.permissions || [];

// 4. Permissions for groups where the member belongs to
const groupIds = study.groups
.filter(group => group.userIds.includes(userId))
.map(group => group.id);

const groupPermissions = groupIds.map(groupId => study?.acl
?.find(acl => acl.member === userId)?.groups
?.find(group => group.id === groupId)?.permissions || []);

// If the effective permission retrieved is greater or equal than the permission level requested, grant permission.
// If not, deny permission
return getEffectivePermission(userPermissionsStudy, groupPermissions) >= permissionLevel[permission];
}

// Check if the user has the right the permissions in the study.
Expand Down
2 changes: 1 addition & 1 deletion src/genome-browser/genome-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default class GenomeBrowser {
// Generate GB template
const template = UtilsNew.renderHTML(`
<div id="${this.prefix}" data-cy="gb-parent" class="card text-bg-light mb-3">
<div id="${this.prefix}Navigation" data-cy="gb-navigation" class="card-header"></div>
<div id="${this.prefix}Navigation" data-cy="gb-navigation" class="card-header bg-light sticky-top"></div>
<ul class="list-group rounded-0">
<li id="${this.prefix}Karyotype" data-cy="gb-karyotype" class="list-group-item" style="display:none;"></li>
<li id="${this.prefix}Chromosome" data-cy="gb-chromosome" class="list-group-item" style="display:none;"></li>
Expand Down
52 changes: 50 additions & 2 deletions src/genome-browser/renderers/alignment-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export default class AlignmentRenderer extends Renderer {
// Define the height of the coverage track
const regionSize = options.requestedRegion.end - options.requestedRegion.start + 1;
const parentHeight = options.svgCanvasFeatures.parentElement.clientHeight;
const coverageHeight = regionSize < this.config.alignmentsMaxRegionSize ? 50 : parentHeight;
// const coverageHeight = regionSize < this.config.alignmentsMaxRegionSize ? 50 : parentHeight;
const coverageHeight = 75;

const coverageParent = SVG.addChild(options.svgCanvasFeatures, "g", {
"data-cy": "gb-coverage",
Expand Down Expand Up @@ -201,7 +202,7 @@ export default class AlignmentRenderer extends Renderer {
points.push(`${startPoint},${height}`);

if (maximumValue > 0) {
const maxValueRatio = height / maximumValue;
const maxValueRatio = (height - 25) / maximumValue;
let prevCoverage = -1;
let prevPosition = -1;

Expand Down Expand Up @@ -235,6 +236,53 @@ export default class AlignmentRenderer extends Renderer {
width: pixelWidth,
height: height,
cursor: "pointer",
style: "opacity:0.6;",
});

const coverageValueRect = SVG.addChild(group, "path", {
"d": "M0 0L15 0C20 0 20 5 20 5L20 15C20 15 20 20 15 20L5 20L0 25L-5 20L-15 20C-20 20-20 15-20 15L-20 5C-20 5-20 0-15 0L0 0Z",
"fill": "#000",
"style": "display:none;transform:translateX(0px);",
"data-cy": "gb-coverage-tooltip-tip",
});
const coverageValueText = SVG.addChild(group, "text", {
"x": 0,
"y": 10,
"fill": "#fff",
"dominant-baseline": "middle",
"text-anchor": "middle",
"style": "font-size:10px;font-weight:bold;",
"data-cy": "gb-coverage-tooltip-text",
});
const coverageMask = SVG.addChild(group, "rect", {
"x": startPoint,
"y": 0,
"width": Math.abs(endPoint - startPoint),
"height": height,
"fill": "transparent",
"stroke": "none",
"data-cy": "gb-coverage-tooltip-mask",
});

const visibleStart = parseInt(GenomeBrowserUtils.getFeatureX(options.region.start, options) - (options.pixelBase / 2));
const initialCanvasStart = parseInt(options.svgCanvasFeatures.getAttribute("x"));

coverageMask.addEventListener("mousemove", e => {
const deltaCanvas = initialCanvasStart - parseInt(options.svgCanvasFeatures.getAttribute("x"));
const position = visibleStart + deltaCanvas + e.offsetX;
const index = Math.floor(((position - startPoint) / options.pixelBase) / coverage.windowSize);

coverageValueRect.style.transform = `translateX(${position}px)`;
coverageValueText.setAttribute("x", position + "px");
coverageValueText.textContent = Math.ceil(coverage.values[index] || 0);
});
coverageMask.addEventListener("mouseleave", () => {
coverageValueRect.style.display = "none";
coverageValueText.style.display = "none";
});
coverageMask.addEventListener("mouseenter", () => {
coverageValueRect.style.display = "";
coverageValueText.style.display = "";
});
}

Expand Down
33 changes: 28 additions & 5 deletions src/genome-browser/renderers/variant-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,21 @@ export default class VariantRenderer extends Renderer {
const lollipopStickHeight = this.config.lollipopHeight - this.config.lollipopFocusWidth - this.config.lollipopMaxWidth / 2;
let lollipopStickStart = this.config.lollipopFocusWidth + this.config.lollipopMaxWidth / 2;
let lollipopPositions = [];
let lollipopIndex = 0;
let topPosition = this.config.lollipopVisible ? this.config.lollipopHeight : this.config.headerHeight;

// We have to filter features and consider only the ones that are in the current region
// this is important because when we request for breakends to OpenCGA it returns both variants of the breakend
const region = options.requestedRegion;
const featuresToDisplay = (features || []).filter(feature => {
return feature.chromosome === region.chromosome && feature.start <= region.end && region.start <= feature.end;
});

if (this.config.lollipopVisible) {
lollipopPositions = LollipopLayout.fromFeaturesList(features || [], options.requestedRegion, lollipopRegionWidth, {
const featuresForLollipops = featuresToDisplay.filter(feature => {
return this.config.lollipopVariantTypes.includes(feature.type);
});
lollipopPositions = LollipopLayout.fromFeaturesList(featuresForLollipops, options.requestedRegion, lollipopRegionWidth, {
minSeparation: this.config.lollipopMaxWidth,
});
}
Expand All @@ -60,7 +71,16 @@ export default class VariantRenderer extends Renderer {
lollipopStickStart = lollipopStickStart + this.config.highlightHeight;
}

(features || []).forEach((feature, featureIndex) => {
featuresToDisplay.forEach((feature, featureIndex) => {
// Check if this variant has been previously rendered
if (options?.renderedFeatures && feature?.id) {
if (options.renderedFeatures.has(feature.id)) {
return;
}
// Prevent rendering this variant in next calls of this renderer
options.renderedFeatures.add(feature.id);
}

const group = SVG.addChild(options.svgCanvasFeatures, "g", {
"data-cy": "gb-variant",
"data-id": feature.id || "-",
Expand All @@ -86,9 +106,9 @@ export default class VariantRenderer extends Renderer {

let variantElement = null;

// Check if lollipops are visible
if (this.config.lollipopVisible) {
const lollipopX = lollipopStartX + lollipopPositions[featureIndex];
// Check if lollipops are visible and the feature type is one of the allowed types for lollipops
if (this.config.lollipopVisible && this.config.lollipopVariantTypes?.includes?.(feature?.type)) {
const lollipopX = lollipopStartX + lollipopPositions[lollipopIndex];
const lollipopWidth = Math.min(1, Math.max(0, this.getValueFromConfig("lollipopWidth", [feature])));
const lollipopPath = [
`M ${lollipopX},${lollipopStickStart}`,
Expand Down Expand Up @@ -130,6 +150,8 @@ export default class VariantRenderer extends Renderer {
variantElement.setAttribute("stroke-width", 0);
});
}
// increment lollipop index
lollipopIndex = lollipopIndex + 1;
} else {
variantElement = SVG.addChild(group, "rect", {
"data-cy": "gb-variant-lollipop-shape",
Expand Down Expand Up @@ -296,6 +318,7 @@ export default class VariantRenderer extends Renderer {
lollipopMaxWidth: 15,
lollipopShape: GenomeBrowserUtils.lollipopShapeFormatter,
lollipopWidth: GenomeBrowserUtils.lollipopWidthFormatter,
lollipopVariantTypes: ["SNV", "INDEL", "BREAKEND"],
// Lollipop focus
lollipopFocusEnabled: true,
lollipopFocusWidth: 2,
Expand Down
9 changes: 5 additions & 4 deletions src/genome-browser/tracks/feature-track.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,17 +229,17 @@ export default class FeatureTrack {

hideContent() {
this.contentVisible = false;
this.content.classList.add("hidden");
this.resize.classList.add("hidden");
this.content.classList.add("d-none");
this.resize.classList.add("d-none");

this.titleToggleIcon.classList.remove("fa-minus");
this.titleToggleIcon.classList.add("fa-plus");
}

showContent() {
this.contentVisible = true;
this.content.classList.remove("hidden");
this.resize.classList.remove("hidden");
this.content.classList.remove("d-none");
this.resize.classList.remove("d-none");

this.titleToggleIcon.classList.remove("fa-plus");
this.titleToggleIcon.classList.add("fa-minus");
Expand Down Expand Up @@ -475,6 +475,7 @@ export default class FeatureTrack {
renderedArea: this.renderedArea,
renderedFeatures: this.renderedFeatures,
pixelBase: this.pixelBase,
region: this.region,
position: this.region.center(),
regionSize: this.region.length(),
labelMaxRegionSize: this.config.labelMaxRegionSize,
Expand Down
Loading
Loading