Beispiel #1
0
def test_missing_extras():
    """https://github.com/sacdallago/bio_embeddings/issues/105"""
    # Make sure those are in sync
    assert set(name_to_embedder) == set(DEFAULT_MAX_AMINO_ACIDS)
    with mock.patch("bio_embeddings.embed.pipeline.name_to_embedder", {}):
        with pytest.raises(
            InvalidParameterError,
            match="The extra for the protocol seqvec is missing. "
            "See https://docs.bioembeddings.com/#installation on how to install all extras",
        ):
            run(
                protocol="seqvec",
                prefix=MagicMock(),
                stage_name=MagicMock(),
                remapped_sequences_file=MagicMock(),
                mapping_file=MagicMock(),
            )
def test_seqvec():
    with mock.patch("bio_embeddings.embed.seqvec_embedder.ElmoEmbedder",
                    MockElmoEmbedder), TemporaryDirectory() as tmp_dir:
        Path(tmp_dir).joinpath("seqvec_stage").mkdir()
        out = run(
            protocol="seqvec",
            stage_name="seqvec_stage",
            weights_file="mocked.txt",
            options_file="mocked.txt",
            seqvec_version=1,
            prefix=tmp_dir,
            remapped_sequences_file="test-data/remapped_sequences_file.fasta",
            mapping_file="test-data/mapping_file.csv",
        )
        # TODO: Check output
        print(out)