Skip to content

Commit

Permalink
Merge pull request #92 from MICommunity/develop
Browse files Browse the repository at this point in the history
Develop > Master
  • Loading branch information
jmedinaebi authored Sep 27, 2024
2 parents c621f90 + f92762f commit 22b8767
Show file tree
Hide file tree
Showing 46 changed files with 728 additions and 419 deletions.
2 changes: 1 addition & 1 deletion jami-batch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>psidev.psi.mi.jami</groupId>
<artifactId>psi-jami</artifactId>
<version>3.5.1-SNAPSHOT</version>
<version>3.6.0</version>
</parent>

<artifactId>jami-batch</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jami-bridges/bridges-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>psidev.psi.mi.jami.bridges</groupId>
<artifactId>jami-bridges</artifactId>
<version>3.5.1-SNAPSHOT</version>
<version>3.6.0</version>
</parent>

<artifactId>bridges-core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jami-bridges/jami-chebi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>psidev.psi.mi.jami.bridges</groupId>
<artifactId>jami-bridges</artifactId>
<version>3.5.1-SNAPSHOT</version>
<version>3.6.0</version>
</parent>

<artifactId>jami-chebi</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jami-bridges/jami-ensembl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>psidev.psi.mi.jami.bridges</groupId>
<artifactId>jami-bridges</artifactId>
<version>3.5.1-SNAPSHOT</version>
<version>3.6.0</version>
</parent>

<artifactId>jami-ensembl</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,7 @@ public abstract class AbstractEnsemblFetcher<T extends Interactor> implements In

private final CachedOlsOntologyTermFetcher ontologyFetcher = new CachedOlsOntologyTermFetcher();

private final Map<String, CvTerm> biotypeToCVId = new HashMap<>(Map.of(
"protein_coding", this.getCVByMIId("MI:0324"), // mRNA
"protein_coding_CDS_not_defined", this.getCVByMIId("MI:2190"), // lncRNA
"lncRNA", this.getCVByMIId("MI:2190"), // lncRNA
"miRNA", this.getCVByMIId("MI:2204"), // miRNA
"snRNA", this.getCVByMIId("MI:0607") // snRNA
));
private final Map<String, CvTerm> biotypeToCVId = this.buildInitialBioTypeMap();

private final Map<String, String> biotypeToShortestType = new HashMap<>();

Expand Down Expand Up @@ -230,6 +224,16 @@ private String extractPureIdentifier(String id) {
return id.split("\\.")[0];
}

private Map<String, CvTerm> buildInitialBioTypeMap() {
Map<String, CvTerm> map = new HashMap<>();
map.computeIfAbsent("protein_coding", k -> this.getCVByMIId("MI:0324")); // mRNA
map.computeIfAbsent("protein_coding_CDS_not_defined", k -> this.getCVByMIId("MI:2190")); // lncRNA
map.computeIfAbsent("lncRNA", k -> this.getCVByMIId("MI:2190")); // lncRNA
map.computeIfAbsent("miRNA", k -> this.getCVByMIId("MI:2204")); // miRNA
map.computeIfAbsent("snRNA", k -> this.getCVByMIId("MI:0607")); // snRNA
return map;
}

