def get_overlapping_samples(map_rows, otu_table):
 map_sample_ids = zip(*map_rows)[0]
 shared_ids = (set(map_sample_ids) & set(otu_table.ids()))
 otu_table = filter_samples_from_otu_table(otu_table, shared_ids, (- np.inf), np.inf)
 new_map = []
 for sam_id in map_sample_ids:
  if (sam_id in shared_ids):
   ix = map_sample_ids.index(sam_id)
   new_map.append(map_rows[ix])
 return (new_map, otu_table)

def get_overlapping_samples ( map_rows , otu_table ) : map_sample_ids = zip ( * map_rows ) [ 0 ] shared_ids = ( set ( map_sample_ids ) & set ( otu_table . ids ( ) ) ) otu_table = filter_samples_from_otu_table ( otu_table , shared_ids , ( - np . inf ) , np . inf ) new_map = [ ] for sam_id in map_sample_ids : if ( sam_id in shared_ids ) : ix = map_sample_ids . index ( sam_id ) new_map . append ( map_rows [ ix ] ) return ( new_map , otu_table )
extracts only samples contained in otu table and mapping file .