コード例 #1
0
ファイル: test.py プロジェクト: Kortemme-Lab/klab
def test_pdbml_speed():

    test_cases = [
        '1WSY',
        '1YGV',
        '487D',
        '1HIO',
        '1H38',
        '3ZKB',
    ]
    for test_case in test_cases:
        print("\n")

        colortext.message("Creating PDBML object for %s" % test_case)
        #PDBML.retrieve(test_case, cache_dir = cache_dir)

        print("")
        colortext.printf("Using the old minidom class", color = 'cyan')
        t1 = time.clock()
        p_minidom = PDBML_slow.retrieve(test_case, cache_dir = cache_dir)
        t2 = time.clock()
        colortext.message("Done in %0.2fs!" % (t2 - t1))

        print("")
        colortext.printf("Using the new sax class", color = 'cyan')
        t1 = time.clock()
        p_sax = PDBML.retrieve(test_case, cache_dir = cache_dir)
        t2 = time.clock()
        colortext.message("Done in %0.2fs!" % (t2 - t1))

        colortext.write("\nEquality test: ", color = 'cyan')
        try:
            assert(p_minidom.atom_to_seqres_sequence_maps.keys() == p_sax.atom_to_seqres_sequence_maps.keys())
            for c, s_1 in p_minidom.atom_to_seqres_sequence_maps.iteritems():
                s_2 = p_sax.atom_to_seqres_sequence_maps[c]
                assert(str(s_1) == str(s_2))
            colortext.message("passed\n")
        except:
            colortext.error("failed\n")
コード例 #2
0
ファイル: test.py プロジェクト: Kortemme-Lab/klab
    colortext.warning("Trying to match chain %c against UniParc IDs %s" % (c, uniparc_sequences.keys()))
    align_three_simple_sequences(fasta_sequence, uniparc_sequences['UPI00001403C6'], uniparc_sequences['UPI0000000356'], sequence1name = '%s:%s|PDBID|CHAIN|SEQUENCE' % (pdb_id, c), sequence2name = 'UPI00001403C6', sequence3name = 'UPI0000000356')

    #for uniparc_id, uniparc_sequence in uniparc_sequences.iteritems():
    #    colortext.warning("Trying to match chain %c against UniParc ID %s" % (c, uniparc_id))
    #    align_two_simple_sequences(fasta_sequence, uniparc_sequence, sequence1name = '%s:%s|PDBID|CHAIN|SEQUENCE' % (pdb_id, c), sequence2name = uniparc_id)


# sanity check - see if uniprotAC in pdb is in the list of the matched uniprot id

print(chains)


sys.exit(0)

px = PDBML.retrieve('1A2C', cache_dir='/home/oconchus/temp')
for k, v in sorted(px.atom_to_seqres_sequence_maps.iteritems(), key=lambda x:(x[0], x[1])):
    print(k,v)


p = PDB.from_filepath('../.testdata/1H38.pdb') # has protein, DNA, RNA
p = PDB.from_filepath('../.testdata/1ZC8.pdb')
p = PDB.from_filepath('../.testdata/4IHY.pdb')
#p = PDB('../.testdata/2GRB.pdb')
p = PDB.from_filepath('../.testdata/1J1M.pdb')
p = PDB.from_filepath('../.testdata/1H38.pdb')
p = PDB.from_filepath('../.testdata/1A2C.pdb')

#print(p.structure_lines)

colortext.message("Resolution")