private CvTerm getCVByMIId(String id) {
if (id == null) return null;
try {
Expand Down
4 changes: 2 additions & 2 deletions jami-bridges/jami-europubmedcentral/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>jami-bridges</artifactId>
<groupId>psidev.psi.mi.jami.bridges</groupId>
<version>3.5.1-SNAPSHOT</version>
<version>3.6.0</version>
</parent>

<artifactId>jami-europubmedcentral</artifactId>
Expand Down Expand Up @@ -36,7 +36,7 @@
<plugin>
<groupId>com.helger.maven</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.6</version>
<version>2.6.2</version>
<executions>
<execution>
<id>wsimport-from-jdk</id>
Expand Down
4 changes: 2 additions & 2 deletions jami-bridges/jami-imexcentral/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>psidev.psi.mi.jami.bridges</groupId>
<artifactId>jami-bridges</artifactId>
<version>3.5.1-SNAPSHOT</version>
<version>3.6.0</version>
</parent>

<artifactId>jami-imexcentral</artifactId>
Expand All @@ -16,7 +16,7 @@
<plugin>
<groupId>com.helger.maven</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.6</version>
<version>2.6.2</version>
<executions>
<execution>
<goals>
Expand Down
2 changes: 1 addition & 1 deletion jami-bridges/jami-obo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>psidev.psi.mi.jami.bridges</groupId>
<artifactId>jami-bridges</artifactId>
<version>3.5.1-SNAPSHOT</version>
<version>3.6.0</version>
</parent>

<artifactId>jami-obo</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jami-bridges/jami-ols/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>psidev.psi.mi.jami.bridges</groupId>
<artifactId>jami-bridges</artifactId>
<version>3.5.1-SNAPSHOT</version>
<version>3.6.0</version>
</parent>

<artifactId>jami-ols</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jami-bridges/jami-ontology-manager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>psidev.psi.mi.jami.bridges</groupId>
<artifactId>jami-bridges</artifactId>
<version>3.5.1-SNAPSHOT</version>
<version>3.6.0</version>
</parent>

<artifactId>jami-ontology-manager</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jami-bridges/jami-rna-central/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>psidev.psi.mi.jami.bridges</groupId>
<artifactId>jami-bridges</artifactId>
<version>3.5.1-SNAPSHOT</version>
<version>3.6.0</version>
</parent>

<artifactId>jami-rna-central</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static class Result {
private String gencodeTranscriptId;
private URL gencodeEnsemblUrl;

private List<URL> quickgoHits;
private Integer quickgoHits;

@Jacksonized
@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public Collection<NucleicAcid> fetchByIdentifier(String identifier, int taxID) t
nucleicAcid.setSequence(entree.getSequence());
nucleicAcid.setFullName(entree.getDescription());
addXRefs(nucleicAcid, pureIdentifier, organism);
if (type == OLSUtils.rnaCV) nucleicAcid.getAnnotations().add(new DefaultAnnotation(OLSUtils.getCVByName("comment"), "RNA-Central type: " + entree.getRnaType()));
if (type == OLSUtils.rnaCV)
nucleicAcid.getAnnotations().add(new DefaultAnnotation(OLSUtils.getCVByName("comment"), "RNA-Central type: " + entree.getRnaType()));

return List.of(nucleicAcid);
} else return List.of();
Expand All @@ -73,14 +74,19 @@ public Collection<NucleicAcid> fetchByIdentifier(String identifier, int taxID) t
private void addXRefs(NucleicAcid nucleicAcid, String pureIdentifier, Organism organism) {
try {
URL url = new URL(String.format(XREFS_URL, pureIdentifier));
int count = 0;
int targetCount;

while (url != null) {
do {
ApiXrefs xrefs = OLSUtils.mapper.readValue(url, ApiXrefs.class);
targetCount = xrefs.getCount();
count += xrefs.getResults().size();
url = xrefs.getNext() != null ? new URL(xrefs.getNext().toString().replace("http", "https")) : null;
xrefs.getResults().stream()
.filter(result -> result.getAccession().getSpecies().equals(organism.getScientificName()) || result.getTaxid().equals(organism.getTaxId()))
.filter(result -> result.getTaxid().equals(organism.getTaxId()) ||
(result.getAccession().getSpecies() != null && result.getAccession().getSpecies().equals(organism.getScientificName())))
.forEach(result -> this.extractXrefsAndAliases(nucleicAcid, result));
}
} while (count < targetCount);

} catch (IOException e) {
throw new RuntimeException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ public void testPDBeXref() throws BridgeFailedException {
NucleicAcid acid = nucleicAcids.iterator().next();
assertEquals("transfer rna", acid.getInteractorType().getFullName());
List<Xref> xrefs = acid.getXrefs().stream().filter(xref -> xref.getDatabase().getShortName().equals("pdbe")).collect(Collectors.toList());
assertFalse(xrefs.isEmpty());
assertTrue(xrefs.isEmpty());
List<Xref> identifiers = acid.getIdentifiers().stream().filter(xref -> xref.getDatabase().getShortName().equals("pdbe")).collect(Collectors.toList());
assertFalse(identifiers.isEmpty());
assertTrue("URS0002311975_9606 should have a PDB Xref to 7ONU",
xrefs.stream().anyMatch(xref -> xref.getId().equals("7ONU")));
identifiers.stream().anyMatch(xref -> xref.getId().equals("7ONU")));
}


Expand All @@ -70,36 +72,38 @@ public void testEnsemblXref() throws BridgeFailedException {
// Side tests

assertTrue("URS0000031E12_9606 should have a RefSeq Xref to NR_029480",
acid.getXrefs().stream().anyMatch(x -> x.getId().equals("NR_029480")));
acid.getIdentifiers().stream().anyMatch(x -> x.getId().equals("NR_029480")));

assertTrue("URS0000031E12_9606 should have a miRBase Xref to MI0000064",
acid.getXrefs().stream().anyMatch(x -> x.getId().equals("MI0000064")));
acid.getIdentifiers().stream().anyMatch(x -> x.getId().equals("MI0000064")));

assertTrue("All xrefs should have a qualifier",
acid.getXrefs().stream().allMatch(xref -> xref.getQualifier() != null));
acid.getIdentifiers().stream().allMatch(xref -> xref.getQualifier() != null));
}

