Skip to content

Commit

Permalink
Handle unknown external ID in interpro2ipr files.
Browse files Browse the repository at this point in the history
Since we're not in control of the external datasources that are used by
datasource providers, validating all external IDs makes our code
brittle.  Since we don't use sources that we don't know about, we can
simply gloss over the external IDs that we don't recognise.

Doing so yields triples of the form:

<http://kabob.ucdenver.edu/iao/interpro/F_InterProProtein2IprDatFileData_externalReference_J7eGDFPyhBVMdgpi5AN9XzD1tu8> <http://purl.obolibrary.org/obo/IAO_0000219> <http://kabob.ucdenver.edu/iao/kabob/R_NonNormalizedIdentifierRecord_fM4tG2mEQK7AzC4Z0DKJDbkbNGU> .
<http://kabob.ucdenver.edu/iao/kabob/R_NonNormalizedIdentifierRecord_fM4tG2mEQK7AzC4Z0DKJDbkbNGU> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://kabob.ucdenver.edu/iao/kabob/NonNormalizedIdentifierRecord> .
<http://kabob.ucdenver.edu/iao/kabob/R_NonNormalizedIdentifierRecord_fM4tG2mEQK7AzC4Z0DKJDbkbNGU> <http://kabob.ucdenver.edu/iao/hasTemplate> <http://kabob.ucdenver.edu/iao/kabob/NonNormalizedIdentifierRecordSchema1> .
<http://kabob.ucdenver.edu/iao/kabob/R_NonNormalizedIdentifierRecord_fM4tG2mEQK7AzC4Z0DKJDbkbNGU> <http://purl.obolibrary.org/obo/BFO_0000051> <http://kabob.ucdenver.edu/iao/kabob/F_NonNormalizedIdentifierRecord_identifier_fM4tG2mEQK7AzC4Z0DKJDbkbNGU> .
<http://kabob.ucdenver.edu/iao/kabob/F_NonNormalizedIdentifierRecord_identifier_fM4tG2mEQK7AzC4Z0DKJDbkbNGU> <http://kabob.ucdenver.edu/iao/hasTemplate> <http://kabob.ucdenver.edu/iao/kabob/NonNormalizedIdentifierRecord_identifierDataField1> .
<http://kabob.ucdenver.edu/iao/kabob/F_NonNormalizedIdentifierRecord_identifier_fM4tG2mEQK7AzC4Z0DKJDbkbNGU> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://kabob.ucdenver.edu/iao/FieldValue> .
<http://kabob.ucdenver.edu/iao/kabob/F_NonNormalizedIdentifierRecord_identifier_fM4tG2mEQK7AzC4Z0DKJDbkbNGU> <http://purl.obolibrary.org/obo/IAO_0000219> "cd01991"@en .
  • Loading branch information
sinistral committed Jul 19, 2016
1 parent 7de3735 commit b96d601
Show file tree
Hide file tree
Showing 11 changed files with 375 additions and 156 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
*/

import edu.ucdenver.ccp.datasource.identifiers.DataSourceIdentifier;
import edu.ucdenver.ccp.datasource.identifiers.UnknownDataSourceIdentifier;
import edu.ucdenver.ccp.datasource.identifiers.ebi.interpro.Gene3dID;
import edu.ucdenver.ccp.datasource.identifiers.ebi.interpro.HamapAnnotationRuleID;
import edu.ucdenver.ccp.datasource.identifiers.ebi.interpro.PantherID;
Expand Down Expand Up @@ -63,7 +64,9 @@ public class InterProExternalReferenceFactory {
private static final String PRODOM_PREFIX = "PD";


public static DataSourceIdentifier<String> parseExternalReference(String databaseReferenceID) {
public static DataSourceIdentifier<String> parseExternalReference(
String databaseReferenceID)
{
if (databaseReferenceID.startsWith(PFAM_PREFIX))
return new PfamID(databaseReferenceID);
if (databaseReferenceID.startsWith(TIGRFAMS_PREFIX))
Expand All @@ -87,9 +90,9 @@ public static DataSourceIdentifier<String> parseExternalReference(String databas
if (databaseReferenceID.startsWith(HAMAP_PREFIX))
return new HamapAnnotationRuleID(databaseReferenceID);
if (databaseReferenceID.startsWith(PRODOM_PREFIX))
return new ProDomID(databaseReferenceID);
throw new IllegalArgumentException(String.format("Unknown external database ID type for ID: %s",
databaseReferenceID));
return new ProDomID(databaseReferenceID);

return new UnknownDataSourceIdentifier(databaseReferenceID);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ private DataSourceIdentifier<?> resolveSpecialistId(String idStr, String link) {
return new SlcId(idStr);
}

return new UnknownDataSourceIdentifier(idStr, null);
return new UnknownDataSourceIdentifier(idStr);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ private Set<DataSourceIdentifier<?>> resolveInteractionDbIds(String interactionI
} else if (id.startsWith("HPRD")) {
ids.add(new HprdID(StringUtil.removePrefix(id, "HPRD:")));
} else {
ids.add(new UnknownDataSourceIdentifier(id, null));
ids.add(new UnknownDataSourceIdentifier(id));
}
} catch (IllegalArgumentException e) {
ids.add(new ProbableErrorDataSourceIdentifier(id, null, e.getMessage()));
Expand All @@ -360,10 +360,10 @@ private DataSourceIdentifier<?> resolveInteractorId(String idStr) {
return null;
}
if (idStr.startsWith("xx:")) {
return new UnknownDataSourceIdentifier(idStr, null);
return new UnknownDataSourceIdentifier(idStr);
}
if (idStr.startsWith("other:")) {
return new UnknownDataSourceIdentifier(idStr, null);
return new UnknownDataSourceIdentifier(idStr);
}
if (idStr.equals("null")) {
return null;
Expand Down Expand Up @@ -486,7 +486,7 @@ private DataSourceIdentifier<?> resolveInteractorId(String idStr) {
return new ProbableErrorDataSourceIdentifier(idStr, null, e.getMessage());
}

return new UnknownDataSourceIdentifier(idStr, null);
return new UnknownDataSourceIdentifier(idStr);
}

/**
Expand Down Expand Up @@ -683,7 +683,7 @@ private DataSourceIdentifier<?> resolveAliasId(String aliasStr) {
} else if (aliasStr.startsWith("hgnc:")) {
return new HgncGeneSymbolID(StringUtil.removePrefix(aliasStr, "hgnc:"));
}
return new UnknownDataSourceIdentifier(aliasStr, null);
return new UnknownDataSourceIdentifier(aliasStr);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ private DataSourceIdentifier<?> resolveCrossRefId(String refStr) {
} else if (refStr.startsWith(URL_PREFIX)) {
return new CrossReferenceUrl(StringUtil.removePrefix(refStr, URL_PREFIX));
} else {
return new UnknownDataSourceIdentifier(refStr, null);
return new UnknownDataSourceIdentifier(refStr);
}
} catch (IllegalArgumentException e) {
return new ProbableErrorDataSourceIdentifier(refStr, null, e.getMessage());
Expand Down
Loading

0 comments on commit b96d601

Please sign in to comment.