def create_replicated_mapping_file(map_f, num_replicates, sample_ids):
 if (num_replicates < 1):
  raise ValueError(('Must specify at least one sample replicate (was provided %d).' % num_replicates))
 (map_data, header, comments) = parse_mapping_file(map_f)
 rep_map_data = []
 for row in map_data:
  if (row[0] in sample_ids):
   for rep_num in range(num_replicates):
    rep_map_data.append(([('%s.%i' % (row[0], rep_num))] + row[1:]))
 return format_mapping_file(header, rep_map_data, comments)

def create_replicated_mapping_file ( map_f , num_replicates , sample_ids ) : if ( num_replicates < 1 ) : raise ValueError ( ( 'Must specify at least one sample replicate (was provided %d).' % num_replicates ) ) ( map_data , header , comments ) = parse_mapping_file ( map_f ) rep_map_data = [ ] for row in map_data : if ( row [ 0 ] in sample_ids ) : for rep_num in range ( num_replicates ) : rep_map_data . append ( ( [ ( '%s.%i' % ( row [ 0 ] , rep_num ) ) ] + row [ 1 : ] ) ) return format_mapping_file ( header , rep_map_data , comments )
returns a formatted mapping file with replicated sample ids .