Examples — mpathic 0.0.1 documentation

# Examples

Simulations

    # Simulate library example

    import mpathic as mpa

    # reate a library of random mutants from an initial wildtype sequence and mutation rate
    sim_library = mpa.SimulateLibrary(wtseq="TAATGTGAGTTAGCTCACTCAT", mutrate=0.24)
    print(sim_library.output_df.head())

    # Load dataset and model dataframes
    dataset_df = mpa.io.load_dataset('sort_seq_data.txt')
    model_df = mpa.io.load_model('crp_model.txt')

    # Simulate a Sort-Seq experiment example
    sim_sort = mpa.SimulateSort(df=dataset_df,mp=model_df)
    print(sim_sort.output_df.head())

Profiles

    import mpathic as mpa

    # Load dataset and model dataframes
    dataset_df = mpa.io.load_dataset('sort_seq_data.txt')
    model_df = mpa.io.load_model('crp_model.txt')

    # mut profile example
    profile_mut = mpa.ProfileMut(dataset_df = dataset_df)
    print(profile_mut.mut_df.head())

    # freq profile example
    profile_freq = mpa.ProfileFreq(dataset_df = dataset_df)
    print(profile_freq.freq_df.head())

    # info profile example
    profile_info = mpa.ProfileInfo(dataset_df = dataset_df)
    print(profile_info.info_df.head())

Models

    import mpathic as mpa

    # Load dataset and model dataframes
    dataset_df = mpa.io.load_dataset('sort_seq_data.txt')
    model_df = mpa.io.load_model('crp_model.txt')

    # learn models example
    learned_model = mpa.LearnModel(df=dataset_df)
    print(learned_model.output_df.head())

    # evaluate models example
    eval_model = mpa.EvaluateModel(dataset_df = dataset_df, model_df = model_df)
    print(eval_model.out_df.head())

    # scan models example
    # get contigs, provided with mpathic
    fastafile = "./mpathic/examples/genome_ecoli_1000lines.fa"
    contig_list = mpa.io.load_contigs_from_fasta(fastafile, model_df)

    scanned_model = mpa.ScanModel(model_df = model_df, contig_list = contig_list)
    print(scanned_model.sitelist_df.head())

    # predictive info example
    #predictive_info = mpa.PredictiveInfo(data_df = dataset_df, model_df = model_df,start=52)