Skip to content

Commit ff73950

Browse files
committed
Merge branch 'hotfix-1.27.10'
2 parents 9004bce + dfdfdfa commit ff73950

File tree

20 files changed

+117
-179
lines changed

20 files changed

+117
-179
lines changed

.editorconfig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@ indent_size=3
1616
indent_size=3
1717

1818
[CompositeSequence.hbm.xml]
19-
indent_size=3
19+
indent_size=3
20+
21+
[applicationContext-hibernate.xml]
22+
indent_style=tab

gemma-core/pom.xml

Lines changed: 2 additions & 2 deletions
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.27.9</version>
6+
<version>1.27.10</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99
<artifactId>gemma-core</artifactId>
@@ -39,7 +39,7 @@
3939
</goals>
4040
<configuration>
4141
<target>
42-
<echo append="false" file="${project.build.directory}/classes/version.properties">
42+
<echo append="false" file="${project.build.directory}/classes/ubic/gemma/version.properties">
4343
gemma.version=${project.version} built ${maven.build.timestamp}
4444
</echo>
4545
</target>

gemma-core/src/main/java/ubic/gemma/core/analysis/service/ExpressionAnalysisResultSetFileServiceImpl.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,11 @@ public void writeTsvToAppendable( ExpressionAnalysisResultSet analysisResultSet,
2424
.map( this::formatExperimentalFactor )
2525
.collect( Collectors.joining( ", " ) ) + "]";
2626

27-
List<String> header = new ArrayList<>();
28-
2927
// add the basic columns
30-
header.addAll( Arrays.asList( "id", "probe_id", "probe_name", "gene_id", "gene_name", "gene_ncbi_id", "gene_official_symbol", "pvalue", "corrected_pvalue", "rank" ) );
28+
List<String> header = new ArrayList<>( Arrays.asList( "id", "probe_id", "probe_name", "gene_id", "gene_name", "gene_ncbi_id", "gene_official_symbol", "gene_official_name", "pvalue", "corrected_pvalue", "rank" ) );
3129

3230
// we need to peek in the contrast result to understand factor value interactions
33-
// i.e. interaction between genotype and timepoint might result in a contrast_male_3h column, although we would
31+
// i.e. interaction between genotype and time point might result in a contrast_male_3h column, although we would
3432
// use factor value IDs in the actual column name which might result in something like contrast_1292_2938
3533
final Collection<ContrastResult> firstContrastResults = analysisResultSet.getResults().stream()
3634
.findFirst()
@@ -53,25 +51,25 @@ public void writeTsvToAppendable( ExpressionAnalysisResultSet analysisResultSet,
5351
} );
5452

