gramene-search 1.2.76 → 1.2.78

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gramene-search",
3
- "version": "1.2.76",
3
+ "version": "1.2.78",
4
4
  "description": "search wrapper for gramene",
5
5
  "source": "src/index.js",
6
6
  "main": "dist/index.js",
@@ -76,6 +76,26 @@ grameneSuggestions.doFocusFirstGrameneSuggestion = arg => ({dispatch, getState})
76
76
  console.log('inside doFocusFirstGrameneSuggestion');
77
77
  };
78
78
 
79
+ function compressLongTaxonName(node) {
80
+ const fullName = node.name;
81
+ const removedExtraineousWords = fullName.replace(/( Group$| subsp\.| ssp\.| var\.| strain)/, '');
82
+ let finalVersion;
83
+ if (removedExtraineousWords.length > 20) {
84
+ let words = removedExtraineousWords.split(' ');
85
+ if (words.length === 2) {
86
+ // abrreviate first word.
87
+ finalVersion = removedExtraineousWords.replace(/^([A-Z])[a-z]+/, '$1.')
88
+ }
89
+ if (words.length > 2) {
90
+ finalVersion = removedExtraineousWords.replace(/^([A-Z])[a-z]+\s([a-z])[a-z]+/, '$1$2.')
91
+ }
92
+ }
93
+ else {
94
+ finalVersion = removedExtraineousWords;
95
+ }
96
+ node.short_name = finalVersion;
97
+ }
98
+
79
99
  const grameneTaxonomy = createAsyncResourceBundle({
80
100
  name: 'grameneTaxonomy',
81
101
  actionBaseType: 'GRAMENE_TAXONOMY',
@@ -87,6 +107,7 @@ const grameneTaxonomy = createAsyncResourceBundle({
87
107
  let taxonomy = _.keyBy(taxNodes, '_id');
88
108
  taxNodes.forEach(t => {
89
109
  t._id = +t._id; // ensure taxonomy id is a number
110
+ compressLongTaxonName(t);
90
111
  if (t.hasOwnProperty("is_a")) {
91
112
  t.is_a.forEach(p_id => {
92
113
  const p = taxonomy[p_id];
@@ -44,30 +44,41 @@ function trimSummary(summary) {
44
44
  return <p>{summary}</p>
45
45
  }
46
46
  }
47
+ const PanLink = (props) => {
48
+ const gene = props.gene;
49
+ const pan = props.pan;
50
+ return <div className="gene-panlink">
51
+ <a target="_blank" href={pan.url + gene.id}>
52
+ <img src={pan.svg} title={`View this gene at ${pan.name}`}/>
53
+ </a>
54
+ </div>;
55
+ };
47
56
 
48
57
  const ClosestOrthologCmp = (props) =>
49
58
  {
50
- let id, taxon_id, name, desc, species;
59
+ let id, taxon_id, name, desc, species, className;
51
60
  const gene = props.gene;
52
61
 
53
- if (gene.model_rep_id) {
62
+ if (gene.closest_rep_id) {
63
+ name = gene.closest_rep_name || gene.closest_rep_id;
64
+ desc = gene.closest_rep_description;
65
+ species = gene.closest_rep_species_name;
66
+ id = gene.closest_rep_id;
67
+ taxon_id = gene.closest_rep_taxon_id;
68
+ className = "closest-ortholog";
69
+ }
70
+ else if (gene.model_rep_id) {
54
71
  name = gene.model_rep_name || gene.model_rep_id;
55
72
  desc = gene.model_rep_description;
56
73
  species = gene.model_rep_species_name;
57
74
  id = gene.model_rep_id;
58
75
  taxon_id = gene.model_rep_taxon_id;
76
+ className = "model-ortholog";
59
77
  }
60
78
 
61
- else if (gene.closest_rep_id) {
62
- name = gene.closest_rep_name || gene.closest_rep_id;
63
- desc = gene.closest_rep_description;
64
- species = gene.closest_rep_species_name;
65
- id = gene.closest_rep_id;
66
- taxon_id = gene.closest_rep_taxon_id;
67
- }
68
79
 
69
80
  return (
70
- <div className="closest-ortholog" onClick={() => {
81
+ <div className={className} onClick={() => {
71
82
  props.doEnsureGrameneGenome(taxon_id);
72
83
  props.doReplaceGrameneFilters(suggestionToFilters({
73
84
  category: 'Gene',
@@ -76,10 +87,8 @@ const ClosestOrthologCmp = (props) =>
76
87
  name: name
77
88
  }))
78
89
  }}>
79
- <h4>
80
- <span className="gene-id">{name}</span>
81
- <small className="species-name"> {species}</small>
82
- </h4>
90
+ <div className="gene-species">{species}</div>
91
+ <h3 className="gene-id">{name}</h3>
83
92
  <p>{desc}</p>
84
93
  </div>
85
94
  );
@@ -197,15 +206,15 @@ class Gene extends React.Component {
197
206
  renderMetadata() {
198
207
  let gene = this.props.searchResult;
199
208
  if (gene.model_rep_taxon_id) {
200
- gene.model_rep_species_name = this.props.taxLut[gene.model_rep_taxon_id].name;
209
+ gene.model_rep_species_name = this.props.taxLut[gene.model_rep_taxon_id].short_name;
201
210
  }
202
211
  if (gene.closest_rep_taxon_id) {
203
- gene.closest_rep_species_name = this.props.taxLut[gene.closest_rep_taxon_id].name;
212
+ gene.closest_rep_species_name = this.props.taxLut[gene.closest_rep_taxon_id].short_name;
204
213
  }
205
214
  return renderTairSummary(gene) || renderClosestOrtholog(gene);
206
215
  }
207
216
  render() {
208
- const ensemblURL = this.props.ensemblURL;
217
+ const panSite = this.props.panSite;
209
218
  const searchResult = this.props.searchResult;
210
219
  const taxName = this.props.taxName;
211
220
  // let orthologs='';
@@ -217,6 +226,7 @@ class Gene extends React.Component {
217
226
  <div className="result-gene">
218
227
  <div className="result-gene-summary">
219
228
  <div className="result-gene-title-body">
229
+ {panSite.hasOwnProperty(searchResult.system_name) && <PanLink pan={panSite[searchResult.system_name]} gene={searchResult}/>}
220
230
  <div className="gene-title">
221
231
  <div className="gene-species">{taxName}</div>
222
232
  <h3 className="gene-name">{searchResult.name}
@@ -273,6 +283,7 @@ const GeneList = props => {
273
283
  searchResult={g}
274
284
  ensemblURL={props.configuration.ensemblURL}
275
285
  ensemblRest={props.configuration.ensemblRest}
286
+ panSite={props.configuration.panSite}
276
287
  taxName={props.grameneTaxonomy[g.taxon_id].name}
277
288
  geneDocs={props.grameneGenes}
278
289
  requestGene={props.doRequestGrameneGene}
@@ -71,6 +71,14 @@
71
71
  float: right;
72
72
  border: dashed 1px blue;
73
73
  }
74
+ .gene-panlink {
75
+ float:right;
76
+ }
77
+ .gene-panlink img {
78
+ height: 60px;
79
+ width: auto;
80
+ vertical-align: top;
81
+ }
74
82
  .gene-detail-tabs {
75
83
  display: flex;
76
84
  flex-wrap: wrap;
@@ -115,7 +123,7 @@
115
123
  flex: 1 1 auto;
116
124
  width: 1036px;
117
125
  }
118
- .closest-ortholog, .gene-summary-tair {
126
+ .model-ortholog, .closest-ortholog, .gene-summary-tair {
119
127
  cursor: pointer;
120
128
  flex: 1 1 auto;
121
129
  width: 500px;
@@ -126,12 +134,15 @@
126
134
  border: 1px solid darkorange;
127
135
  }
128
136
 
129
- .closest-ortholog {
137
+ .model-ortholog {
130
138
  border: 1px dotted darkorange;
131
139
  }
140
+ .closest-ortholog {
141
+ border: 1px dotted darkgreen;
142
+ }
132
143
 
133
144
  .gene-summary-tair {
134
- border: 1px dotted darkgreen;
145
+ border: 1px dotted darkblue;
135
146
  }
136
147
  .gene-summary-tair .rest {
137
148
  display: none;
@@ -152,6 +163,7 @@
152
163
 
153
164
  /* this is the "title" of the closest ortholog box */
154
165
  .closest-ortholog::before,
166
+ .model-ortholog::before,
155
167
  .gene-summary-tair::before {
156
168
  position: relative;
157
169
  float: right;
@@ -162,15 +174,19 @@
162
174
  background: #fff;
163
175
  }
164
176
 
165
- .closest-ortholog::before {
177
+ .model-ortholog::before {
166
178
  content: "Model Species Homolog";
167
179
  color: orange;
168
180
  }
181
+ .closest-ortholog::before {
182
+ content: "Closest Annotated Homolog";
183
+ color: darkgreen;
184
+ }
169
185
 
170
186
  /* this is the "title" of the closest ortholog box */
171
187
  .gene-summary-tair::before {
172
188
  content: "TAIR Curated Description";
173
- color: darkgreen;
189
+ color: darkblue;
174
190
  }
175
191
 
176
192
  .gene-search-pic-sugg {
package/src/demo.js CHANGED
@@ -48,7 +48,29 @@ const panSites = [
48
48
  grameneData: 'https://data.gramene.org/v68',
49
49
  ga: 'G-ZTEQBFCRXZ',
50
50
  targetTaxonId: 3702,
51
- alertText: 'Main site'
51
+ alertText: 'Main site',
52
+ panSite : {
53
+ sorghum_bicolor : {
54
+ url: "https://sorghumbase.org/genes?idList=",
55
+ name: "SorghumBase",
56
+ svg: "./static/images/sorghum_logo.svg"
57
+ },
58
+ vitis_vinifera : {
59
+ url: "https://vitis.gramene.org?idList=",
60
+ name: "Gramene Grapevine",
61
+ svg: "./static/images/grapevine_logo.svg"
62
+ },
63
+ oryza_sativa : {
64
+ url: "https://oryza.gramene.org?idList=",
65
+ name: "Gramene Oryza",
66
+ svg: "./static/images/oryza_logo.svg"
67
+ },
68
+ zea_mays : {
69
+ url: "https://maize-pangenome.gramene.org?idList=",
70
+ name: "Gramene Maize",
71
+ svg: "./static/images/maize_logo.svg"
72
+ }
73
+ }
52
74
  },
53
75
  {
54
76
  id: 'maize',