Skip to content

Commit 83f4594

Browse files
committed
Merge branch 'hotfix-1.31.11'
2 parents ef09084 + a0532cc commit 83f4594

File tree

244 files changed

+5361
-9304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

244 files changed

+5361
-9304
lines changed

.jenkins/Jenkinsfile

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void setBuildStatus(String context, String message, String state) {
2121
pipeline {
2222
agent any
2323
tools {
24-
maven 'Maven 3.8.1'
24+
maven 'Maven 3.1.1'
2525
}
2626
parameters {
2727
string(name: 'DATA_DIR', defaultValue: '/space/gemmaData', description: 'Directory where production data is stored.')
@@ -34,6 +34,7 @@ pipeline {
3434
choice(name: 'STAGING_BRANCH', choices: ['hotfix', 'release'], description: 'Branch deployed to the staging server and CLI symlink.')
3535
// whether or not to force integration tests
3636
booleanParam(name: 'FORCE_INTEGRATION_TESTS', defaultValue: false, description: 'Force integration tests to be performed regardless of the branch being built.')
37+
booleanParam(name: 'FORCE_SONARQUBE', defaultValue: false, description: 'Force SonarQube analysis to be performed regardless of the branch being built.')
3738
}
3839
stages {
3940
stage('Checkout scm') {
@@ -131,6 +132,7 @@ pipeline {
131132
branch 'release-*'
132133
branch 'development'
133134
expression { params.FORCE_INTEGRATION_TESTS }
135+
expression { params.FORCE_SONARQUBE }
134136
}
135137
}
136138
parallel {
@@ -164,6 +166,34 @@ pipeline {
164166
}
165167
}
166168
}
169+
stage('SonarQube Analysis') {
170+
when {
171+
anyOf {
172+
branch 'master'
173+
branch 'hotfix-*'
174+
branch 'release-*'
175+
branch 'development'
176+
expression { params.FORCE_SONARQUBE }
177+
}
178+
}
179+
steps {
180+
setBuildStatus "SonarQube Analysis", "SonarQube analysis for build #${env.BUILD_NUMBER} has started...", 'PENDING'
181+
withSonarQubeEnv('UBC SonarQube') {
182+
sh "mvn sonar:sonar -Dsonar.projectKey=mslg"
183+
}
184+
}
185+
post {
186+
success {
187+
setBuildStatus "SonarQube analysis", "SonarQube analysis for build #${env.BUILD_NUMBER} have passed.", 'SUCCESS'
188+
}
189+
failure {
190+
setBuildStatus "SonarQube analysis", "SonarQube analysis for build #${env.BUILD_NUMBER} failed.", 'ERROR'
191+
}
192+
unstable {
193+
setBuildStatus "SonarQube analysis", "SonarQube analysis for build #${env.BUILD_NUMBER} failed.", 'FAILURE'
194+
}
195+
}
196+
}
167197
stage('Deploy artifacts') {
168198
when {
169199
anyOf {

gemma-cli/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<artifactId>gemma</artifactId>
55
<groupId>gemma</groupId>
6-
<version>1.31.10</version>
6+
<version>1.31.11</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99
<artifactId>gemma-cli</artifactId>

gemma-cli/src/main/java/ubic/gemma/core/apps/ArrayDesignProbeMapperCli.java

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import org.apache.commons.cli.Options;
66
import org.apache.commons.cli.ParseException;
77
import org.springframework.beans.factory.annotation.Autowired;
8+
import org.springframework.beans.factory.annotation.Value;
89
import ubic.gemma.core.analysis.sequence.ProbeMapperConfig;
9-
import ubic.gemma.core.config.Settings;
1010
import ubic.gemma.core.goldenpath.GoldenPathSequenceAnalysis;
1111
import ubic.gemma.core.loader.expression.arrayDesign.ArrayDesignProbeMapperService;
1212
import ubic.gemma.core.util.AbstractCLI;
@@ -18,7 +18,6 @@
1818
import ubic.gemma.model.expression.designElement.CompositeSequence;
1919
import ubic.gemma.model.genome.Taxon;
2020
import ubic.gemma.model.genome.sequenceAnalysis.BlatAssociation;
21-
import ubic.gemma.persistence.service.common.auditAndSecurity.AuditTrailService;
2221
import ubic.gemma.persistence.service.common.description.ExternalDatabaseService;
2322
import ubic.gemma.persistence.service.expression.designElement.CompositeSequenceService;
2423
import ubic.gemma.persistence.service.genome.taxon.TaxonService;
@@ -58,11 +57,19 @@ public class ArrayDesignProbeMapperCli extends ArrayDesignSequenceManipulatingCl
5857
private final static String OPTION_REFSEQ = "r";
5958

6059
@Autowired
61-
private AuditTrailService auditTrailService;
60+
private TaxonService taxonService;
61+
@Autowired
62+
private ArrayDesignProbeMapperService arrayDesignProbeMapperService;
63+
@Autowired
64+
private ExternalDatabaseService eds;
65+
@Autowired
66+
private CompositeSequenceService compositeSequenceService;
67+
68+
@Value("${gemma.goldenpath.db.rat}")
69+
private String goldenPathRatDbName;
6270

6371
private String[] probeNames = null;
6472
private ProbeMapperConfig config;
65-
private ArrayDesignProbeMapperService arrayDesignProbeMapperService;
6673
private String directAnnotationInputFileName = null;
6774
private boolean ncbiIds = false;
6875
private ExternalDatabase sourceDatabase = null;
@@ -76,12 +83,6 @@ public class ArrayDesignProbeMapperCli extends ArrayDesignSequenceManipulatingCl
7683
private Double identityThreshold = null;
7784
private Double overlapThreshold = null;
7885

79-
@Override
80-
public GemmaCLI.CommandGroup getCommandGroup() {
81-
return GemmaCLI.CommandGroup.PLATFORM;
82-
}
83-
84-
@SuppressWarnings({ "AccessStaticViaInstance", "static-access", "deprecation" })
8586
@Override
8687
protected void buildOptions( Options options ) {
8788
super.buildOptions( options );
@@ -178,8 +179,6 @@ protected boolean requireLogin() {
178179
return true;
179180
}
180181

181-
private TaxonService taxonService;
182-
183182
/**
184183
* See 'configure' for how the other options are handled. (non-Javadoc)
185184
*
@@ -188,8 +187,6 @@ protected boolean requireLogin() {
188187
@Override
189188
protected void processOptions( CommandLine commandLine ) throws ParseException {
190189
super.processOptions( commandLine );
191-
arrayDesignProbeMapperService = this.getBean( ArrayDesignProbeMapperService.class );
192-
taxonService = this.getBean( TaxonService.class );
193190

194191
if ( commandLine.hasOption( "import" ) ) {
195192
if ( !commandLine.hasOption( 't' ) ) {
@@ -201,8 +198,6 @@ protected void processOptions( CommandLine commandLine ) throws ParseException {
201198
}
202199
String sourceDBName = commandLine.getOptionValue( "source" );
203200

204-
ExternalDatabaseService eds = this.getBean( ExternalDatabaseService.class );
205-
206201
this.sourceDatabase = eds.findByName( sourceDBName );
207202

208203
this.directAnnotationInputFileName = commandLine.getOptionValue( "import" );
@@ -269,7 +264,7 @@ protected void processOptions( CommandLine commandLine ) throws ParseException {
269264
* Override to do additional checks to make sure the array design is in a state of readiness for probe mapping.
270265
*/
271266
@Override
272-
boolean needToRun( Date skipIfLastRunLaterThan, ArrayDesign arrayDesign,
267+
protected boolean needToRun( Date skipIfLastRunLaterThan, ArrayDesign arrayDesign,
273268
Class<? extends ArrayDesignAnalysisEvent> eventClass ) {
274269

275270
if ( this.force ) {
@@ -537,8 +532,7 @@ private void configure( ArrayDesign arrayDesign ) {
537532
isRat = taxon.getCommonName().equals( "rat" );
538533
}
539534

540-
boolean isMissingTracks = isRat && Settings
541-
.getString( "gemma.goldenpath.db.rat" ).startsWith( "rn" );
535+
boolean isMissingTracks = isRat && goldenPathRatDbName.startsWith( "rn" );
542536

543537
if ( mirnaOnlyModeOption ) {
544538
AbstractCLI.log.info( "Micro RNA only mode" );
@@ -649,7 +643,6 @@ private void processProbes( ArrayDesign arrayDesign ) {
649643
assert this.probeNames != null && this.probeNames.length > 0;
650644
arrayDesign = getArrayDesignService().thawLite( arrayDesign );
651645
this.configure( arrayDesign );
652-
CompositeSequenceService compositeSequenceService = this.getBean( CompositeSequenceService.class );
653646

654647
for ( String probeName : this.probeNames ) {
655648
CompositeSequence probe = compositeSequenceService.findByName( arrayDesign, probeName );
@@ -706,7 +699,7 @@ public void run() {
706699
}
707700
}
708701

709-
protected Taxon getTaxonByName( CommandLine commandLine ) {
702+
private Taxon getTaxonByName( CommandLine commandLine ) {
710703
String taxonName = commandLine.getOptionValue( 't' );
711704
ubic.gemma.model.genome.Taxon taxon = taxonService.findByCommonName( taxonName );
712705
if ( taxon == null ) {

gemma-cli/src/main/java/ubic/gemma/core/apps/ArrayDesignSequenceManipulatingCli.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ Collection<ArrayDesign> getRelatedDesigns( ArrayDesign design ) {
181181
*/
182182
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
183183
// Better semantics
184-
boolean needToRun( Date skipIfLastRunLaterThan, ArrayDesign arrayDesign,
184+
protected boolean needToRun( Date skipIfLastRunLaterThan, ArrayDesign arrayDesign,
185185
Class<? extends ArrayDesignAnalysisEvent> eventClass ) {
186186

187187
if ( isAutoSeek() ) {
@@ -192,7 +192,7 @@ boolean needToRun( Date skipIfLastRunLaterThan, ArrayDesign arrayDesign,
192192
return true;
193193

194194
List<AuditEvent> events = this.getEvents( arrayDesign, eventClass );
195-
if ( events.size() == 0 ) {
195+
if ( events.isEmpty() ) {
196196
return true; // always do it, it's never been done.
197197
}
198198
// return true if the last time was older than the limit time.
@@ -215,7 +215,7 @@ private void arraysFromCliList( CommandLine commandLine ) {
215215
}
216216
arrayDesignsToProcess.add( ad );
217217
}
218-
if ( arrayDesignsToProcess.size() == 0 ) {
218+
if ( arrayDesignsToProcess.isEmpty() ) {
219219
throw new RuntimeException( "There were no valid platforms specified" );
220220
}
221221
}
@@ -258,9 +258,9 @@ private boolean needToAutoRun( ArrayDesign arrayDesign, Class<? extends ArrayDes
258258
}
259259

260260
List<AuditEvent> eventsOfCurrentType = this.getEvents( arrayDesign, eventClass );
261-
List<AuditEvent> allEvents = ( List<AuditEvent> ) arrayDesign.getAuditTrail().getEvents();
261+
List<AuditEvent> allEvents = arrayDesign.getAuditTrail().getEvents();
262262

263-
if ( eventsOfCurrentType.size() == 0 ) {
263+
if ( eventsOfCurrentType.isEmpty() ) {
264264
// it's never been run.
265265
return true;
266266
}

gemma-cli/src/main/java/ubic/gemma/core/apps/ExperimentalDesignViewCli.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ protected void doWork() throws Exception {
121121
log.info( " Value: " + value );
122122

123123
for ( FactorValueBasicValueObject fv : categoryMap.get( category ).get( value ) ) {
124-
if ( fv.getMeasurement() != null ) continue; // don't list individual values.
124+
if ( fv.getMeasurementObject() != null ) continue; // don't list individual values.
125125

126126
Long factor = fv.getId();
127127
ExpressionExperimentValueObject expressionExperimentValueObject = ed2ee.get( factor2Design

gemma-cli/src/main/java/ubic/gemma/core/apps/ExpressionExperimentPrimaryPubCli.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,7 @@ protected void processOptions( CommandLine commandLine ) throws ParseException {
171171
try {
172172
this.pubmedIds = parsePubmedIdFile( this.pubmedIdFilename );
173173
} catch ( IOException e ) {
174-
log.error( e.getMessage() );
175-
e.printStackTrace();
174+
log.error( "Failed to parse PubMed ID file: " + this.pubmedIdFilename + ".", e );
176175
}
177176
}
178177
}

gemma-cli/src/main/java/ubic/gemma/core/apps/FindObsoleteTermsCli.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@
66
import org.springframework.beans.factory.annotation.Qualifier;
77
import org.springframework.beans.factory.annotation.Value;
88
import org.springframework.core.task.AsyncTaskExecutor;
9+
import ubic.basecode.ontology.model.OntologyTerm;
910
import ubic.gemma.core.ontology.OntologyService;
11+
import ubic.gemma.core.util.AbstractAuthenticatedCLI;
1012
import ubic.gemma.core.util.AbstractCLI;
11-
import ubic.gemma.model.common.description.Characteristic;
1213

1314
import java.util.LinkedHashMap;
1415
import java.util.List;
1516
import java.util.Map;
1617
import java.util.concurrent.CompletionService;
1718
import java.util.concurrent.ExecutorCompletionService;
1819
import java.util.concurrent.Future;
20+
import java.util.concurrent.TimeUnit;
1921
import java.util.stream.Collectors;
2022

21-
public class FindObsoleteTermsCli extends AbstractCLI {
23+
public class FindObsoleteTermsCli extends AbstractAuthenticatedCLI {
2224

2325
@Autowired
2426
private OntologyService ontologyService;
@@ -90,13 +92,13 @@ protected void doWork() throws Exception {
9092

9193
log.info( "Ontologies warmed up, starting check..." );
9294

93-
Map<Characteristic, Long> vos = ontologyService.findObsoleteTermUsage();
95+
Map<OntologyTerm, Long> vos = ontologyService.findObsoleteTermUsage( 4, TimeUnit.HOURS );
9496

9597
AbstractCLI.log.info( "Obsolete term check finished, printing ..." );
9698

9799
System.out.println( "Value\tValueUri\tCount" );
98-
for ( Map.Entry<Characteristic, Long> vo : vos.entrySet() ) {
99-
System.out.println( vo.getKey().getValue() + "\t" + vo.getKey().getValueUri() + "\t" + vo.getValue() );
100+
for ( Map.Entry<OntologyTerm, Long> vo : vos.entrySet() ) {
101+
System.out.println( vo.getKey().getLabel() + "\t" + vo.getKey().getUri() + "\t" + vo.getValue() );
100102
}
101103
}
102104
}
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
package ubic.gemma.core.apps;
2+
3+
import org.apache.commons.cli.CommandLine;
4+
import org.apache.commons.cli.Options;
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.beans.factory.annotation.Qualifier;
7+
import org.springframework.beans.factory.annotation.Value;
8+
import org.springframework.core.task.AsyncTaskExecutor;
9+
import ubic.basecode.ontology.model.OntologyTerm;
10+
import ubic.gemma.core.ontology.OntologyService;
11+
import ubic.gemma.core.util.AbstractAuthenticatedCLI;
12+
import ubic.gemma.core.util.CLI;
13+
14+
import java.util.ArrayList;
15+
import java.util.LinkedHashMap;
16+
import java.util.List;
17+
import java.util.Map;
18+
import java.util.concurrent.CompletionService;
19+
import java.util.concurrent.ExecutorCompletionService;
20+
import java.util.concurrent.Future;
21+
import java.util.concurrent.TimeUnit;
22+
import java.util.stream.Collectors;
23+
24+
public class FixOntologyTermLabelsCli extends AbstractAuthenticatedCLI {
25+
26+
boolean dryRun = false;
27+
28+
29+
@Autowired
30+
private OntologyService ontologyService;
31+
32+
@Autowired
33+
@Qualifier("ontologyTaskExecutor")
34+
private AsyncTaskExecutor ontologyTaskExecutor;
35+
36+
@Value("${load.ontologies}")
37+
private boolean autoLoadOntologies;
38+
39+
@Autowired
40+
private List<ubic.basecode.ontology.providers.OntologyService> ontologies;
41+
42+
@Override
43+
public GemmaCLI.CommandGroup getCommandGroup() {
44+
return GemmaCLI.CommandGroup.METADATA;
45+
}
46+
47+
@Override
48+
public String getShortDesc() {
49+
return "Check and correct characteristics & statements using the wrong label for an ontology term";
50+
}
51+
52+
@Override
53+
protected void processOptions( CommandLine commandLine ) {
54+
if ( commandLine.hasOption( 'd' ) ) {
55+
dryRun = true;
56+
}
57+
}
58+
59+
@Override
60+
public String getCommandName() {
61+
return "fixOntologyTermLabels";
62+
}
63+
64+
@Override
65+
protected void buildOptions( Options options ) {
66+
options.addOption( "d", "dryRun", false, "Dry run, do not update the database [default: " + dryRun + "]" );
67+
}
68+
69+
@Override
70+
protected void doWork() throws Exception {
71+
if ( autoLoadOntologies ) {
72+
throw new IllegalArgumentException( "Auto-loading of ontologies is enabled, disable it by setting load.ontologies=false in Gemma.properties." );
73+
}
74+
75+
List<ubic.basecode.ontology.providers.OntologyService> ontologiesLoading = new ArrayList<>( );
76+
77+
log.info( String.format( "Warming up %d ontologies ...", ontologies.size() ) );
78+
CompletionService<ubic.basecode.ontology.providers.OntologyService> completionService = new ExecutorCompletionService<>( ontologyTaskExecutor );
79+
Map<ubic.basecode.ontology.providers.OntologyService, Future<ubic.basecode.ontology.providers.OntologyService>> futures = new LinkedHashMap<>();
80+
for ( ubic.basecode.ontology.providers.OntologyService ontology : ontologies ) {
81+
ontologiesLoading.add( ontology );
82+
futures.put( ontology, completionService.submit( () -> {
83+
// we don't need all those features
84+
ontology.setSearchEnabled( false );
85+
ontology.setInferenceMode( ubic.basecode.ontology.providers.OntologyService.InferenceMode.NONE );
86+
ontology.initialize( true, false );
87+
return ontology;
88+
} ) );
89+
}
90+
91+
for ( int i = 0; i < ontologiesLoading.size(); i++ ) {
92+
ubic.basecode.ontology.providers.OntologyService os = completionService.take().get();
93+
log.info( String.format( " === Ontology (%d/%d) warmed up: %s", i + 1, ontologies.size(), os ) );
94+
int remainingToLoad = ontologies.size() - ( i + 1 );
95+
if ( remainingToLoad > 0 && remainingToLoad <= 5 ) {
96+
log.info( "Still loading:\n\t" + futures.entrySet().stream().filter( e -> !e.getValue().isDone() )
97+
.map( Map.Entry::getKey )
98+
.map( ubic.basecode.ontology.providers.OntologyService::toString )
99+
.collect( Collectors.joining( "\n\t" ) ) );
100+
}
101+
}
102+
103+
log.info( "Ontologies warmed up, starting check..." );
104+
105+
Map<String, OntologyTerm> mismatches = ontologyService.fixOntologyTermLabels( dryRun, 4, TimeUnit.HOURS );
106+
107+
System.out.println("Wrong_label\tCorrect_Label\tURI");
108+
for ( Map.Entry<String, OntologyTerm> entry : mismatches.entrySet() ) {
109+
System.out.println( entry.getKey() + "\t" + entry.getValue().getLabel() + "\t" + entry.getValue().getUri());
110+
}
111+
112+
113+
}
114+
}

0 commit comments

Comments
 (0)