gramene-search 1.6.25 → 1.6.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.parcel-cache/83e7562660f7cc15-BundleGraph +0 -0
- package/.parcel-cache/9a0d07555444f4da-AssetGraph +0 -0
- package/.parcel-cache/d3a1b9507cb44047-AssetGraph +0 -0
- package/.parcel-cache/data.mdb +0 -0
- package/.parcel-cache/dc1da35000e13623-RequestGraph +0 -0
- package/.parcel-cache/lock.mdb +0 -0
- package/.parcel-cache/snapshot-dc1da35000e13623.txt +2 -2
- package/dist/index.js +52 -78
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/src/components/results/details/Expression.js +46 -67
- package/src/demo.js +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gramene-search",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.27",
|
|
4
4
|
"description": "search wrapper for gramene",
|
|
5
5
|
"source": "src/index.js",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"querystringify": "^2.2.0",
|
|
44
44
|
"react": "^17.0.2",
|
|
45
45
|
"react-bootstrap": "^2.7.2",
|
|
46
|
+
"react-bootstrap-typeahead": "^6.4.1",
|
|
46
47
|
"react-debounce-input": "^3.2.5",
|
|
47
48
|
"react-dom": "17.0.2",
|
|
48
49
|
"react-ga4": "^2.1.0",
|
|
@@ -1,52 +1,26 @@
|
|
|
1
1
|
import React, { useRef, useEffect, useState } from 'react'
|
|
2
2
|
import {connect} from "redux-bundler-react";
|
|
3
3
|
import {Tabs, Tab, Form, Row, Col} from 'react-bootstrap';
|
|
4
|
+
import { Typeahead } from 'react-bootstrap-typeahead'; // ES2015
|
|
5
|
+
// Import as a module in your JS
|
|
6
|
+
import 'react-bootstrap-typeahead/css/Typeahead.css';
|
|
4
7
|
import BAR, {haveBAR} from "gramene-efp-browser";
|
|
5
8
|
|
|
6
9
|
function DynamicIframe(props) {
|
|
7
10
|
// Create a ref for the iframe element
|
|
8
11
|
const iframeRef = useRef(null);
|
|
12
|
+
const [iframeHeight, setIframeHeight] = useState(500); // Default height
|
|
9
13
|
|
|
10
|
-
// Function to resize iframe height
|
|
11
|
-
const resizeIframe = () => {
|
|
12
|
-
if (iframeRef.current) {
|
|
13
|
-
const iframe = iframeRef.current;
|
|
14
|
-
const innerDoc = iframe.contentDocument || iframe.contentWindow.document;
|
|
15
|
-
iframe.style.height = 44 + innerDoc.body.scrollHeight + 'px';
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// Resize iframe when content loads
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
resizeIframe();
|
|
22
|
-
}, []); // Empty dependency array ensures it only runs once after initial render
|
|
23
|
-
|
|
24
|
-
// Optional: Resize iframe when window is resized
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
window.addEventListener('resize', resizeIframe);
|
|
27
|
-
return () => {
|
|
28
|
-
window.removeEventListener('resize', resizeIframe);
|
|
29
|
-
};
|
|
30
|
-
}, []); // Empty dependency array ensures it only runs once after initial render
|
|
31
|
-
|
|
32
|
-
// Resize iframe when content changes
|
|
33
14
|
useEffect(() => {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const observer = new MutationObserver(resizeIframe);
|
|
38
|
-
const checkElement = () => {
|
|
39
|
-
const innerDoc = iframe.contentDocument || iframe.contentWindow.document;
|
|
40
|
-
const targetElement = innerDoc.querySelector('#heatmapContainer');
|
|
41
|
-
if (targetElement) {
|
|
42
|
-
observer.observe(targetElement, { attributes: true, childList: true, subtree: true });
|
|
43
|
-
} else {
|
|
44
|
-
setTimeout(checkElement, 200); // Check again after 100 milliseconds
|
|
15
|
+
const handleMessage = (event) => {
|
|
16
|
+
if (event.data.type === 'heightChange') {
|
|
17
|
+
setIframeHeight(event.data.height + 44);
|
|
45
18
|
}
|
|
46
19
|
};
|
|
47
|
-
checkElement();
|
|
48
20
|
|
|
49
|
-
|
|
21
|
+
window.addEventListener("message", handleMessage);
|
|
22
|
+
|
|
23
|
+
return () => window.removeEventListener("message", handleMessage);
|
|
50
24
|
}, []);
|
|
51
25
|
|
|
52
26
|
return (
|
|
@@ -54,7 +28,7 @@ function DynamicIframe(props) {
|
|
|
54
28
|
ref={iframeRef}
|
|
55
29
|
src={props.url}
|
|
56
30
|
title="Dynamic Iframe"
|
|
57
|
-
style={{ width: '100%', border: 'none' }}
|
|
31
|
+
style={{ width: '100%', height: `${iframeHeight}px`, border: 'none' }}
|
|
58
32
|
/>
|
|
59
33
|
);
|
|
60
34
|
}
|
|
@@ -71,7 +45,11 @@ const Detail = props => {
|
|
|
71
45
|
useEffect(() => {
|
|
72
46
|
const tid = Math.floor(gene.taxon_id / 1000);
|
|
73
47
|
if (props.expressionStudies[tid]) {
|
|
74
|
-
let eList = props.expressionStudies[tid]
|
|
48
|
+
let eList = props.expressionStudies[tid];
|
|
49
|
+
if (props.searchResult.hasOwnProperty('expressed_in_gxa_attr_ss')) {
|
|
50
|
+
const in_gxa = new Set(props.searchResult.expressed_in_gxa_attr_ss);
|
|
51
|
+
eList = props.expressionStudies[tid].filter(e => in_gxa.has(e._id));
|
|
52
|
+
}
|
|
75
53
|
setAtlasExperimentList(eList);
|
|
76
54
|
|
|
77
55
|
let refExp = eList.filter(e => e.isRef);
|
|
@@ -85,46 +63,47 @@ const Detail = props => {
|
|
|
85
63
|
}, [props.expressionStudies]);
|
|
86
64
|
|
|
87
65
|
let paralogs_url;
|
|
88
|
-
let gene_url =
|
|
66
|
+
let gene_url = `https://dev.gramene.org/static/atlasWidget.html?genes=${gene.atlas_id || gene._id}&experiment=${atlasExperiment}&localAPI=${isLocal}`;
|
|
89
67
|
let paralogs = [];
|
|
90
68
|
if (gene.homology && gene.homology.homologous_genes && gene.homology.homologous_genes.within_species_paralog) {
|
|
91
69
|
paralogs = gene.homology.homologous_genes.within_species_paralog;
|
|
92
70
|
}
|
|
93
71
|
if (paralogs.length > 1 && atlasExperiment) {
|
|
94
|
-
paralogs_url=
|
|
72
|
+
paralogs_url= `https://dev.gramene.org/static/atlasWidget.html?genes=${paralogs.join(' ')}&experiment=${atlasExperiment}&localAPI=${isLocal}`;
|
|
95
73
|
}
|
|
74
|
+
const ref = useRef(null);
|
|
75
|
+
const ref2 = useRef(null);
|
|
96
76
|
return <Tabs>
|
|
97
77
|
{paralogs_url &&
|
|
98
78
|
<Tab tabClassName="gxa" eventKey="paralogs" title={`Paralogs`} key="gxaparalogs">
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
<Form.Label column sm={1}>Experiment</Form.Label>
|
|
109
|
-
<Col sm={5}>
|
|
110
|
-
<Form.Select defaultValue={atlasExperiment} onChange={(e) => setAtlasExperiment(e.target.value)}>
|
|
111
|
-
{atlasExperimentList.map((experiment, index) => (
|
|
112
|
-
<option key={index} value={experiment._id}>{experiment.description || experiment._id}</option>
|
|
113
|
-
))}
|
|
114
|
-
</Form.Select>
|
|
115
|
-
</Col>
|
|
116
|
-
</Form.Group>
|
|
117
|
-
</Form>
|
|
79
|
+
<Typeahead clearButton size='sm'
|
|
80
|
+
id="experiment-selector"
|
|
81
|
+
ref={ref}
|
|
82
|
+
labelKey="experiment"
|
|
83
|
+
onChange={(exps) => {if (exps.length > 0) {setAtlasExperiment(exps[0]._id);setTimeout(() => ref.current?.clear(), 2000)}}}
|
|
84
|
+
placeholder="Choose an experiment..."
|
|
85
|
+
options={atlasExperimentList}
|
|
86
|
+
labelKey={(experiment) => `${experiment.type}: ${experiment.description || experiment._id}`}
|
|
87
|
+
/>
|
|
118
88
|
<DynamicIframe url={paralogs_url}/>
|
|
119
89
|
</Tab>
|
|
120
90
|
}
|
|
121
91
|
<Tab tabClassName="gxa" eventKey="gene" title="All Studies" key="gxa">
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
92
|
+
{/*<Form.Check*/}
|
|
93
|
+
{/* type="switch"*/}
|
|
94
|
+
{/* id="localAPI"*/}
|
|
95
|
+
{/* label="Local API"*/}
|
|
96
|
+
{/* checked={isLocal}*/}
|
|
97
|
+
{/* onChange={handleLocalAPIChange}*/}
|
|
98
|
+
{/*/>*/}
|
|
99
|
+
<Typeahead clearButton size='sm'
|
|
100
|
+
id="experiment-selector2"
|
|
101
|
+
ref={ref}
|
|
102
|
+
labelKey="experiment"
|
|
103
|
+
onChange={(exps) => {if (exps.length > 0) {setAtlasExperiment(exps[0]._id);setTimeout(() => ref.current?.clear(), 2000)}}}
|
|
104
|
+
placeholder="Choose an experiment..."
|
|
105
|
+
options={atlasExperimentList}
|
|
106
|
+
labelKey={(experiment) => `${experiment.type}: ${experiment.description || experiment._id}`}
|
|
128
107
|
/>
|
|
129
108
|
<DynamicIframe url={gene_url}/>
|
|
130
109
|
</Tab>
|
|
@@ -135,9 +114,9 @@ const Detail = props => {
|
|
|
135
114
|
};
|
|
136
115
|
|
|
137
116
|
export default connect(
|
|
138
|
-
//
|
|
117
|
+
//'selectParalogExpression',
|
|
139
118
|
'selectExpressionStudies',
|
|
140
|
-
'doRequestParalogExpression',
|
|
119
|
+
//'doRequestParalogExpression',
|
|
141
120
|
Detail
|
|
142
121
|
);
|
|
143
122
|
|
package/src/demo.js
CHANGED
|
@@ -44,8 +44,8 @@ const panSites = [
|
|
|
44
44
|
url: 'https://www.gramene.org',
|
|
45
45
|
ensemblURL: 'https://ensembl.gramene.org',
|
|
46
46
|
ensemblSite: 'https://ensembl.gramene.org',
|
|
47
|
-
ensemblRest: 'https://data.gramene.org/
|
|
48
|
-
grameneData: 'https://data.gramene.org/
|
|
47
|
+
ensemblRest: 'https://data.gramene.org/ensembl69',
|
|
48
|
+
grameneData: 'https://data.gramene.org/v69',
|
|
49
49
|
ga: 'G-ZTEQBFCRXZ',
|
|
50
50
|
targetTaxonId: 3702,
|
|
51
51
|
alertText: 'Main site',
|
|
@@ -89,10 +89,10 @@ const panSites = [
|
|
|
89
89
|
ensemblURL: 'https://test.gramene.org',
|
|
90
90
|
ensemblSite: 'https://test.gramene.org',
|
|
91
91
|
ensemblRest: 'https://data.gramene.org/pansite-ensembl-108',
|
|
92
|
-
grameneData: 'https://data.
|
|
92
|
+
grameneData: 'https://data.sorghumbase.org/auth_testing',
|
|
93
93
|
targetTaxonId: 4577,
|
|
94
94
|
ga: "G-Y7ZYG1R8QT",
|
|
95
|
-
showViews:
|
|
95
|
+
showViews: true,
|
|
96
96
|
not_downtime: 'The search interface will be undergoing maintenance on Tuesday, July 20 from 3:00 - 4:00 PM EDT',
|
|
97
97
|
details: {
|
|
98
98
|
sequences: true,
|