Skip to content

Commit eb0605f

Browse files
committed
Merge branch 'hotfix-1.4.4'
2 parents f06ab35 + 0bcdfc6 commit eb0605f

File tree

17 files changed

+248
-194
lines changed

17 files changed

+248
-194
lines changed

docs/installation.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ cache, and much more!
2424
Create the database and an associated user that the application will use to store and retrieve data.
2525

2626
```sql
27-
create database <database name> character set utf8mb4 collate utf8mb4_general_ci;
27+
create database '<database name>' character set utf8mb4;
2828
create user '<database username>'@'%' identified by '<database password>';
2929
grant all on rdp.* to '<database username>'@'%';
3030
```
3131

32-
If you're using MySQL 5.6 or prior, use the `utf8` character set and `utf8_general_ci` collate. It is a 3 bytes subset
33-
of the typical 4-bytes UTF-8 character encoding. Otherwise, you will face issues with the index size limit of 767 bytes
34-
due to some of our indexed columns containing 255 characters (4 * 255 = 1020 > 767, but 3 * 255 = 765).
32+
If you're using MySQL 5.6 or prior, use the `utf8` character set. It is a 3 bytes subset of the typical 4-bytes UTF-8
33+
character encoding. Otherwise, you will face issues with the index size limit of 767 bytes due to some of our indexed
34+
columns containing 255 characters (4 * 255 = 1020 > 767, but 3 * 255 = 765).
3535

3636
## Setup application.properties
3737

docs/release-notes.md

+21-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Release Notes
22

3+
## 1.4.4
4+
5+
Use the build version for the OpenAPI specification so that it is always up-to-date.
6+
7+
Fix calculation of human gene coverage, the orthologs were commented out and the SQL query has been added.
8+
9+
Fix field length in the profile to use the value previously set in `profile.css`. The CSS code it contains as well as
10+
other files have been merged in `common.css`. A flexbox is used for the email since it needs to also account for the
11+
verify button.
12+
313
## 1.4.3
414

