How to use the kipoi.get_model function in kipoi

To help you get started, we’ve selected a few kipoi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kipoi / kipoiseq / tests / dont_test_4_integration.py View on Github external
def test_deepsea():
    model = kipoi.get_model("DeepSEA/variantEffects")
    mie = ModelInfoExtractor(model, SeqIntervalDl)
github kipoi / kipoiseq / tests / dont_test_4_integration.py View on Github external
def test_var_eff_pred_varseq(tmpdir):
    model_name = "DeepSEA/variantEffects"
    if INSTALL_REQ:
        install_model_requirements(model_name, "kipoi", and_dataloaders=True)
    #
    model = kipoi.get_model(model_name, source="kipoi")
    # The preprocessor
    Dataloader = SeqIntervalDl
    #
    dataloader_arguments = {"intervals_file": "example_files/intervals.bed",
                            "fasta_file": "example_files/hg38_chr22.fa",
                            "required_seq_len": 1000, "alphabet_axis": 1, "dummy_axis": 2, "label_dtype": str}
    dataloader_arguments = {k: model.source_dir + "/" + v if isinstance(v, str) else v for k, v in
                            dataloader_arguments.items()}

    vcf_path = "tests/data/variants.vcf"
    out_vcf_fpath = str(tmpdir.mkdir("variants_generated", ).join("out.vcf"))
    #
    vcf_path = kipoi_veff.ensure_tabixed_vcf(vcf_path)
    model_info = kipoi_veff.ModelInfoExtractor(model, Dataloader)
    writer = kipoi_veff.VcfWriter(
        model, vcf_path, out_vcf_fpath, standardise_var_id=True)
github kipoi / models / Basset / test_basset_model.py View on Github external
def test_ref_seq():
    # Get pure fasta predictions
    model_dir = model_root + "./"
    model = kipoi.get_model(model_dir, source="dir")
    # The preprocessor
    Dataloader = kipoi.get_dataloader_factory(model_dir, source="dir")
    dataloader_arguments = {
        "fasta_file": "/nfs/research1/stegle/users/rkreuzhu/opt/manuscript_code/data/raw/dataloader_files/shared/hg19.fa",
        "intervals_file": "test_files/test_encode_roadmap.bed"
    }
    # predict using results
    preds = model.pipeline.predict(dataloader_arguments)
    #
    res_orig = pd.read_csv("/nfs/research1/stegle/users/rkreuzhu/deeplearning/Basset/data/test_encode_roadmap_short_pred.txt", "\t", header=None)
    assert np.isclose(preds, res_orig.values, atol=1e-3).all()
github kipoi / models / SeqVec / structure / model.py View on Github external
def __init__(self, x=1):
        #self.embed  = kipoi.get_model("SeqVec/embedding")
        #self.struct = kipoi.get_model("SeqVec/embedding2structure")
        self.embed  = kipoi.get_model("/home/mheinzinger/tmp/models/SeqVec/embedding")
        self.struct = kipoi.get_model("/home/mheinzinger/tmp/models/SeqVec/embedding2structure")
github kipoi / models / CleTimer / default / model.py View on Github external
def __init__(self, acc_model, don_model, features_path=None):
        self.don_model = joblib.load(don_model)
        self.acc_model = joblib.load(acc_model)
        if features_path is None:
            features_path = os.path.join(this_dir, "../features.json")
        self.features_metadata = read_json(features_path)
        # acceptor and donor site indexes are unified across SOI
        # NB! This indexes are pos=1 of the region, and index-1 is already pos=-1, not 0!
        self.don_i = 3
        self.acc_i = -21
        self.labranchor = kipoi.get_model("labranchor", with_dataloader=False)
        # add current dir to python path for multiprocessing
        sys.path.append(this_dir)
github kipoi / models / SeqVec / structure / model.py View on Github external
def __init__(self, x=1):
        #self.embed  = kipoi.get_model("SeqVec/embedding")
        #self.struct = kipoi.get_model("SeqVec/embedding2structure")
        self.embed  = kipoi.get_model("/home/mheinzinger/tmp/models/SeqVec/embedding")
        self.struct = kipoi.get_model("/home/mheinzinger/tmp/models/SeqVec/embedding2structure")
github kipoi / models / CpGenie / merged / model.py View on Github external
def __init__(self):

        from keras import backend as K
        K.clear_session()

        self.model_names = read_txt("models.txt")
        # hard-code the path to this models
        # if we'd use `source='dir'`, then the models wouldn't
        # be updated
        self.models = [kipoi.get_model("CpGenie/{0}".format(m), source='kipoi',
                                       with_dataloader=False)
                       for m in self.model_names]