Section 4 of 6
4 Implementation
Rasmus Møller-Larsen, Adam Izdebski, Jan Olszewski, Pankhil Gawade, Michal Kmicikiewicz, Wojciech Zarzecki, and Ewa Szczurek · about 1 minutes
seqme is implemented as a highly extendable Python library (v3.10 or greater) while maintaining a simple interface (see Example usage box). seqme offers capabilities for performance optimization by caching sequence representations, i.e. sequence embeddings and properties. Caching provides a substantial speed-up when using several metrics with the same sequence embeddings and the embeddings models are large, e.g. most language models. Caching reduces the time-complexity of computing m metrics with the same embedding model for n sequences from O(nm+k) to O(n+k), where k=∑i=1mci is the cost of computing the metrics from the embeddings. seqme also contains extensive documentation and tutorials on how to use the library and how to add new metrics and models. Notably, we show how to integrate models with dependency conflicts using seqme’s third-party interface.
Example usage 1 import seqme as sm 2 3 sequences = { 4 ”UniProt”: [“GFGD”,“DPWDWV”,“IEFFT”], 5 ”DBAASP”: [“PGLGFY”,“AAVLNA”,“LAHRYH”], 6} 7 cache = sm. Cache( 8 models = { 9 ”esm2”: sm.models.ESM2(“facebook/esm2_t6_8M_UR50D”) 10 } 11 ) 12 metrics = [ 13 sm.metrics.Diversity(), 14 sm.metrics.FBD(sequences[“UniProt”], cache.model(“esm2”)) 15 ] 16 df = sm.evaluate(sequences, metrics) 17 sm.show(df)