Skip to content
Snippets Groups Projects
Commit 03dcdf99 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

small fixes for pdb annotator - class types modified

parent 22c56c05
No related branches found
No related tags found
No related merge requests found
package lcsb.mapviewer.annotation.services.annotators; package lcsb.mapviewer.annotation.services.annotators;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
...@@ -136,7 +137,7 @@ public class PdbAnnotator extends ElementAnnotator implements IExternalService { ...@@ -136,7 +137,7 @@ public class PdbAnnotator extends ElementAnnotator implements IExternalService {
for (MiriamData md : mds) { for (MiriamData md : mds) {
try { try {
Set<Structure> structures = (Set<Structure>)uniProtToPdb(md); Collection<Structure> structures = uniProtToPdb(md);
if (structures.size() == 0) { if (structures.size() == 0) {
logger.warn(elementUtils.getElementTag(bioEntity) + " No PDB mapping for UniProt ID: " + md.getResource()); logger.warn(elementUtils.getElementTag(bioEntity) + " No PDB mapping for UniProt ID: " + md.getResource());
} else { } else {
...@@ -159,7 +160,7 @@ public class PdbAnnotator extends ElementAnnotator implements IExternalService { ...@@ -159,7 +160,7 @@ public class PdbAnnotator extends ElementAnnotator implements IExternalService {
for (Structure s : structures) { for (Structure s : structures) {
s.setUniprot(ur); s.setUniprot(ur);
} }
ur.setStructures(structures); ur.addStructures(structures);
((Species)bioEntity).getUniprots().add(ur); ((Species)bioEntity).getUniprots().add(ur);
} }
} catch (WrongResponseCodeIOException exception) { } catch (WrongResponseCodeIOException exception) {
...@@ -259,7 +260,7 @@ public class PdbAnnotator extends ElementAnnotator implements IExternalService { ...@@ -259,7 +260,7 @@ public class PdbAnnotator extends ElementAnnotator implements IExternalService {
*/ */
public Collection<Structure> uniProtToPdb(MiriamData uniprot) throws IOException { public Collection<Structure> uniProtToPdb(MiriamData uniprot) throws IOException {
if (uniprot == null) { if (uniprot == null) {
return null; return new ArrayList<>();
} }
if (!MiriamType.UNIPROT.equals(uniprot.getDataType())) { if (!MiriamType.UNIPROT.equals(uniprot.getDataType())) {
...@@ -269,7 +270,7 @@ public class PdbAnnotator extends ElementAnnotator implements IExternalService { ...@@ -269,7 +270,7 @@ public class PdbAnnotator extends ElementAnnotator implements IExternalService {
String accessUrl = getPdbMappingUrl(uniprot.getResource()); String accessUrl = getPdbMappingUrl(uniprot.getResource());
String json = getWebPageContent(accessUrl); String json = getWebPageContent(accessUrl);
return isJson(json) ? processMappingData(json) : null; return isJson(json) ? processMappingData(json) : new ArrayList<>();
} }
@Override @Override
......
package lcsb.mapviewer.model.map.species.field; package lcsb.mapviewer.model.map.species.field;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
...@@ -178,4 +179,8 @@ public class UniprotRecord implements Serializable { ...@@ -178,4 +179,8 @@ public class UniprotRecord implements Serializable {
public Set<Structure> getStructures() { public Set<Structure> getStructures() {
return structures; return structures;
} }
public void addStructures(Collection<Structure> structures) {
this.structures.addAll(structures);
}
} }
DELETE FROM cache_type WHERE classname = 'lcsb.mapviewer.annotation.services.annotators.PdbAnnotator' DELETE FROM cache_type WHERE classname = 'lcsb.mapviewer.annotation.services.annotators.PdbAnnotator';
INSERT INTO cache_type(validity, classname) VALUES (365, 'lcsb.mapviewer.annotation.services.annotators.PdbAnnotator') INSERT INTO cache_type(validity, classname) VALUES (365, 'lcsb.mapviewer.annotation.services.annotators.PdbAnnotator');
\ No newline at end of file \ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment