<jupyter_start><jupyter_text>load readout sites<jupyter_code>library_folder = r'\\10.245.74.212\Chromatin_NAS_2\Chromatin_Libraries'

# load readout sites
adaptor_folder = os.path.join(library_folder, 'Adaptors')
readout_site_file = os.path.join(adaptor_folder, 'Readout_sites.fasta')
readout_sites = []
readout_site_dict = {}
readout_channels = ['750', '647', '561']

with open(readout_site_file, 'r') as _rd_handle:
    for _i, _readout in enumerate(SeqIO.parse(_rd_handle, "fasta")):
        readout_sites.append(_readout)
        readout_site_dict[readout_channels[_i]] = _readout

print(readout_site_dict)<jupyter_output>{'750': SeqRecord(seq=Seq('TTTGCACTGCCGTCCTTGAC'), id='Stv_82rc', name='Stv_82rc', description='Stv_82rc cy7 rev-com_last20', dbxrefs=[]), '647': SeqRecord(seq=Seq('GATCCGATTGGAACCGTCCC'), id='Stv_1rc', name='Stv_1rc', description='Stv_1rc cy5 rev-com_last20', dbxrefs=[]), '561': SeqRecord(seq=Seq('TGCGAACTGTCCGGCTTTCA'), id='Stv_79rc', name='Stv_79rc', description='Stv_79rc cy3 rev-com_last20', dbxrefs=[])}<jupyter_text>1. Gerate adaptors for sequential bits<jupyter_code># load readout usage for ctp-11
ctp12_usage_fl = r'\\10.245.74.212\Chromatin_NAS_2\Chromatin_Libraries\CTP-12_mop_markers\marker_gene_TSS\readout_usage.pkl'
ctp12_usage = pickle.load(open(ctp12_usage_fl, 'rb'))
sel_ctp12_readouts = ctp12_usage['u'][:]
sel_ctp12_readouts
from ImageAnalysis3.library_tools.readouts import Generate_adaptors

sel_ctp12_adaptors = Generate_adaptors(sel_ctp12_readouts, 
                                       [readout_site_dict['750'],readout_site_dict['647'],readout_site_dict['561']])<jupyter_output><empty_output><jupyter_text>2. Generate adaptors for RNA<jupyter_code>import pandas as pd
save_df = pd.DataFrame([], columns=['Name', 'Sequence', 'Scale', 'Purification'])
for _adt in sel_ctp12_adaptors:
    _info = {'Name':_adt.id, 
             'Sequence':str(_adt.seq), 
             'Scale':'25nm', 
             'Purification':'STD'}
    save_df = save_df.append(_info, ignore_index=True)
save_df
save_df.to_csv(os.path.join(adaptor_folder, 'Order_20220308_stv_adaptors_ctp12.csv'),
               index=None)
print(os.path.join(adaptor_folder, 'Order_20220308_stv_adaptors_ctp12.csv'))<jupyter_output>\\10.245.74.212\Chromatin_NAS_2\Chromatin_Libraries\Adaptors\Order_20220308_stv_adaptors_ctp12.csv
{'fraction_non_alphanumeric': 0.13803418803418804, 'fraction_numerical': 0.06025641025641026, 'mean_word_length': 6.431746031746032, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 3, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '385222', 'license': 'MIT', 'n_tokens_mistral': 1035, 'n_tokens_neox': 919, 'n_words': 113, 'path': 'Adaptor_design/20220308-GenerateAdaptors_Stvs.ipynb', 'repo_name': 'shiwei23/Chromatin_Analysis_Scripts', 'size': '2340'}