diff --git a/src/main/java/uk/ac/ebi/eva/evaseqcol/controller/admin/AdminController.java b/src/main/java/uk/ac/ebi/eva/evaseqcol/controller/admin/AdminController.java index 0db058f..94cff87 100644 --- a/src/main/java/uk/ac/ebi/eva/evaseqcol/controller/admin/AdminController.java +++ b/src/main/java/uk/ac/ebi/eva/evaseqcol/controller/admin/AdminController.java @@ -64,6 +64,7 @@ public ResponseEntity fetchAndInsertSeqColByAssemblyAccession( return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST); } catch (IOException e) { + e.printStackTrace(); return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); } catch (DuplicateSeqColException e) { return new ResponseEntity<>(e.getMessage(), HttpStatus.CONFLICT); diff --git a/src/main/java/uk/ac/ebi/eva/evaseqcol/datasource/NCBIAssemblySequenceDataSource.java b/src/main/java/uk/ac/ebi/eva/evaseqcol/datasource/NCBIAssemblySequenceDataSource.java index f46a86f..53c3eeb 100644 --- a/src/main/java/uk/ac/ebi/eva/evaseqcol/datasource/NCBIAssemblySequenceDataSource.java +++ b/src/main/java/uk/ac/ebi/eva/evaseqcol/datasource/NCBIAssemblySequenceDataSource.java @@ -71,6 +71,7 @@ public Optional getAssemblySequencesByAccession(String a Files.deleteIfExists(downloadFilePath.get()); Files.deleteIfExists(compressedFilePath.get()); // Deleting the fasta file } catch (IOException e) { + //e.printStackTrace(); // We might want to uncomment this when debugging logger.warn("Error while trying to disconnect - ncbiBrowser (assembly: " + accession + ")"); } } diff --git a/src/main/java/uk/ac/ebi/eva/evaseqcol/datasource/NCBISeqColDataSource.java b/src/main/java/uk/ac/ebi/eva/evaseqcol/datasource/NCBISeqColDataSource.java index b49ffa3..969505a 100644 --- a/src/main/java/uk/ac/ebi/eva/evaseqcol/datasource/NCBISeqColDataSource.java +++ b/src/main/java/uk/ac/ebi/eva/evaseqcol/datasource/NCBISeqColDataSource.java @@ -64,6 +64,7 @@ public Optional>> getAllPossibleSeqCo logger.error("Could not fetch Sequences FASTA file from NCBI for assembly accession: " + accession); return Optional.empty(); } + logger.info("Assembly report and FASTA file have been fetched and parsed successfully"); seqColResultData.put( "sameValueAttributes", SeqColExtendedDataEntity.constructSameValueExtendedSeqColData(assemblyEntity.get(), sequenceEntity.get())); diff --git a/src/main/java/uk/ac/ebi/eva/evaseqcol/dus/PassiveAnonymousFTPClient.java b/src/main/java/uk/ac/ebi/eva/evaseqcol/dus/PassiveAnonymousFTPClient.java index 6c89105..d8c9649 100644 --- a/src/main/java/uk/ac/ebi/eva/evaseqcol/dus/PassiveAnonymousFTPClient.java +++ b/src/main/java/uk/ac/ebi/eva/evaseqcol/dus/PassiveAnonymousFTPClient.java @@ -81,6 +81,7 @@ public boolean downloadFTPFile(String ftpFilePath, Path downloadFilePath, long f super.setFileTransferMode(FTP.BINARY_FILE_TYPE); Files.deleteIfExists(downloadFilePath); + logger.info("Downloading file " + ftpFilePath + " in progress..."); boolean success = super.retrieveFile(ftpFilePath, new FileOutputStream(downloadFilePath.toFile())); if (success && Files.exists(downloadFilePath) && Files.isReadable(downloadFilePath)) { diff --git a/src/main/java/uk/ac/ebi/eva/evaseqcol/service/SeqColService.java b/src/main/java/uk/ac/ebi/eva/evaseqcol/service/SeqColService.java index ece1789..dd69454 100644 --- a/src/main/java/uk/ac/ebi/eva/evaseqcol/service/SeqColService.java +++ b/src/main/java/uk/ac/ebi/eva/evaseqcol/service/SeqColService.java @@ -367,13 +367,20 @@ private boolean onlyDigits(String str) { return m.matches(); } + /** + * Check whether the given list contains only digits (in a form of strings)*/ + private boolean onlyDigitsStringList(List list) { + return list.isEmpty() || list.stream() + .allMatch(this::onlyDigits); + } + /** * Return a normalized string representation of the given seqColL2Attribute * Note: This is the same method as the toString of the JSONExtData class*/ private String convertSeqColLevelTwoAttributeValuesToString(List seqColL2Attribute) { StringBuilder objectStr = new StringBuilder(); objectStr.append("["); - if (onlyDigits(seqColL2Attribute.get(0).toString())) { // Lengths array, No quotes "...". Eg: [1111, 222, 333] + if (onlyDigitsStringList(seqColL2Attribute)) { // Lengths array, No quotes "...". Eg: [1111, 222, 333] for (int i=0; i list) { + return list.isEmpty() || list.stream() + .allMatch(this::onlyDigits); + } + @Override public String toString() { StringBuilder objectStr = new StringBuilder(); objectStr.append("["); - if (onlyDigits(object.get(0).toString())) { // Lengths array, No quotes "...". Eg: [1111, 222, 333] + if (onlyDigitsStringList(object)) { // Lengths array, No quotes "...". Eg: [1111, 222, 333] for (int i=0; i