@Test
public void testRefSeqXref() throws BridgeFailedException {
// https://rnacentral.org/api/v1/rna/URS000075C808_9606.json
// https://rnacentral.org/api/v1/rna/URS000075C808/xrefs.json
Collection<NucleicAcid> nucleicAcids = fetcher.fetchByIdentifier("URS000075C808_9606");
// https://rnacentral.org/api/v1/rna/URS00026A23F2_9606.json
// https://rnacentral.org/api/v1/rna/URS00026A23F2/xrefs.json
Collection<NucleicAcid> nucleicAcids = fetcher.fetchByIdentifier("URS00026A23F2_9606");
NucleicAcid acid = nucleicAcids.iterator().next();
List<Xref> xrefs = acid.getXrefs().stream().filter(xref -> xref.getDatabase().getShortName().equals("refseq")).collect(Collectors.toList());
assertFalse(xrefs.isEmpty());
assertTrue("URS000075C808_9606 should have a RefSeq Xref to NR_003716",
xrefs.stream().anyMatch(xref -> xref.getId().equals("NR_003716")));
assertTrue(xrefs.isEmpty());
List<Xref> identifiers = acid.getIdentifiers().stream().filter(xref -> xref.getDatabase().getShortName().equals("refseq")).collect(Collectors.toList());
assertFalse(identifiers.isEmpty());
assertTrue("URS00026A23F2_9606 should have a RefSeq Xref to NR_003716",
identifiers.stream().anyMatch(xref -> xref.getId().equals("NR_003716")));
}

@Test
public void testGeneNameAlias() throws BridgeFailedException {
// https://rnacentral.org/api/v1/rna/URS000075C808_9606.json
// https://rnacentral.org/api/v1/rna/URS000075C808/xrefs.json
Collection<NucleicAcid> nucleicAcids = fetcher.fetchByIdentifier("URS000075C808_9606");
// https://rnacentral.org/api/v1/rna/URS00026A23F2_9606.json
// https://rnacentral.org/api/v1/rna/URS00026A23F2/xrefs.json
Collection<NucleicAcid> nucleicAcids = fetcher.fetchByIdentifier("URS00026A23F2_9606");
NucleicAcid acid = nucleicAcids.iterator().next();
List<Alias> aliases = acid.getAliases().stream().filter(alias -> alias.getType().getShortName().equals("gene name")).collect(Collectors.toList());
assertEquals("URS000075C808_9606 should only have one Gene Name alias", 1, aliases.size());
assertTrue("URS000075C808_9606 gene name should be HOTAIR",
assertEquals("URS00026A23F2_9606 should only have one Gene Name alias", 1, aliases.size());
assertTrue("URS00026A23F2_9606 gene name should be HOTAIR",
aliases.stream().anyMatch(alias -> alias.getName().equals("HOTAIR")));
}
}
2 changes: 1 addition & 1 deletion jami-bridges/jami-uniprot-protein-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>psidev.psi.mi.jami.bridges</groupId>
<artifactId>jami-bridges</artifactId>
<version>3.5.1-SNAPSHOT</version>
<version>3.6.0</version>
</parent>

<artifactId>jami-uniprot-protein-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void getTremblIdsForAccession() throws UniprotProteinAPIClientException {
for (String upi : upis) {
System.out.println(upi);
}
Assert.assertEquals(8, upis.size());
Assert.assertEquals(3, upis.size());

}

Expand Down Expand Up @@ -128,7 +128,7 @@ public void getTremblIdsForSequence() throws UniprotProteinAPIClientException {
for (String upi : upis) {
System.out.println(upi);
}
Assert.assertEquals(8, upis.size());
Assert.assertEquals(3, upis.size());

}

Expand All @@ -152,7 +152,7 @@ public void getUPEntriesForSequence() throws UniprotProteinAPIClientException {
System.out.println(upi.getAccession());
Assert.assertNotNull(upi);
Assert.assertEquals("UPI000003EADC", upi.getAccession());
Assert.assertEquals(12, upi.getDbReference().size());
Assert.assertEquals(7, upi.getDbReference().size());

}

Expand Down
2 changes: 1 addition & 1 deletion jami-bridges/jami-uniprot-taxonomy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>psidev.psi.mi.jami.bridges</groupId>
<artifactId>jami-bridges</artifactId>
<version>3.5.1-SNAPSHOT</version>
<version>3.6.0</version>
</parent>

<artifactId>jami-uniprot-taxonomy</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jami-bridges/jami-uniprot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>psidev.psi.mi.jami.bridges</groupId>
<artifactId>jami-bridges</artifactId>
<version>3.5.1-SNAPSHOT</version>
<version>3.6.0</version>
</parent>

<artifactId>jami-uniprot</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jami-bridges/jami-unisave/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>psidev.psi.mi.jami.bridges</groupId>
<artifactId>jami-bridges</artifactId>
<version>3.5.1-SNAPSHOT</version>
<version>3.6.0</version>
</parent>

<artifactId>jami-unisave</artifactId>
Expand Down
Loading

0 comments on commit 22b8767

Please sign in to comment.