def check_labels_sampleids(fasta_labels, sample_ids, total_seq_count):
 valid_id_count = 0
 matches_sampleid_count = 0
 for label in fasta_labels:
  curr_label = label.split('_')
  if (len(curr_label) != 2):
   continue
  valid_id_count += 1
  if (curr_label[0] in sample_ids):
   matches_sampleid_count += 1
 total_seq_count = float(total_seq_count)
 valid_id_count = float(valid_id_count)
 matches_sampleid_count = float(matches_sampleid_count)
 perc_not_valid = ('%1.3f' % ((total_seq_count - valid_id_count) / total_seq_count))
 perc_nosampleid_match = ('%1.3f' % ((total_seq_count - matches_sampleid_count) / total_seq_count))
 return (perc_not_valid, perc_nosampleid_match)

def check_labels_sampleids ( fasta_labels , sample_ids , total_seq_count ) : valid_id_count = 0 matches_sampleid_count = 0 for label in fasta_labels : curr_label = label . split ( '_' ) if ( len ( curr_label ) != 2 ) : continue valid_id_count += 1 if ( curr_label [ 0 ] in sample_ids ) : matches_sampleid_count += 1 total_seq_count = float ( total_seq_count ) valid_id_count = float ( valid_id_count ) matches_sampleid_count = float ( matches_sampleid_count ) perc_not_valid = ( '%1.3f' % ( ( total_seq_count - valid_id_count ) / total_seq_count ) ) perc_nosampleid_match = ( '%1.3f' % ( ( total_seq_count - matches_sampleid_count ) / total_seq_count ) ) return ( perc_not_valid , perc_nosampleid_match )
returns percent of valid fasta labels and that do not match sampleids fasta_labels: list of fasta labels sample_ids: set of sample ids from mapping file total_seq_count: int of total sequences in fasta file .