1 package uk.ac.ebi.intenz.biopax.level2;
2
3 import java.io.IOException;
4 import java.io.OutputStream;
5 import java.lang.reflect.InvocationTargetException;
6 import java.util.Collection;
7 import org.apache.log4j.Logger;
8 import org.biopax.paxtools.model.Model;
9 import uk.ac.ebi.intenz.domain.enzyme.EnzymeEntry;
10
11
12
13
14
15 public class Biopax extends uk.ac.ebi.rhea.biopax.level2.Biopax {
16
17 private static final Logger LOGGER = Logger.getLogger(Biopax.class);
18
19 public static final String INTENZ_PREFIX = "intenz";
20 public static final String INTENZ_NS = "http://www.ebi.ac.uk/intenz/#";
21
22
23
24
25
26
27 public static Model createModel(){
28 Model biopaxModel = uk.ac.ebi.rhea.biopax.level2.Biopax.createModel();
29 biopaxModel.setXmlBase(INTENZ_NS);
30 biopaxModel.getNameSpacePrefixMap().put("", INTENZ_NS);
31 biopaxModel.getNameSpacePrefixMap().put(INTENZ_PREFIX, INTENZ_NS);
32 return biopaxModel;
33 }
34
35
36
37
38
39
40
41
42
43 public static void write(Collection<EnzymeEntry> enzymes, OutputStream os)
44 throws IOException, IllegalAccessException, InvocationTargetException {
45 Model model = Biopax.createModel();
46 for (EnzymeEntry entry : enzymes) {
47 try {
48 new BiopaxCatalysis(entry, model);
49 LOGGER.info("Added to BioPAX model - EC " + entry.getEc());
50 } catch(Exception e){
51 LOGGER.error("Unable to convert to BioPAX - EC " + entry.getEc(), e);
52 }
53 }
54 write(model, os);
55 }
56 }