Hello all,

I have a list of GO terms and I would like to create the corresponding network.  Even better, I would like to be able to create the *entire* GO metabolic network and then highlight my terms in that network.

I have two challenges: I am studying Microbiome, which is largely unknown/predicted genes, so I have derived GO terms from blastX homology hits / Blast2GO.  So this means (1) I do not have a specific organism to select, (2) I do not have gene names, and (3) I have only GO terms.

Now Cytoscape has many wonderful GO enrichment tools, and I was advised to use these by my colleagues.  

But I can't seem to find **a method to create a Network from GO terms or import the full GO network**.
This is how I accomplished the task of making the GO network in Cytoscape.

1) Download go.obo from http://geneontology.org/page/download-ontology
2) Run my python script to convert go.obo to GO.cytoscape.sif file
3) Cytoscape -> Import -> Network -> File, select the GO.cytoscape.sif file

PRESTO, the full network is loaded!

*As far as my goal not being clear, yes my end game is exactly to do a comparison / enrichment analysis.*  But the network needed to exist before I could do that.  I honestly don't know the next step at this juncture... still learning.  Next step will be to create sub-graphs representing new input file GO terms (for multiple treatments), and then compare them.

    import re

	if __name__ == "__main__":

		inputOBO = "E:/go.obo"
		outputSIF = "E:/GO.cytoscape.sif"

		outF = open(outputSIF, "w")


		newTerm = False
		GOvalue = "initilize"
		isAfound = False

		for line in open(inputOBO, "r"):
			if newTerm: #expect id: value line
				GOvalue = line[4:-1]
				newTerm = False
				isAfound = False

			if line == "[Term]\n":
				newTerm = True
			if line == "[Typedef]\n":
				break   #read all the nodes, don't need type defs
			if line == "\n":    #end of entry
				isAfound = False
			elif re.search("^is_a:",line) != None:
				isAfound = True

			if isAfound:
				splits = line.split()
				outLine="\n"
				if splits[0] == "relationship:":  
					outLine = GOvalue + "\t" + splits[1] + "\t" + splits[2] + "\n"
					outF.write( outLine )
				elif splits[0] == "intersection_of:" or splits[0][:5] == "creat":
					#do nothing, don't use
					outLine=outLine
				else:
					outLine = GOvalue + "\t" + splits[0] + "\t" + splits[1] + "\n"
					outF.write( outLine )