def _check_disjoint_resolver_names(resolver_keys, local_keys, global_keys): """Make sure that variables in resolvers don't overlap with locals or globals. """ res_locals = list(com.intersection(resolver_keys, local_keys)) if res_locals: msg = "resolvers and locals overlap on names {0}".format(res_locals) raise NameResolutionError(msg) res_globals = list(com.intersection(resolver_keys, global_keys)) if res_globals: msg = "resolvers and globals overlap on names {0}".format(res_globals) raise NameResolutionError(msg)
def test_intersection(): a = [1, 2, 3] b = [1, 2, 3, 4, 5, 6] inter = sorted(com.intersection(a, b)) assert(a == inter)
def test_intersection(): a = [1, 2, 3] b = [1, 2, 3, 4, 5, 6] inter = sorted(com.intersection(a, b)) assert (a == inter)
# set_msgfdb = set(list_peptide_msgfdb) set_blib = set(list_peptide_blib) set_msgfplus_fixed = set() set_msgfplus = set(list_peptide_msgfplus) set_msgfplus_qfilter = set(list_peptide_msgfplus_qfilter) for msgf_pep in set_msgfplus: match = regex.search(r'\.{1}.+\.', msgf_pep) if match: pep_seq = match.group(0) reg_pattern = regex.compile('[^a-zA-Z]') pep_seq = reg_pattern.sub('', pep_seq) set_msgfplus_fixed.add(pep_seq) set_matched = intersection(set_blib, set_msgfplus_fixed) set_matched_qfilter = intersection(set_blib, set_msgfplus_qfilter) set_unmatched = set(set_blib).symmetric_difference(set_msgfplus_fixed) set_unmatched_qfilter = set(set_blib).symmetric_difference( set_msgfplus_qfilter) with open(result_file, "w") as result: # result.write(('all peptide count in msgfdb database : {0}\n'.format(list_peptide_msgfdb.__len__()))) result.write(('all peptide count in blib database : {0}\n'.format( list_peptide_blib.__len__()))) result.write( ('all peptide count in msgfplus merged database : {0}\n'.format( list_peptide_msgfplus.__len__()))) # result.write(('unique peptide count in msgfdb database : {0}\n'.format(set_msgfdb.__len__()))) result.write(('unique peptide count in blib database : {0}\n'.format(