Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Minor updates to converter

  • Loading branch information...
commit b06bf491eb4f1ec81bfb713cee886a352057750d 1 parent 61ca0b7
@johnmay authored
Showing with 15 additions and 6 deletions.
  1. +15 −6 apps/io/src/main/java/uk/ac/ebi/mdk/apps/io/BioCycConverter.java
View
21 apps/io/src/main/java/uk/ac/ebi/mdk/apps/io/BioCycConverter.java
@@ -40,7 +40,6 @@
import java.util.regex.Pattern;
import static uk.ac.ebi.mdk.io.text.biocyc.attribute.CompoundAttribute.CHEMICAL_FORMULA;
-import static uk.ac.ebi.mdk.io.text.biocyc.attribute.CompoundAttribute.DBLINKS;
/**
* Converts a BioCyc project to MDK domain objects
@@ -233,9 +232,17 @@ public static Metabolite dat2Metabolite(AttributedEntry<Attribute, String> entry
m.addAnnotation(new MolecularFormula(mf));
}
- m.addAnnotations(getCrossReferences(entry.get(DBLINKS)));
+ m.addAnnotations(getCrossReferences(entry.get(CompoundAttribute.DBLINKS)));
+ // synonyms and systematic name
+ for (String synonym : entry.get(CompoundAttribute.SYNONYMS)) {
+ m.addAnnotation(new Synonym(clean(synonym)));
+ }
+ for (String synonym : entry.get(CompoundAttribute.SYSTEMATIC_NAME)) {
+ m.addAnnotation(new SystematicName(clean(synonym)));
+ }
+
return m;
}
@@ -261,10 +268,10 @@ public MetabolicReaction dat2Reaction(AttributedEntry<Attribute, String> entry)
// synonyms and systematic name
for (String synonym : entry.get(ReactionAttribute.SYNONYMS)) {
- rxn.addAnnotation(new Synonym(synonym));
+ rxn.addAnnotation(new Synonym(clean(synonym)));
}
for (String synonym : entry.get(ReactionAttribute.SYSTEMATIC_NAME)) {
- rxn.addAnnotation(new SystematicName(synonym));
+ rxn.addAnnotation(new SystematicName(clean(synonym)));
}
rxn.addAnnotations(getCrossReferences(entry.get(ReactionAttribute.DBLINKS)));
@@ -372,14 +379,16 @@ private static Annotation getCrossReference(String dblink) {
Matcher matcher = DB_LINK.matcher(dblink);
if (matcher.find()) {
- String resource = matcher.group(1);
- String accession = matcher.group(2);
+ String resource = matcher.group(1).trim();
+ String accession = matcher.group(2).trim();
IdentifierFactory ID_FACTORY = DefaultIdentifierFactory.getInstance();
if (ID_FACTORY.hasSynonym(resource)) {
return DefaultAnnotationFactory.getInstance().getCrossReference(
ID_FACTORY.ofSynonym(resource, accession));
+ } else {
+ System.err.println("No synonym found for resource " + resource);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.