<jupyter_start><jupyter_text>Keras-genomics wants mapping files that are tab-separated and have no headers<jupyter_code>import glob
import pandas as pd

encoding_folder = os.path.join(DATA_FOLDER, '001_amino_acid_encoding')

for csv in glob.glob(os.path.join(encoding_folder, '*.csv')):
    basename = os.path.basename(csv)
    tsv = os.path.join(data_folder, basename.replace('csv', 'tsv'))
    df = pd.read_csv(csv)
    df.to_csv(tsv, sep='\t', header=False, index=False)
! head $data_folder/*tsv
%%bash -s "input_folder='$input_folder'; echo input_folder: $input_folder"

data_folder=/src/myhome/code/sequence-localization/data/051_run_pep_keras_genomics
input_folder=/src/myhome/code/sequence-localization/data/023_make_train_valid_test_sets
EXPT_DIR=$data_folder/pep_expt01
MAPPERFILE='/src/myhome/code/sequence-localization/data/051_run_pep_keras_genomics/one_hot_encoding.tsv'


PREFIX='Homo_sapiens.GRCh38.pep.all.fa.nuclear_or_cytoplasmic.last150'

for dtype in 'train' 'valid' 'test'
do
    echo Making $dtype dataset ...
    echo "\tCommand: python /src/myhome/code/Keras-genomics/embedH5.py \
        --mapperfile $MAPPERFILE \
        $input_folder/$PREFIX.$dtype \
        $input_folder/$PREFIX.target.tsv.$dtype \
        $EXPT_DIR/$dtype.h5"
    python /src/myhome/code/Keras-genomics/embedH5.py \
        --mapperfile $MAPPERFILE \
        $input_folder/$PREFIX.$dtype \
        $input_folder/$PREFIX.target.tsv.$dtype \
        $EXPT_DIR/$dtype.h5
done
# %run -d -b 40 /src/myhome/code/Keras-genomics/embedH5.py /src/myhome/code/sequence-localization/data/022_make_train_valid_test_sets/Homo_sapiens.GRCh38.cds.all.fa.nuclear_or_cytoplasmic.test         /src/myhome/code/sequence-localization/data/022_make_train_valid_test_sets/Homo_sapiens.GRCh38.cds.all.fa.nuclear_or_cytoplasmic.target.tsv.test         /src/myhome/code/sequence-localization/data/040_run_cdna_keras_genomics/cdna_expt01/test.h5
! pip install future
! python /src/myhome/code/Keras-genomics/main.py -d $data_folder/pep_expt01 -m /src/myhome/code/Keras-genomics/example/model.py -y -t -e
%run -d -b 1
! ls genome/hg38/**/*
ls $data_folder/cdna_expt01
! head $data_folder/cdna_expt01/*txt
! ls ls $data_folder/cdna_expt01/model
! head $data_folder/cdna_expt01/model/*
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns


txt = os.path.join(data_folder, 'pep_expt01', 'model', 'model.training_history.txt')
! ls $txt
training_history = pd.read_table(txt)
training_history.columns = training_history.columns.str.strip('# ')
print(training_history.shape)
training_history.head()

training_history_reset_index = training_history.reset_index()
training_history_reset_index = training_history_reset_index.rename(columns={'index': 'epoch'})
training_history_reset_index.head()

training_history_tidy = pd.melt(training_history_reset_index, id_vars='epoch')
print(training_history_tidy.shape)
training_history_tidy.head()
g = sns.FacetGrid(data=training_history_tidy, col='variable')
g.map(sns.regplot, 'epoch', 'value')
g.set(ylim=(0, 1), xlim=(0, 20))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.130674448767834, 'fraction_numerical': 0.020103761348897537, 'mean_word_length': 5.108910891089109, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '131036', 'license': 'MIT', 'n_tokens_mistral': 1226, 'n_tokens_neox': 1172, 'n_words': 158, 'path': 'notebooks/061_run_pep_keras_genomics-Copy1.ipynb', 'repo_name': 'czbiohub/sequence-localization', 'size': '3084'}