Skip to content

Commit

Permalink
Merge pull request #1 from enasequence/DCP-3954
Browse files Browse the repository at this point in the history
DCP-3954 : Uniprot support: Seq snapshot change tracking using liveli…
  • Loading branch information
suranjayathilaka authored Jan 23, 2024
2 parents 4b190fc + a434eb6 commit 01ad368
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
with:
arguments: build
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Make Gradlew Executable
run: chmod u+x gradlew
- name: Build with Gradle
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
with:
arguments: build
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {
}

group = 'uk.ac.ebi.ena.dcap'
version = '1.2.0'
version = '1.2.1'
sourceCompatibility = '1.8'

configurations {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/uk/ac/ebi/ena/dcap/scl/service/MainService.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class MainService {
final ExecutorService executorService = Executors.newFixedThreadPool(2);

@Autowired
PortalApiClient portalApiClient;
SnapshotClient snapshotClient;


public File writeLatestSnapshot(DataType dataType, File outputLocation, String fileName, String query) {
Expand All @@ -55,7 +55,7 @@ public File writeLatestSnapshot(DataType dataType, File outputLocation, String f
if (outFile.exists()) {
outFile.delete();
}
return portalApiClient.getLatestSnapshot(dataType, outFile, query);
return snapshotClient.getLatestSnapshot(dataType, outFile, query);
}

@SneakyThrows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,23 @@

@Component
@Slf4j
public class PortalApiClient {
public class SnapshotClient {

static final String URL = "https://www.ebi.ac.uk/ena/portal/api/search?result=%s&fields=accession," +
static final String PORTAL_API_URL = "https://www.ebi.ac.uk/ena/portal/api/search?result=%s&fields=accession," +
"last_updated";

static final String LIVELST_URL = "https://www.ebi.ac.uk/ena/browser/api/livelist/%s?fields=accession," +
"last_updated";

@SneakyThrows
public File getLatestSnapshot(DataType dataType, File outputFile, String query) {
String req = String.format(URL, dataType.name().toLowerCase());
String req;
if (StringUtils.isNotBlank(query)) {
req = String.format(PORTAL_API_URL, dataType.name().toLowerCase());
req += "&query=" + query;

} else {
req = String.format(LIVELST_URL, dataType.name().toLowerCase());
}
URL url = new URL(req);

Expand Down

0 comments on commit 01ad368

Please sign in to comment.