def main(familyid) : #file = open("./output.csv",'w') conn = db.Conn("localhost") # Get Affected and Parents (affecteds, parents) = getPatientData(conn, familyid) q = TWO_PARENT_SHARED_HOM_QUERY % (parents[0], parents[1], affecteds[0]) queries.makeReport( q, "1=1", "cp_report.csv" )
affecteds.append( eyed ) elif affected == 0 and generation == mingen : parents.append( eyed ) #sanity check if len(affecteds) != 1 : raise Exception("There are %d != 1 affecteds for family %s." % \ (len(affecteds), familyid)) elif len(parents) != 2 : raise Exception("There are %d != 2 parents for family %s" % \ (len(parents), familyid)) return affecteds, parents # END getPatientData try : conn = db.Conn("localhost") familyid = fields.getvalue("family_id") filename = fields.getvalue("filename") (affecteds, parents) = getPatientData(conn, familyid) q = TWO_PARENT_SHARED_HOM_QUERY % (parents[0], parents[1], affecteds[0]) queries.makeReport( q, "1=1", filename ) printToServer( '<a href="../reports/%s.tsv">Report Ready</a>' % filename ) except KeyError, (e) : printToServer( "You most likely left %s blank." % str(e) ) except Exception, (e) : printToServer( str(e) )
#!/usr/bin/python2.4 import cgi import sys sys.path.append('/home/Gleeson/database/src') from web_utils import * from queries import makeReport printHeader() fields = cgi.FieldStorage() try : names = ["variant_sql","call_where","filename"] values = [fields[name].value for name in names] sys.stdout = open("debug/custom_out.txt",'w') sys.stderr = open("debug/custom_err.txt",'w') makeReport( values[0], values[1], values[2] ) printToServer( '<a href="../reports/%s.tsv">report generated</a>' % values[2] ) except KeyError, (e) : printToServer( "You most likely left %s blank." % str(e) ) except Exception, (e) : printToServer( str(e) )