Region set (BED) search combining both metadata and genomic regions
Metadata embedding vector backend
Section titled โMetadata embedding vector backendโThis vector beckend stored the embedding vectors of region set metadata annotations, which are encoded by open-source text model (SentenceTransformers, etc.). The payload of each metadata annotation vector must contain the storage ids of region set that the annotation matches.
Example code
Section titled โExample codeโfrom geniml.search.backends import BiVectorBackend, QdrantBackendfrom geniml.search.interfaces import BiVectorSearchInterface
# 2 required backendstext_backend = QdrantBackend(dim=384)bed_backend = QdrantBackend()
# load vectors and payloadsbed_backend.load(vectors=np.array(bed_vecs), payloads=bed_payloads)text_backend.load(vectors=np.array(text_embeddings), payloads=text_payloads)
# the search backendsearch_backend = BiVectorBackend(text_backend, bed_backend)
# the search interfacesearch_interface = BiVectorSearchInterface( backend=search_backend, query2vec="sentence-transformers/all-MiniLM-L6-v2")
# actual searchresult = search_interface.query_search( query="lung cancer cell lines", limit=10, with_payload=True, with_vectors=False, p=1.0, q=1.0, distance = False # QdrantBackend returns similarity as the score, not distance)