// Path: src/main/java/ch/picard/ppimapbuilder/data/ontology/GeneOntologyTerm.java
// public class GeneOntologyTerm extends OntologyTerm implements JSONable, Serializable {
// 
// 	private static final long serialVersionUID = 1L;
// 
// 	private final String term;
// 	private final GeneOntologyCategory category;
// 	public static final int TERM_LENGTH = 10;
// 
// 	public GeneOntologyTerm(String identifier) {
// 		this(identifier, "", null);
// 	}
// 
// 	public GeneOntologyTerm(String identifier, String term, char category) {
// 		this(identifier, term, GeneOntologyCategory.getByLetter(category));
// 	}
// 
// 	public GeneOntologyTerm(String identifier, String term, GeneOntologyCategory category) {
// 		super(identifier);
// 		this.term = term;
// 		this.category = category;
// 	}
// 
// 	public String getTerm() {
// 		return term;
// 	}
// 
// 	public GeneOntologyCategory getCategory() {
// 		return category;
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return getIdentifier();
// 	}
// 
// 	@Override
// 	public String toJSON() {
// 		JsonObject out = new JsonObject();
// 		out.add("id", getIdentifier());
// 		out.add("term", term);
// 		return out.toString();
// 	}
// }


import ch.picard.ppimapbuilder.data.ontology.GeneOntologyTerm;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
		try {
			reader = new BufferedReader(new InputStreamReader(inputStream));

			String line;
			boolean inTerm = false;
			String identifier = null;
			String term = null;
			Character category = null;
			while((line = reader.readLine()) != null) {
				if(line.contains("[Term]")) {
					inTerm = true;
					identifier = term = null;
					category = null;
				}
				else if(inTerm && line.startsWith("id:")) {
					String id = line.replace("id: ", "");
					identifier = id.startsWith("GO") ? id : null;
				}
				else if(line.startsWith("name:") && identifier != null) {
					term = line.replace("name: ", "");
				}
				else if(line.startsWith("namespace:") && term != null) {
					String namespace = line.replace("namespace: ", "");
					if(namespace.equals("biological_process"))
						category = 'P';
					else if(namespace.equals("molecular_function"))
						category = 'F';
					else if(namespace.equals("cellular_component"))
						category = 'C';

// Path: src/main/java/ch/picard/ppimapbuilder/data/ontology/GeneOntologyTerm.java
// public class GeneOntologyTerm extends OntologyTerm implements JSONable, Serializable {
// 
// 	private static final long serialVersionUID = 1L;
// 
// 	private final String term;
// 	private final GeneOntologyCategory category;
// 	public static final int TERM_LENGTH = 10;
// 
// 	public GeneOntologyTerm(String identifier) {
// 		this(identifier, "", null);
// 	}
// 
// 	public GeneOntologyTerm(String identifier, String term, char category) {
// 		this(identifier, term, GeneOntologyCategory.getByLetter(category));
// 	}
// 
// 	public GeneOntologyTerm(String identifier, String term, GeneOntologyCategory category) {
// 		super(identifier);
// 		this.term = term;
// 		this.category = category;
// 	}
// 
// 	public String getTerm() {
// 		return term;
// 	}
// 
// 	public GeneOntologyCategory getCategory() {
// 		return category;
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return getIdentifier();
// 	}
// 
// 	@Override
// 	public String toJSON() {
// 		JsonObject out = new JsonObject();
// 		out.add("id", getIdentifier());
// 		out.add("term", term);
// 		return out.toString();
// 	}
// }


// Path: src/main/java/ch/picard/ppimapbuilder/data/ontology/goslim/GOSlimOBOParser.java
import ch.picard.ppimapbuilder.data.ontology.GeneOntologyTerm;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

		try {
			reader = new BufferedReader(new InputStreamReader(inputStream));

			String line;
			boolean inTerm = false;
			String identifier = null;
			String term = null;
			Character category = null;
			while((line = reader.readLine()) != null) {
				if(line.contains("[Term]")) {
					inTerm = true;
					identifier = term = null;
					category = null;
				}
				else if(inTerm && line.startsWith("id:")) {
					String id = line.replace("id: ", "");
					identifier = id.startsWith("GO") ? id : null;
				}
				else if(line.startsWith("name:") && identifier != null) {
					term = line.replace("name: ", "");
				}
				else if(line.startsWith("namespace:") && term != null) {
					String namespace = line.replace("namespace: ", "");
					if(namespace.equals("biological_process"))
						category = 'P';
					else if(namespace.equals("molecular_function"))
						category = 'F';
					else if(namespace.equals("cellular_component"))
						category = 'C';

					set.add(new GeneOntologyTerm(identifier, term, category));