From 4a3c48c4b91c0cce9d7d0e9896be893d6e80a883 Mon Sep 17 00:00:00 2001 From: Lei Yan Date: Sat, 25 Jan 2014 00:29:35 -0600 Subject: On branch master --- .../maintenance/dataset/phenotypes/phenotypes.py | 24 +++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'wqflask/maintenance/dataset') diff --git a/wqflask/maintenance/dataset/phenotypes/phenotypes.py b/wqflask/maintenance/dataset/phenotypes/phenotypes.py index 08fc1432..821e5687 100644 --- a/wqflask/maintenance/dataset/phenotypes/phenotypes.py +++ b/wqflask/maintenance/dataset/phenotypes/phenotypes.py @@ -50,9 +50,9 @@ def fetch(): print "get %d phenotypes" % (len(results)) for phenotyperow in results: publishxrefid = phenotyperow[0] - original_description = phenotyperow[1] - pre_publication_description = phenotyperow[2] - post_publication_description = phenotyperow[3] + original_description = clearspaces(phenotyperow[1]) + pre_publication_description = clearspaces(phenotyperow[2]) + post_publication_description = clearspaces(phenotyperow[3]) phenotypesfile.write("%s\t%s\t%s\t%s\t" % (publishxrefid, original_description, pre_publication_description, post_publication_description)) sql = """ SELECT Strain.Name, PublishData.value @@ -71,10 +71,24 @@ def fetch(): strainname = strainname.lower() value = strainvalue[1] strainvaluedic[strainname] = value - print strainvaluedic - break + for strain in strains: + if strain in strainvaluedic: + phenotypesfile.write(str(strainvaluedic[strain])) + else: + phenotypesfile.write('x') + phenotypesfile.write('\t') + phenotypesfile.write('\n') + phenotypesfile.flush() # release phenotypesfile.close() + +def clearspaces(s): + if s: + s = re.sub('\s+', ' ', s) + s = s.strip() + return s + else: + return None # main if __name__ == "__main__": -- cgit v1.2.3