<jupyter_start><jupyter_text>Main run file for total execution> The aim here is to make a complete run environment.<jupyter_code>#hide
from nbdev.showdoc import *

#export
import os
import warnings
import matplotlib.pyplot as plt
from subprocess import call
import subprocess
import glob
import pandas as pd
import tempfile
import numpy as np<jupyter_output><empty_output><jupyter_text>Load the ligand list from .csv file<jupyter_code>#export
linandFile="./TEST.csv"
ligandList=pd.read_csv(linandFile, sep=',', header=0)
ligandList<jupyter_output><empty_output><jupyter_text>Filter out the ligands from species with shown interactionThe princliple here is to select only the ligands which have been shown to function in this specific species<jupyter_code>#export
human_ligandList = ligandList.loc[((ligandList['Species'] == 'Human') & (ligandList['Interact human'] == 'Y'))]
mouse_ligandList = ligandList.loc[((ligandList['Species'] == 'Mouse') & (ligandList['Interact mouse'] == 'Y'))]
mainSpec_ligandList = human_ligandList.append(mouse_ligandList)<jupyter_output><empty_output><jupyter_text>Run parameters<jupyter_code>#export
input_ligandList = mainSpec_ligandList
aa_length=9<jupyter_output><empty_output><jupyter_text>Main mk_fragments function<jupyter_code>#export
def mk_fragments(aa_seq,aa_length):
    last_aa=len(aa_seq)-aa_length
    aa_seq[last_aa:len(aa_seq)]
    aa_fragments = []
    
    for start_aa in range(last_aa):
        aa_fragments.append(aa_seq[start_aa:start_aa+aa_length])
    
    return aa_fragments<jupyter_output><empty_output><jupyter_text>Generate fragments from all selected AA sequences<jupyter_code>#export
all_aa_fragments = pd.DataFrame([])
for aa_seq in input_ligandList.Sequence:
    all_aa_fragments = all_aa_fragments.append(mk_fragments(aa_seq,aa_length))
len(all_aa_fragments)
#export
unique_aa_fragments=all_aa_fragments.drop_duplicates()
unique_aa_fragments.shape
unique_aa_fragments<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09637939826619071, 'fraction_numerical': 0.0010198878123406426, 'mean_word_length': 8.342857142857143, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '617329', 'license': 'Apache-2.0', 'n_tokens_mistral': 690, 'n_tokens_neox': 678, 'n_words': 134, 'path': '00_core.ipynb', 'repo_name': 'MNM-LU/nbdev_pubtest', 'size': '1961'}