Example #1
0
 def testGetRegionSequence(self):
     rows = self.queries.getRegionSequence("Pf3D7_01")
     row = rows[0]
     
     length = row["length"]
     start = 1
     end = 10
     
     dna = row["dna"]
     dna = dna[start-1:end-1]
     
     data = {
         "response" : {
             "name" : "region/sequence",
             "sequence" :  {
                 "start" : start,
                 "end" : end,
                 "length" : length,
                 "dna" : dna
             }
         }
     }
     
     formatter = Formatter(data, os.path.dirname(__file__) + "/../tpl/")
     print formatter.formatJSON()
Example #2
0
 def testAllOrganisms(self):
     since = "2009-06-01"
 
     organism_list = self.queries.getAllOrganismsAndTaxonIDs()
 
     organismIDs = []
     organismHash = {}
     for organism_details in organism_list:
         organism_details["count"] = 0
         organismIDs.append(organism_details["organism_id"])
         organismHash [organism_details["organism_id"]] = organism_details
 
     counts = self.queries.countAllChangedFeaturesForOrganisms(since, organismIDs)
 
     for count in counts:
         organismID = str(count[0])
         print organismID
         org = organismHash[organismID]
         org["count"] = count[1]
 
     data = {
         "response" : {
             "name" : "genomes/changes",
             "since" : since,
             "results" : organismHash.values()
         }
     }
 
     formatter = Formatter(data, os.path.dirname(__file__) + "/../tpl/")
     print formatter.formatXML('genomes_changed.xml.tpl')
Example #3
0
 def testGetGenesWithPrivateAnnotationChanges(self):
     since = "2009-06-01"
     rows = self.queries.getGenesWithPrivateAnnotationChanges(14, since)
 
     data = {
         "response" : {
             "name" : "genome/recorded_annotation_changes",
             "taxonID" : "420245",
             "count" : len(rows),
             "results" : rows
         }
     }
 
     formatter = Formatter(data, os.path.dirname(__file__) + "/../tpl/")
     formatter.formatXML('private_annotations.xml.tpl')
     formatter.formatJSON()
Example #4
0
 def testAllChanged(self):
         since = "2009-06-01"
         organism_id = 14
         changed_features = self.queries.getAllChangedFeaturesForOrganism(since, organism_id)
     
         data = {
             "response" : {
                 "name" : "genome/changes",
                 "taxonID" : "420245",
                 "count" : len(changed_features),
                 "since" : since,
                 "results" : changed_features
             }
         }
     
         formatter = Formatter(data, os.path.dirname(__file__) + "/../tpl/")
         formatter.formatJSON()
         formatter.formatXML("changes.xml.tpl")