Start is intended to use protein GI number to get their go term. Originally wanted to use UniProt to solve, but want to need to convert ID, which will lead to some ID corresponding abnormal, one is missing, but a pair of more, or more to one. The data has to be re-organized at least once.
Then I thought of David, manually submitting the data, and if more than one species, he did not let the overall analysis, can not take all the results at once, and then need to re-parse again. Sent to ask them, they also first turn ID to deal with.
Later saw the David Web service, with this different directly, the only disadvantage is that the result of the direct generation into the text saved, bad parsing.
So I saved it again with JSON.
ImportSyssys.path.append ('.. /')ImportLoggingImportTraceback as TBImportSuds.metrics as Metrics fromTestsImport* fromSudsImport* fromSuds.clientImportClient fromDatetimeImportdatetimeerrors=0setup_logging () Logging.getlogger ('suds.client'). SetLevel (Logging. DEBUG) URL='http://david.abcc.ncifcrf.gov/webservice/services/DAVIDWebService?wsdl' Print 'url=%s'%URL##Create a service client using the WSDL.#Client =Client (URL)##Print the service (introspection)#PrintClient#Authenticate User EmailPrintClient.service.authenticate ('[email protected]')#Add a list#inputids = ' 16077069,16077070,16077074,16077075,16077077,16077081,255767015,255767017,16077099,16077106,16077114,16077118,16077119,16 077121 'Inputids ='16127995,16127996,16127997,16127998'Idtype='protein_gi_accession'ListName='make_up'ListType=0Printclient.service.addList (Inputids, Idtype, ListName, ListType)#print client.service.getDefaultCategoryNames ()#Getchartreportthd=0.1Count= 2#Print Client.service.getChartReport (THD, Count)#GettermclusterreportOverlap=3Initialseed= 3Finalseed= 3linkage= 0.5Kappa= 20#myresult = client.service.getTermClusterReport (overlap, initialseed, finalseed, linkage, Kappa)MyTable =Client.service.getTableReport ()#mylist = Client.service.getListReport ()With Open ('Mytable.txt','W') as F:Print>>F, Mytablemylist1= [] forIteminchmytable:tpdict={} tpdict['GI'] = item['Values'][0]['Array'][0] tpdict['ID'] = item['Geneobject']['ID'] tpdict['name'] = item['name'] Tplist= Filter (Lambdax:x['category'].startswith ('Goterm'), item['Annotationrecords']) forIinchtplist:tpdict[i['category']] = i['Terms'] Mylist1.append (tpdict) F= Open ('Test_json1.txt','W') Json.dump (Mylist1, F, Sort_keys= True, indent = 1) F.close ()
DAVID Web Service