515
Fix `hideGenelist` accessor in the user profile template which resulted in an error. For now on, property names will be
@@ -17,12 +27,20 @@ where email in (select email
1727
having count(email) > 1);
1828
```
1929

20-
You should then take action by removing or merging those users. We recommend removing those with the latest `id`
30+
You should then take action by removing or merging those users. We recommend removing those with the latest `user_id`
2131
fields, but this is ultimately at your discretion.
2232

33+
Since these users are not valid, you will have to remove the verification token that was generated at registration
34+
before removing the user itself:
35+
36+
```sql
37+
delete from verification_token where user_id = ?;
38+
delete from user where user_id = ?;
39+
```
40+
2341
## 1.4.2
2442

25-
Restore rdp.site.shortname and `rdp.site.fullname` in `application.properties` since they're still being used in the
43+
Restore `rdp.site.shortname` and `rdp.site.fullname` in `application.properties` since they're still being used in the
2644
user FAQ.
2745

2846
Fix missing TaskExecutor when using an HTTP proxy. It now uses native`-Dhttp.proxyHost` and `-Dhttp.proxyPort` JVM
@@ -34,7 +52,7 @@ Move all email text into messages.properties, so they can be adjusted and transl
3452

3553
Fix missing flash messages after confirming registration and contact email.
3654

37-
Fix /api/users API endpoint for registries that are not using gene-level privacy. In this case, the gene privacy level
55+
Fix `/api/users` API endpoint for registries that are not using gene-level privacy. In this case, the gene privacy level
3856
is always set to `null` and the value in the profile must be used instead as a fallback.
3957

4058
Require MySQL 5.7+ and add instructions for using MySQL 5.6 and prior. This is due to a index size limit that is busted

pom.xml

+9-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>ubc.pavlab</groupId>
77
<artifactId>rdp</artifactId>
8-
<version>1.4.3</version>
8+
<version>1.4.4</version>
99

1010
<developers>
1111
<developer>
@@ -183,6 +183,14 @@
183183
<plugin>
184184
<groupId>org.springframework.boot</groupId>
185185
<artifactId>spring-boot-maven-plugin</artifactId>
186+
<executions>
187+
<execution>
188+
<id>build-info</id>
189+
<goals>
190+
<goal>build-info</goal>
191+
</goals>
192+
</execution>
193+
</executions>
186194
</plugin>
187195
<plugin>
188196
<groupId>com.amashchenko.maven.plugin</groupId>

src/main/java/ubc/pavlab/rdp/ApiConfig.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import io.swagger.v3.oas.models.info.Info;
66
import io.swagger.v3.oas.models.servers.Server;
77
import org.springframework.beans.factory.annotation.Autowired;
8+
import org.springframework.boot.info.BuildProperties;
89
import org.springframework.context.MessageSource;
910
import org.springframework.context.annotation.Bean;
1011
import org.springframework.context.annotation.Configuration;
@@ -24,6 +25,9 @@ public class ApiConfig {
2425
@Autowired
2526
private SiteSettings siteSettings;
2627

28+
@Autowired
29+
private BuildProperties buildProperties;
30+
2731
@Bean
2832
public OpenAPI openAPI( MessageSource messageSource ) {
2933
// FIXME: retrieve that from the request context
@@ -34,7 +38,7 @@ public OpenAPI openAPI( MessageSource messageSource ) {
3438
.title( messageSource.getMessage( "ApiConfig.title", new String[]{ shortname }, locale ) )
3539
.description( messageSource.getMessage( "ApiConfig.description", new String[]{ shortname }, locale ) )
3640
.contact( new Contact().email( siteSettings.getContactEmail() ) )
37-
.version( ApiController.API_VERSION ) )
41+
.version( buildProperties.getVersion() ) )
3842
.servers( Collections.singletonList( new Server().url( siteSettings.getHostUri().toString() ) ) );
3943

4044
}

src/main/java/ubc/pavlab/rdp/controllers/ApiController.java

+3-16
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import java.util.stream.Collectors;
3232

3333
/**
34-
* This class provides API access for remote applications
34+
* This class provides API accesses for remote applications
3535
* <p>
3636
* It's worth mentioning that the '/api' endpoint is delegated to springdoc OpenAPI JSON generator and welcome the
3737
* client with a specification of the endpoints of this API.
@@ -41,11 +41,6 @@
4141
@CommonsLog
4242
public class ApiController {
4343

44-
/**
45-
* API version
46-
*/
47-
public static final String API_VERSION = "1.4.0";
48-
4944
@Autowired
5045
private MessageSource messageSource;
5146
@Autowired
@@ -66,12 +61,12 @@ public class ApiController {
6661
private PermissionEvaluator permissionEvaluator;
6762

6863
@ExceptionHandler({ AuthenticationException.class })
69-
public ResponseEntity handleAuthenticationException() {
64+
public ResponseEntity<?> handleAuthenticationException() {
7065
return ResponseEntity.status( HttpStatus.UNAUTHORIZED ).build();
7166
}
7267

7368
@ExceptionHandler({ ApiException.class })
74-
public ResponseEntity handleApiException( ApiException e ) {
69+
public ResponseEntity<String> handleApiException( ApiException e ) {
7570
return ResponseEntity.status( e.getStatus() ).body( e.getMessage() );
7671
}
7772

@@ -96,10 +91,6 @@ public Object getStats() {
9691
* Retrieve all users in a paginated format.
9792
* <p>
9893
* Results that cannot be displayed are anonymized.
99-
*
100-
* @param pageable
101-
* @param locale
102-
* @return
10394
*/
10495
@GetMapping(value = "/api/users", produces = MediaType.APPLICATION_JSON_VALUE)
10596
public Object getUsers( @RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authorizationHeader,
@@ -122,10 +113,6 @@ public Object getUsers( @RequestHeader(value = HttpHeaders.AUTHORIZATION, requir
122113
* Retrieve all genes in a paginated format.
123114
* <p>
124115
* Results that cannot be displayed are anonymized.
125-
*
126-
* @param pageable
127-
* @param locale
128-
* @return
129116
*/
130117
@GetMapping(value = "/api/genes", produces = MediaType.APPLICATION_JSON_VALUE)
131118
public Object getGenes( @RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authorizationHeader,

src/main/java/ubc/pavlab/rdp/repositories/UserGeneRepository.java

+9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import org.springframework.data.jpa.repository.QueryHints;
88
import org.springframework.data.repository.query.Param;
99
import org.springframework.stereotype.Repository;
10+
import ubc.pavlab.rdp.model.GeneInfo;
1011
import ubc.pavlab.rdp.model.Taxon;
1112
import ubc.pavlab.rdp.model.UserGene;
1213
import ubc.pavlab.rdp.model.UserOrgan;
@@ -82,6 +83,14 @@ public interface UserGeneRepository extends JpaRepository<UserGene, Integer> {
8283
@Query("select user_gene from UserGene user_gene where user_gene.geneId in (select ortholog.geneId from GeneInfo gene_info join gene_info.orthologs as ortholog where gene_info.geneId = :geneId and ortholog.taxon = :taxon)")
8384
Collection<UserGene> findOrthologsByGeneIdAndTaxon( @Param("geneId") Integer geneId, @Param("taxon") Taxon taxon );
8485

86+
/**
87+
* @param taxonId a taxon identifier in which to perform orthology search from
88+
* @return a collection of tuple whose first element is a {@link UserGene} and second element is the corresponding
89+
* {@link GeneInfo} ortholog in the supplied taxon.
90+
*/
91+
@Query(value = "select gi.gene_id from gene_info as gi join ortholog on gi.id = ortholog.source_gene join gene_info as gi2 on gi2.id = ortholog.target_gene join gene ug on ug.gene_id = gi2.gene_id where gi.taxon_id = :taxonId", nativeQuery = true)
92+
Collection<Integer> findOrthologGeneIdsByOrthologToTaxon( @Param("taxonId") Integer taxonId );
93+
8594
// Return all human genes.
8695
@QueryHints(@QueryHint(name = "org.hibernate.cacheable", value = "true"))
8796
@Query("select geneId FROM UserGene where taxon = '9606'")

src/main/java/ubc/pavlab/rdp/services/UserGeneServiceImpl.java

+7-10
Original file line numberDiff line numberDiff line change
@@ -113,20 +113,17 @@ public Integer countUniqueAssociationsAllTiers() {
113113
return userGeneRepository.countDistinctGeneByTierIn( tierService.getEnabledTiers() );
114114
}
115115

116+
/**
117+
* Count the number of unique associations to human genes that are either direct or indirect via orthology among all
118+
* tiers.
119+
* <p>
120+
* This is also known as the "human gene coverage".
121+
*/
116122
@Cacheable(cacheNames = "stats", key = "#root.methodName")
117123
@Override
118124
public Integer countUniqueAssociationsToHumanAllTiers() {
119-
/* This is also called the "human gene coverage" */
120125
Collection<Integer> humanGenes = new HashSet<>( userGeneRepository.findAllHumanGenes() );
121-
122-
// Add orthologs mapped to humans
123-
// TODO
124-
// humanGenes.addAll( userGeneRepository.findHumanGenesForTarget(
125-
// userGeneRepository.findDistinctGeneByTierIn( TierType.ANY )
126-
// ));
127-
128-
// Add directly entered human genes
129-
126+
humanGenes.addAll( userGeneRepository.findOrthologGeneIdsByOrthologToTaxon( 9606 ) );
130127
return humanGenes.size();
131128
}
132129

src/main/resources/ehcache.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
eternal="true"/>
2828

2929
<cache name="ubc.pavlab.rdp.model.UserGene"
30-
maxElementsInMemory="1000"
30+
maxElementsInMemory="10000"
3131
timeToLiveSeconds="600"/>
3232

3333
<cache name="ubc.pavlab.rdp.model.UserTerm"

src/main/resources/static/css/common.css

+133-4
Original file line numberDiff line numberDiff line change
@@ -181,17 +181,18 @@ table.table-fixed tr {
181181
}
182182

183183
table.table-fixed {
184-
height:220px;
184+
height: 220px;
185185
display: -moz-groupbox;
186186
}
187-
table.table-fixed tbody{
187+
188+
table.table-fixed tbody {
188189
overflow-y: scroll;
189190
height: 200px;
190191
/*width: 100%;*/
191192
position: absolute;
192193
}
193194

194-
.tip{
195+
.tip {
195196
font-size: x-small !important;
196197
background: cornflowerblue;
197198
color: whitesmoke;
@@ -202,4 +203,132 @@ table.table-fixed tbody{
202203
text-align: center;
203204
vertical-align: middle;
204205
line-height: 1.5em;
205-
}
206+
}
207+
208+
.section {
209+
width: 600px;
210+
margin-bottom: 15px;
211+
}
212+
213+
.pubmed-error:before {
214+
content: "Issue obtaining metadata.";
215+
color: red;
216+
}
217+
218+
input.data-edit {
219+
width: 90%;
220+
-ms-text-overflow: ellipsis;
221+
text-overflow: ellipsis;
222+
}
223+
224+
#privacy-levels .radio {
225+
margin: 12px 0 0 12px;
226+
}
227+
228+
#privacy-levels .radio input {
229+
margin-right: 3px;
230+
}
231+
232+
.margin-chbox div {
233+
margin: 0 12px 12px 14px;
234+
}
235+
236+
hr {
237+
margin: 0 0 10px;
238+
}
239+
240+
.tip {
241+
margin-top: -4px;
242+
}
243+
244+
.input-group {
245+
width: 99%;
246+
}
247+
248+
.isearch-settings, .form-group.row {
249+
margin-left: 0 !important;
250+
padding-left: 12px;
251+
padding-right: 12px;
252+
}
253+
254+
.isearch-settings * {
255+
font-size: 1rem;
256+
font-weight: 400;
257+
line-height: 1.5;
258+
vertical-align: center;
259+
260+
margin: 0 0 7px;
261+
padding: 0;
262+
}
263+
264+
.isearch-settings .label-text {
265+
position: relative;
266+
bottom: 1px;
267+
}
268+
269+
.isearch-settings #isearch-checkbox {
270+
transform: scale(1.2);
271+
padding: 0;
272+
}
273+
274+
.text-right {
275+
text-align: right;
276+
}
277+
278+
.tab-content {
279+
/*
280+
padding-top: 21px;
281+
margin-top: -1px;
282+
border: lightgray 1px solid;
283+
border-bottom-right-radius: 3px;
284+
border-bottom-left-radius: 3px;
285+
border-top: none;
286+
*/
287+
}
288+
289+
/*
290+
#gene-search-btn{
291+
margin-left: 4px;
292+
margin-right: -4px;
293+
}
294+
295+
#ortholog-box{
296+
margin-top: -17px;
297+
}
298+
299+
.ortholog-select{
300+
margin-left: -2px;
301+
}
302+
*/
303+
304+
#alpha-grp button:active, #alpha-grp button.active, .input-group-prepend button[type='submit'] {
305+
background-color: dodgerblue;
306+
border-color: dodgerblue;
307+
color: whitesmoke;
308+
}
309+
310+
/*
311+
.tab-content h5{
312+
margin-left: 12px;
313+
}
314+
*/
315+
316+
.hide {
317+
height: 0 !important;
318+
display: none;
319+
}
320+
321+
.ortholog-search-text {
322+
font-style: italic;
323+
color: steelblue;
324+
}
325+
326+
.gene-error:before {
327+
content: "Could Not Find Gene.";
328+
color: red;
329+
}
330+
331+
.term-error:before {
332+
content: "Could Not Find Term.";
333+
color: red;
334+
}

0 commit comments

Comments
 (0)