5553
CSVPrinter printer = getTsvFormatBuilder( "Experimental factors: " + experimentalFactorsMetadata )
56-
.setHeader( header.toArray( new String[header.size()] ) )
54+
.setHeader( header.toArray( new String[0] ) )
5755
.build()
5856
.print( appendable );
5957
for ( DifferentialExpressionAnalysisResult analysisResult : analysisResultSet.getResults() ) {
60-
final List<Object> record = new ArrayList<>();
6158
final List<Gene> genes = result2Genes.getOrDefault( analysisResult, Collections.emptyList() );
62-
record.addAll( Arrays.asList( analysisResult.getId(),
59+
final List<Object> record = new ArrayList<>( Arrays.asList( analysisResult.getId(),
6360
analysisResult.getProbe().getId(),
6461
analysisResult.getProbe().getName(),
6562
genes.stream().map( Gene::getId ).map( String::valueOf ).collect( Collectors.joining( getSubDelimiter() ) ),
6663
genes.stream().map( Gene::getName ).collect( Collectors.joining( getSubDelimiter() ) ),
6764
genes.stream().map( Gene::getNcbiGeneId ).map( String::valueOf ).collect( Collectors.joining( getSubDelimiter() ) ),
6865
genes.stream().map( Gene::getOfficialSymbol ).collect( Collectors.joining( getSubDelimiter() ) ),
66+
genes.stream().map( Gene::getOfficialName ).collect( Collectors.joining( getSubDelimiter() ) ),
6967
format( analysisResult.getPvalue() ),
7068
format( analysisResult.getCorrectedPvalue() ),
7169
format( analysisResult.getRank() ) ) );
72-
analysisResult.getContrasts().stream().sorted( contrastResultComparator ).forEachOrdered( contrastResult -> {
73-
record.addAll( Arrays.asList( format( contrastResult.getLogFoldChange() ), format( contrastResult.getTstat() ), format( contrastResult.getPvalue() ) ) );
74-
} );
70+
analysisResult.getContrasts().stream()
71+
.sorted( contrastResultComparator )
72+
.forEachOrdered( contrastResult -> record.addAll( Arrays.asList( format( contrastResult.getLogFoldChange() ), format( contrastResult.getTstat() ), format( contrastResult.getPvalue() ) ) ) );
7573
printer.printRecord( record );
7674
}
7775

gemma-core/src/main/java/ubic/gemma/core/apps/GeoGrabberCli.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
public class GeoGrabberCli extends AbstractCLIContextCLI {
4949

5050
private static final int NCBI_CHUNK_SIZE = 100;
51-
private static final int MAX_RETRIES = 5;
51+
private static final int MAX_RETRIES = 3; // on failures
52+
private static final int MAX_EMPTY_CHUNKS_IN_A_ROW = 20; // stop condition when we stop seeing useful records
5253
private Date dateLimit;
5354
private String gseLimit;
5455
private String outputFileName = "";
@@ -212,7 +213,7 @@ protected void doWork() throws Exception {
212213
}
213214
log.info( allowedTaxa.size() + " Taxa considered usable" );
214215
int retries = 0;
215-
216+
int numSkippedChunks = 0;
216217
boolean reachedRewindPoint = ( startDate == null && startFrom == null );
217218

218219
while ( keepGoing ) {
@@ -235,19 +236,16 @@ protected void doWork() throws Exception {
235236
}
236237

237238
if ( recs == null || recs.isEmpty() ) {
238-
// this doesn't happen any more, in my experience
239-
AbstractCLI.log.info( "No records received for start=" + start );
240-
retries++;
239+
// When this happens, the issue is that we filtered out all the results. So we should just ignore and keep going.
240+
AbstractCLI.log.info( "No records received for start=" + start + ", advancing" );
241+
numSkippedChunks++;
241242

242-
if ( retries > MAX_RETRIES ) {
243-
AbstractCLI.log.info( "Too many failures, giving up" );
243+
// repeated empty results can just mean we ran out of records.
244+
if (numSkippedChunks > MAX_EMPTY_CHUNKS_IN_A_ROW ) {
245+
log.info("Have already skipped " + numSkippedChunks + " chunks, still no records: bailing");
244246
break;
245247
}
246-
247-
try {
248-
Thread.sleep( 500 );
249-
} catch ( InterruptedException ignored ) {
250-
}
248+
start += NCBI_CHUNK_SIZE;
251249
continue;
252250
}
253251
} catch ( IOException e ) {
@@ -263,6 +261,7 @@ protected void doWork() throws Exception {
263261
}
264262

265263
retries = 0;
264+
numSkippedChunks = 0;
266265

267266
log.debug( "Retrieved " + recs.size() ); // we skip ones that are not using taxa of interest
268267
start += NCBI_CHUNK_SIZE; // this seems the best way to avoid hitting them more than once.

gemma-core/src/main/java/ubic/gemma/core/loader/entrez/pubmed/PubMedService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void loadFromDirectory( File directory ) {
6666
}
6767
}
6868

69-
private void loadFromFile( InputStream f ) {
69+
private void loadFromFile( InputStream f ) throws IOException {
7070
PubMedXMLParser p = new PubMedXMLParser();
7171
Collection<BibliographicReference> refs = p.parse( f );
7272
PubMedService.log.info( "Persisting " + refs.size() );

gemma-core/src/main/java/ubic/gemma/core/loader/entrez/pubmed/PubMedXMLParser.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public void extractPublisher( BibliographicReference bibRef, Node item ) {
9191
}
9292
}
9393

94-
public Collection<BibliographicReference> parse( InputStream is ) {
94+
public Collection<BibliographicReference> parse( InputStream is ) throws IOException {
9595

9696
try {
9797
// if ( is.available() == 0 ) {
@@ -107,7 +107,7 @@ public Collection<BibliographicReference> parse( InputStream is ) {
107107
PubMedXMLParser.log.debug( "done parsing" );
108108
return this.extractBibRefs( document );
109109
} catch ( IOException | SAXException | ParserConfigurationException e ) {
110-
throw new RuntimeException( e );
110+
throw new IOException( e );
111111
}
112112
}
113113

@@ -192,11 +192,11 @@ private Collection<BibliographicReference> extractBibRefs( Document document ) {
192192

193193
result.add( bibRef );
194194

195-
if ( i > 1 && i % 1000 == 0 ) {
195+
if ( i >= 100 && i % 1000 == 0 ) {
196196
PubMedXMLParser.log.info( "Processed " + i + " articles" );
197197
}
198198
}
199-
if ( i > 1 )
199+
if ( i >= 100 )
200200
PubMedXMLParser.log.info( "Processed " + i + " articles" );
201201

202202
return result;
@@ -366,11 +366,11 @@ private Collection<BibliographicReference> parseBookArticles( NodeList articles
366366

367367
result.add( bibRef );
368368

369-
if ( i > 0 && i % 1000 == 0 ) {
369+
if ( i >= 100 && i % 1000 == 0 ) {
370370
PubMedXMLParser.log.info( "Processed " + i + " books" );
371371
}
372372
}
373-
PubMedXMLParser.log.info( "Processed " + i + " books" );
373+
if (i >= 100) PubMedXMLParser.log.info( "Processed " + i + " books" );
374374
return result;
375375
}
376376

@@ -707,6 +707,8 @@ private Node processRecord( BibliographicReference bibRef, Node record ) {
707707
case "OtherAbstract":
708708
case "Suffix":
709709
case "SupplMeshList": //hmm.
710+
case "GeneralNote":
711+
case "NumberOfReferences":
710712
break;
711713
default:
712714
log.warn( "Unrecognized node name " + name );

gemma-core/src/main/java/ubic/gemma/core/loader/expression/geo/service/GeoBrowser.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -635,8 +635,13 @@ public List<GeoRecord> getGeoRecordsBySearchTerm( String searchTerms, int start,
635635
log.error( "Could not parse data: " + searchUrl, e );
636636
}
637637

638-
if ( records.isEmpty() && rawRecords == 0 ) {
639-
GeoBrowser.log.warn( "No records obtained" );
638+
if ( records.isEmpty() && rawRecords != 0 ) {
639+
/*
640+
When there are raw records, all that happened is we filtered them all out.
641+
*/
642+
GeoBrowser.log.warn( "No records retained from query - all filtered out; number of raw records was " + rawRecords );
643+
} else if ( rawRecords == 0 ) {
644+
log.warn( "No records received at all" ); // could be the very beginning ...
640645
log.warn( "Query was " + searchUrl );
641646
log.warn( "Fetch was " + fetchUrl );
642647
} else {
@@ -888,7 +893,7 @@ private void getDetails( GeoRecord record ) {
888893
private void getMeshHeadings( GeoRecord record ) throws IOException {
889894
try {
890895
Collection<String> meshheadings = new ArrayList<>();
891-
List<String> idlist = Arrays.asList( record.getPubMedIds().split( "\\s+" ) );
896+
List<String> idlist = Arrays.asList( record.getPubMedIds().split( "[,\\s]+" ) );
892897
List<Integer> idints = new ArrayList<>();
893898
for ( String s : idlist ) {
894899
try {

gemma-core/src/main/java/ubic/gemma/persistence/service/AbstractDao.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
import java.io.Serializable;
3333
import java.util.Collection;
34+
import java.util.Collections;
3435
import java.util.List;
3536

3637
/**
@@ -81,6 +82,9 @@ public T create( T entity ) {
8182
@Override
8283
@Transactional(readOnly = true)
8384
public Collection<T> load( Collection<Long> ids ) {
85+
if ( ids.isEmpty() ) {
86+
return Collections.emptyList();
87+
}
8488
//noinspection unchecked
8589
return this.getSessionFactory().getCurrentSession()
8690
.createQuery( //language=none // Prevents unresolvable missing value warnings.

gemma-core/src/main/java/ubic/gemma/persistence/util/Settings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public class Settings {
122122
}
123123

124124
try {
125-
PropertiesConfiguration pc = ConfigUtils.loadClasspathConfig( "version.properties" );
125+
PropertiesConfiguration pc = ConfigUtils.loadClasspathConfig( "ubic/gemma/version.properties" );
126126

127127
Settings.config.addConfiguration( pc );
128128
} catch ( ConfigurationException e ) {

0 commit comments

Comments
 (0)