#NEWLINE# def amend_sample( args ) : #NEWLINE# #INDENT# loaded_subjects = get_subjects ( args ) #NEWLINE# ped_dict = load_ped_file ( args . sample ) #NEWLINE# header = get_ped_fields ( args . sample ) #NEWLINE# with database_transaction ( args . db ) as c : #NEWLINE# #INDENT# add_columns ( header , c , args . clear ) #NEWLINE# for ( k , v ) in loaded_subjects . items ( ) : #NEWLINE# #INDENT# if ( k in ped_dict ) : #NEWLINE# #INDENT# item_list = map ( quote_string , ped_dict [ k ] ) #NEWLINE# sample = zip ( header , item_list ) #NEWLINE# set_str = ',' . join ( [ ( ( str ( x ) + '=' ) + str ( y ) ) for ( x , y ) in sample ] ) #NEWLINE# sql_query = 'update samples set {0} where sample_id={1}' #NEWLINE# c . execute ( sql_query . format ( set_str , v . sample_id ) )