CoolFace
Apppublic

syedislamuddin/LR-Guides

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes
app.py1283 linesDownload Raw Back to root
1import streamlit as st2import pandas as pd3import numpy as np4from st_aggrid import AgGrid, GridOptionsBuilder,GridUpdateMode,DataReturnMode5from iteration_utilities import duplicates6from iteration_utilities import unique_everseen7import os8 9st.set_page_config(layout="wide") 10st.markdown(11    """12<style>13.streamlit-expanderHeader {14    font-size: x-large;15}16</style>17""",18    unsafe_allow_html=True,19)20caution = '<p style="font-family:sans-serif; color:Red; font-size: 18px;">Please note that Only one Guide (from pair) is found. Please see guides not found section for other guide</p>'21caution1 = '<p style="font-family:sans-serif; color:Red; font-size: 18px;">Please note that Each mutated guide is reported as a sepearte line. sgID_1/2, sgRNA_1/2, chr_sgRNA_1/2 and position_sgRNA_1/2 represent values for reference/mutated guide</p>'22caution2 = '<p style="font-family:sans-serif; color:Red; font-size: 18px;">Please Select a single/multiple guides and then select Check Box A, B or C Otherwise code will through error</p>'23table_edit = '<p style="font-family:sans-serif; color:Green; font-size: 16px;">About Table: Please note that table can be <b>sorted by clicking on any column</b> and <b>Multiple rows can be selected</b> (by clicking check box in first column) to save only those rows.</p>'24caution_genes = '<p style="font-family:sans-serif; color:Red; font-size: 16px;">Please make sure that desired genes from all three lists should be selected to generate Order Ready Table.</p>'25 26 27#READ INPUT FILES28 29cwd=os.getcwd()+'/'+'data/'30 31#Here, gene column is modified for non-targeting guides in the format sgID_1|sgID_2 for coherent downstream manipulation32listA = pd.read_csv(cwd+"guides_a_new.csv",index_col=False)33listB = pd.read_csv(cwd+"guides_b_new.csv",index_col=False)34listC = pd.read_csv(cwd+"guides_c_new.csv",index_col=False)35 36lista_sz=listA.shape[0]37listb_sz=listB.shape[0]38listc_sz=listC.shape[0]39#st.write(listA.shape)40variantsa1=listA['gene'].unique()41variantsb1=listB['gene'].unique()42variantsc1=listC['gene'].unique()43#Make a comprehensive lsit of genes in all 3 lists (Please not that non-targeting guide names are not same across three lists)44con = np.concatenate((variantsa1, variantsb1, variantsc1))45variants_s=sorted(np.unique(con))46 47#NOW read GRCh38 and LR guides for stea as identified by LR-Guides pipeline48#Format is: gene (as many entries as number of guides found, both matched and mutated), ref_guide, chr, position, mutated_guide (can also be same as reference), strand, num_mismatcg (excluding leading G), Please note that each guide has trailing NGG49listA_found_ref = pd.read_csv(cwd+"seta_found_ref1.csv",index_col=False)50listA_found_ref = listA_found_ref.sort_values('gene')51lsita_ref_found_sz=listA_found_ref.shape[0]52#remove # from chr# #53listA_found_ref['chr'] = [x.split(' ')[-0] for x in listA_found_ref['chr']]54listA_found_ref.rename(columns = {'strnad':'strand'}, inplace = True) #Also change strnad to strand (was misspelled in LR-Guides pipeline)55#This (all such) file has 2-columns (gene as given in sgID_1/2, ref_guide). 56listA_notfound_ref = pd.read_csv(cwd+"seta_notfound_ref1.csv",index_col=False)57listA_notfound_ref=listA_notfound_ref.sort_values('gene')58lsita_ref_notfound_sz=listA_notfound_ref.shape[0]59#LR guides60listA_found_lr = pd.read_csv(cwd+"seta_found_LR1.csv",index_col=False)61listA_found_lr=listA_found_lr.sort_values('gene')62lsita_lr_found_sz=listA_found_lr.shape[0]63listA_found_lr.rename(columns = {'strnad':'strand'}, inplace = True)64listA_notfound_lr = pd.read_csv(cwd+"seta_notfound_LR1.csv",index_col=False)65listA_notfound_lr=listA_notfound_lr.sort_values('gene')66lsita_lr_notfound_sz=listA_notfound_lr.shape[0]67 68#Also read GRCh38 and LR guides for set b69listB_found_ref = pd.read_csv(cwd+"setb_found_ref1.csv",index_col=False)70listB_found_ref=listB_found_ref.sort_values('gene')71lsitb_ref_found_sz=listB_found_ref.shape[0]72#remove # from chr# #73listB_found_ref['chr'] = [x.split(' ')[-0] for x in listB_found_ref['chr']]74listB_found_ref=listB_found_ref.sort_values('gene')75listB_found_ref.rename(columns = {'strnad':'strand'}, inplace = True)76listB_notfound_ref = pd.read_csv(cwd+"setb_notfound_ref1.csv",index_col=False)77listB_notfound_ref=listB_notfound_ref.sort_values('gene')78lsitb_ref_notfound_sz=listB_notfound_ref.shape[0]79 80 81listB_found_lr = pd.read_csv(cwd+"setb_found_LR1.csv",index_col=False)82listB_found_lr=listB_found_lr.sort_values('gene')83lsitb_lr_found_sz=listB_found_lr.shape[0]84listB_found_lr.rename(columns = {'strnad':'strand'}, inplace = True)85listB_notfound_lr = pd.read_csv(cwd+"setb_notfound_LR1.csv",index_col=False)86listB_notfound_lr=listB_notfound_lr.sort_values('gene')87lsitb_lr_notfound_sz=listB_notfound_lr.shape[0]88 89#Also read GRCh38 and LR guides for set c90listC_found_ref = pd.read_csv(cwd+"setc_found_ref1.csv",index_col=False)91listC_found_ref=listC_found_ref.sort_values('gene')92lsitc_ref_found_sz=listC_found_ref.shape[0]93#remove # from chr# #94listC_found_ref['chr'] = [x.split(' ')[-0] for x in listC_found_ref['chr']]95listC_found_ref.rename(columns = {'strnad':'strand'}, inplace = True)96listC_notfound_ref = pd.read_csv(cwd+"setc_notfound_ref1.csv",index_col=False)97listC_notfound_ref=listC_notfound_ref.sort_values('gene')98lsitc_ref_notfound_sz=listC_notfound_ref.shape[0]99 100listC_found_lr = pd.read_csv(cwd+"setc_found_LR1.csv",index_col=False)101listC_found_lr=listC_found_lr.sort_values('gene')102lsitc_lr_found_sz=listC_found_lr.shape[0]103listC_found_lr.rename(columns = {'strnad':'strand'}, inplace = True)104listC_notfound_lr = pd.read_csv(cwd+"setc_notfound_LR1.csv",index_col=False)105listC_notfound_lr=listC_notfound_lr.sort_values('gene')106lsitc_lr_notfound_sz=listC_notfound_lr.shape[0]107 108 109#This for all guides order table110set_start=0111 112regular_lista=listA[~listA['gene'].str.contains('non-targeting')]['sgID_AB']#[['gene','guide_type','protospacer_A','protospacer_B','sgID_AB']]113regular_lista=regular_lista.sort_values()114set_end=regular_lista.shape[0] #18905115#regular_lista=regular_lista.iloc[set_start:set_end]116non_targeting_lista=listA[listA['gene'].str.contains('non-targeting')]['sgID_AB']#[['gene','guide_type','protospacer_A','protospacer_B','sgID_AB']]117non_targeting_lista=non_targeting_lista.sort_values()118#regular_lista=regular_lista.reset_index()119regular_listb=listB[~listB['gene'].str.contains('non-targeting')]['sgID_AB']#[['gene','guide_type','protospacer_A','protospacer_B','sgID_AB']] 120regular_listb=regular_listb.sort_values()121#regular_listb=regular_listb.iloc[set_start:set_end]122non_targeting_listb=listB[listB['gene'].str.contains('non-targeting')]['sgID_AB']#[['gene','guide_type','protospacer_A','protospacer_B','sgID_AB']]123non_targeting_listb=non_targeting_listb.sort_values()124 125#regular_listb=regular_listb.reset_index()126regular_listc=listC[~listC['gene'].str.contains('non-targeting')]['sgID_AB']#[['gene','guide_type','protospacer_A','protospacer_B','sgID_AB']] 127regular_listc=regular_listc.sort_values()128#regular_listc=regular_listc[set_start:set_end]129non_targeting_listc=listC[listC['gene'].str.contains('non-targeting')]['sgID_AB']#[['gene','guide_type','protospacer_A','protospacer_B','sgID_AB']]130non_targeting_listc=non_targeting_listc.sort_values()131 132#GENERAL FUNCTIONS133def transform(df,str):134    cols = st.multiselect(str, 135    df.columns.tolist(),136    df.columns.tolist()137    )138    df = df[cols]139    return df140 141def convert_df(df):142    return df.to_csv().encode('utf-8')143def convert_df1(df):144    return df.to_csv(index=False).encode('utf-8')145 146#########TABLE DISPLAY147def tbl_disp(dat,var,ref,key,flg=1):148    dat.reset_index(drop=True, inplace=True)149    #df = transform(dft,'Please Select columns to save whole table')150    #fname = st.text_input('Please input file name to save Table', 'temp')151    #fname = st_keyup("Please input file name to save Table", value='temp')152    csv = convert_df(dat)153    if flg==1:154        st.download_button(155            label="Download Full Table as CSV file",156            data=csv,157            file_name=var+'_'+ref+'.csv',#fname+'.csv',158            mime='text/csv',159            #key=key,160        )161    gb = GridOptionsBuilder.from_dataframe(dat)162    gb.configure_pagination(enabled=False)#,paginationAutoPageSize=False)#True) #Add pagination163    gb.configure_default_column(enablePivot=True, enableValue=True, enableRowGroup=True)164    gb.configure_selection(selection_mode="multiple", use_checkbox=True)165    gb.configure_column("gene", headerCheckboxSelection = True)166    gb.configure_side_bar()167    gridOptions = gb.build()    168 169    grid_response = AgGrid(170            dat,171            height=200,172            gridOptions=gridOptions,173            enable_enterprise_modules=True,174            update_mode=GridUpdateMode.MODEL_CHANGED,175            data_return_mode=DataReturnMode.FILTERED_AND_SORTED,176            fit_columns_on_grid_load=False,177            header_checkbox_selection_filtered_only=True,178            use_checkbox=True,179            width='100%'180            #key=key181    )182 183    selected = grid_response['selected_rows']   184    if selected:185        #st.write('Selected rows')186        187        dfs = pd.DataFrame(selected)188        #st.dataframe(dfs[dfs.columns[1:dfs.shape[1]]])189 190        #dfs1 = transform(dfs[dfs.columns[1:dfs.shape[1]]],'Please select columns to save selected Table')191        csv = convert_df1(dfs[dfs.columns[1:dfs.shape[1]]])192        #csv = convert_df1(dfs1)193        194        if flg:195            st.download_button(196                label="Download Selected data as CSV",197                data=csv,198                file_name=var+'_'+ref+'.csv',199                mime='text/csv',200            )201        return dfs202 203def get_lists(ref_list,list_found_ref,list_notfound_ref):204    #This module retrieves guide_id and searches for guide sequences from the table205    #st.table(ref_list)206    a_ref=[] 207    #st.table(ref_list)208    for i in range(len(ref_list)):209        a_ref.append(ref_list.sgID_AB.values[i].split('|')[0])210        a_ref.append(ref_list.sgID_AB.values[i].split('|')[1])211    212    set_found0_ref=[]213    #st.table(a_ref)214    for i in range(len(a_ref)):215        set_found0_ref.append(list_found_ref[list_found_ref['gene']==a_ref[i]])216    #st.write(set_found0_ref)217    list_concatenated_found_ref = pd.concat(set_found0_ref)218    list_concatenated_match_ref = list_concatenated_found_ref[list_concatenated_found_ref.num_mismatch == 0] #only select guides with zero mismatches for match list, MISSMATCH LIST LATER219    #Also remove Alternate loci's data220    list_concatenated_match_ref = list_concatenated_match_ref[list_concatenated_match_ref['chr'].str.contains('chr')]221    #st.table(list_concatenated_match_ref)222    #also create new list with both sgRNAs in one row223    dft=pd.DataFrame(columns=['gene','ref_guide',	'chr',	'position',	'mutated_guide',	'strand',	'num_mismatch'])224    225    guideflg1=1226    #st.table(list_concatenated_match_ref)227    if list_concatenated_match_ref.shape[0]>0:228        guideflg1=0229        t=list_concatenated_match_ref.reset_index(drop=True)230        #st.table(t)231        232        ##########233        #check even/odd entries234        if t.shape[0]==1:235            t1=t.loc[t.index.repeat(2)].reset_index(drop=True)236            #st.write(t1)237            dft=assemble_tbl(t1)238            239        elif t.shape[0]%2==0: #even240            dft=assemble_tbl(t)241 242        else: #odd243            t1 = pd.DataFrame(columns=['gene','ref_guide',	'chr',	'position',	'mutated_guide',	'strand',	'num_mismatch'])244            i=0245            while i <t.shape[0]:246                if i<t.shape[0]-1:247                    if t.iloc[i]['gene'] == t.iloc[i+1]['gene'] and t.iloc[i]['chr'] == t.iloc[i+1]['chr'] and t.iloc[i]['position'] == t.iloc[i+1]['position']:248                        249                        #t1=t1.append(t.iloc[[i]], ignore_index = True)250                        #t1=t1.append(t.iloc[[i+1]], ignore_index = True)251                        t1=pd.concat([t1,t.iloc[[i]]], ignore_index = True)252                        t1=pd.concat([t1,t.iloc[[i]]], ignore_index = True)253 254                        i=i+2255                    else: #repeat entries256                        #t1=t1.append(t.iloc[[i]], ignore_index = True)257                        #t1=t1.append(t.iloc[[i]], ignore_index = True)258                        t1=pd.concat([t1,t.iloc[[i]]], ignore_index = True)259                        t1=pd.concat([t1,t.iloc[[i]]], ignore_index = True)260 261                        #st.table(t1)262                        i=i+1263                else:264                    #t1=t1.append(t.iloc[[i]], ignore_index = True)265                    #t1=t1.append(t.iloc[[i]], ignore_index = True)266                    t1=pd.concat([t1,t.iloc[[i]]], ignore_index = True)267                    t1=pd.concat([t1,t.iloc[[i]]], ignore_index = True)268 269                    i=i+1270                    #st.table(t1)271                    272                    273            dft=assemble_tbl(t1)274    list_concatenated_mutated_ref = list_concatenated_found_ref[list_concatenated_found_ref.num_mismatch > 0]275    list_concatenated_mutated_ref=list_concatenated_mutated_ref.sort_values('position')276    277    #Also remove Alternate loci's data278    279    list_concatenated_mutated_ref = list_concatenated_mutated_ref[list_concatenated_mutated_ref['chr'].str.contains('chr')]280    dft_mut = pd.DataFrame(columns=['sgID_1','sgRNA_1','chr_sgRNA_1','position_sgRNA_1','sgID_2','sgRNA_2','chr_sgRNA_2','position_sgRNA_2', 'sgID_1_2'])281    282    if list_concatenated_mutated_ref.shape[0]>0:        283        dft_mut = get_mutated_res(list_concatenated_mutated_ref)284    #check not found        285    seta_notfound0_ref=list_notfound_ref[list_notfound_ref['gene']==a_ref[0]]286    seta_notfound1_ref=list_notfound_ref[list_notfound_ref['gene']==a_ref[1]]287    list_concatenated_notfound_ref = pd.concat([seta_notfound0_ref,seta_notfound1_ref])288    289    return dft.iloc[:1], dft_mut,list_concatenated_notfound_ref,list_concatenated_match_ref,list_concatenated_mutated_ref,guideflg1290    ###########291def get_mutated_res(list_concatenated_mutated_ref):292    ######### 293    #if list_concatenated_mutated_ref.shape[0]>0:294    t=list_concatenated_mutated_ref.reset_index(drop=True)295    296    #st.table(t)297    dft_mut = pd.DataFrame(columns=['sgID_1','sgRNA_1','chr_sgRNA_1','position_sgRNA_1','sgID_2','sgRNA_2','chr_sgRNA_2','position_sgRNA_2', 'sgID_1_2'])298    c1=['sgID_1','sgRNA_1','chr_sgRNA_1','position_sgRNA_1']299    c2=['sgID_2','sgRNA_2','chr_sgRNA_2','position_sgRNA_2']#, 'sgID_1_2']300    #st.table(listA_concatenated_match_ref)301    #st.write(t.shape[0])302    tf=0303    #for i in range(0,t.shape[0],2):304    for i in range(t.shape[0]):305        l1=t.iloc[[i]]306        l1.columns=['sgID_1','sgRNA_1','chr_sgRNA_1','position_sgRNA_1','mutated_guide',	'strand',	'num_mismatch']307        l2=l1.copy()308        l2.columns=['sgID_2','sgRNA_2','chr_sgRNA_2','position_sgRNA_2','mutated_guide2',	'strand2',	'num_mismatch2']309        list_concatenated_mutated_ref1=[]310        #listA_concatenated_mutated_ref1=pd.concat([l1.reset_index(drop=True),l2.reset_index(drop=True)],axis=1)311        list_concatenated_mutated_ref1=pd.concat([l1.reset_index(drop=True),l2.reset_index(drop=True)],axis=1)312        #st.table(listA_concatenated_mutated_ref1)313        list_concatenated_mutated_ref1=list_concatenated_mutated_ref1[['sgID_1','sgRNA_1','chr_sgRNA_1','position_sgRNA_1','sgID_2','mutated_guide2','chr_sgRNA_2','position_sgRNA_2']]314        #also change if not leading G315        list_concatenated_mutated_ref1['sgRNA_1']='G'+list_concatenated_mutated_ref1['sgRNA_1'].str.slice(1, 20)316        #also change name of mutated_guide2 column317        list_concatenated_mutated_ref1.columns=['sgID_1','sgRNA_1','chr_sgRNA_1','position_sgRNA_1','sgID_2','sgRNA_2','chr_sgRNA_2','position_sgRNA_2']318        319        list_concatenated_mutated_ref1['sgRNA_2']='G'+list_concatenated_mutated_ref1['sgRNA_2'].str.slice(1, 20)320        list_concatenated_mutated_ref1['sgID_1_2']=list_concatenated_mutated_ref1['sgID_1']+"|"+list_concatenated_mutated_ref1['sgID_1']321        #dft_mut=dft_mut.append(list_concatenated_mutated_ref1)322        dft_mut=pd.concat([dft_mut,list_concatenated_mutated_ref1])323        324    return dft_mut325    326def not_found_check(set12,set34,set56,listA_notfound_lr,listB_notfound_lr,listC_notfound_lr):327    flg11=0328    flg12=0329    flg21=0330    flg22=0331    flg31=0332    flg32=0333    #st.write(set12.split('|')[1])334    335    if listA_notfound_lr[listA_notfound_lr['gene']==set12.split('|')[0]].shape[0]>0:336        flg11=1337    if listA_notfound_lr[listA_notfound_lr['gene']==set12.split('|')[1]].shape[0]>0:338        flg12=1339    if listB_notfound_lr[listB_notfound_lr['gene']==set34.split('|')[0]].shape[0]>0:340        flg21=1341    if listB_notfound_lr[listB_notfound_lr['gene']==set34.split('|')[1]].shape[0]>0:342        flg22=1343    if listC_notfound_lr[listC_notfound_lr['gene']==set56.split('|')[0]].shape[0]>0:344        flg31=1345    if listC_notfound_lr[listC_notfound_lr['gene']==set56.split('|')[1]].shape[0]>0:346        flg32=1347    return flg11,flg12,flg21,flg22,flg31,flg32    348 349def order_ready_tbl_CHM13(set12,set34,set56,listA_found_lr,listA_notfound_lr,listB_found_lr,listB_notfound_lr,listC_found_lr,listC_notfound_lr,ref_sel):350    # st.table(set12)351    # st.table(set34)352    # st.table(set56)353    dft_order_table=pd.DataFrame(columns=['gene','guide_type','sgID_1',	'sgRNA_1',	'chr_sgRNA_1',	'position_sgRNA_1',	'sgID_2',	'sgRNA_2',	'chr_sgRNA_2',	'position_sgRNA_2',	'sgID_1_2'])  354    dft_notfound_all=pd.DataFrame(columns=['gene','sgID_AB','guide_type','protospacer_A','protospacer_B'])  355    356    #dft_notfound=pd.DataFrame(columns=['gene','ref_guide'])  357    358    dft_a = pd.DataFrame(columns=['gene','guide_type','protospacer_A','protospacer_B'])    359    dft_b = pd.DataFrame(columns=['gene','guide_type','protospacer_A','protospacer_B'])    360    dft_c = pd.DataFrame(columns=['gene','guide_type','protospacer_A','protospacer_B'])    361    set12=set12.reset_index(drop = True)362    set34=set34.reset_index(drop = True)363    set56=set56.reset_index(drop = True)364    for i in range(set12.shape[0]):365        gene_n=set12[i].split('_')[0]366        f=not_found_check(set12[i],set34[i],set56[i],listA_notfound_lr,listB_notfound_lr,listC_notfound_lr)367        #st.write(f)368        #st.write(set12[i],set34[i],set56[i])369 370        #ref_listA=listA[listA['gene']==variant_set.iloc[i]][['guide_type','protospacer_A','protospacer_B','sgID_AB']]371        ref_listA=listA[listA['sgID_AB']==set12.iloc[i]][['gene','guide_type','protospacer_A','protospacer_B','sgID_AB']]372        ref_listA = ref_listA[['gene','sgID_AB','guide_type','protospacer_A','protospacer_B']]373        #st.write(ref_listA)374        #ref_listA.columns=['gene','guide_type','protospacer_A','protospacer_B']375        resa,res_muta,res_notfounda,list_matcha,list_mutateda,gflga1=get_lists(ref_listA,listA_found_lr,listA_notfound_lr)376        #dft_a=dft_a.append(ref_listA)  377        378        #listb379        ref_listB=listB[listB['sgID_AB']==set34.iloc[i]][['guide_type','protospacer_A','protospacer_B','sgID_AB']]380        ref_listB = ref_listB[['sgID_AB','guide_type','protospacer_A','protospacer_B']]381        382        #ref_listB.columns=['gene','guide_type','protospacer_A','protospacer_B']383        resb,res_mutb,res_notfoundb,list_matchb,list_mutatedb,gflgb1=get_lists(ref_listB,listB_found_lr,listB_notfound_lr)384        #dft_b=dft_b.append(ref_listB) 385        #listc386        ref_listC=listC[listC['sgID_AB']==set56.iloc[i]][['guide_type','protospacer_A','protospacer_B','sgID_AB']]387        ref_listC = ref_listC[['sgID_AB','guide_type','protospacer_A','protospacer_B']]388        389        #ref_listC.columns=['gene','guide_type','protospacer_A','protospacer_B']390        resc,res_mutc,res_notfoundc,list_matchc,list_mutatedc,gflgc1=get_lists(ref_listC,listC_found_lr,listC_notfound_lr)391        #dft_c=dft_c.append(ref_listC)  392        #st.table(ref_listA)393        # st.write(gflga1,gflgb1,gflgc1)394        if gflga1==0:395            #Also verigy that both guides are different396            #st.table(resa)   397            if resa['sgID_1'][0] != resa['sgID_2'][0]:398                resa['gene']=gene_n399                resa['guide_type']='1-2'400                #dft_order_table=dft_order_table.append(resa)401                dft_order_table=pd.concat([dft_order_table, resa]) #dft_order_table.concat(resa)402            else: #it is nutation case, so check next403                if f[2]==0 or f[3] == 0:404                    #st.write('came in 1')405                    if not resb.empty: # and resb['sgID_1'][0] != resb['sgID_2'][0]: #second guide in from setb406                        resa[['sgID_2',	'sgRNA_2',	'chr_sgRNA_2',	'position_sgRNA_2']] = resb[['sgID_1',	'sgRNA_1',	'chr_sgRNA_1',	'position_sgRNA_1']] 407                        resa['sgID_1_2'] = resa['sgID_1']+"|"+resa['sgID_2']408                        if f[2]==0:409                            resa['gene']=gene_n410                            if f[0]==0:411                                resa['guide_type']="1-3"412                            else:413                                resa['guide_type']="2-3"414                            #dft_order_table=dft_order_table.append(resa)415                            dft_order_table=pd.concat([dft_order_table,resa])416                        else: # f[2]==0:417                            resa['gene']=gene_n418                            if f[0]==0:419                                resa['guide_type']="1-4"420                            else:421                                resa['guide_type']="2-4"422                            #dft_order_table=dft_order_table.append(resa)423                            dft_order_table=pd.concat([dft_order_table,resa])424                    else:425                        dft_notfound_all=pd.concat([dft_notfound_all,ref_listA], ignore_index = True)426                        dft_notfound_all=pd.concat([dft_notfound_all,ref_listB], ignore_index = True)427                        dft_notfound_all=pd.concat([dft_notfound_all,ref_listC], ignore_index = True)428                else:429                    dft_notfound_all=pd.concat([dft_notfound_all,ref_listA], ignore_index = True)430                    dft_notfound_all=pd.concat([dft_notfound_all,ref_listB], ignore_index = True)431                    dft_notfound_all=pd.concat([dft_notfound_all,ref_listC], ignore_index = True)432                    433                        434        elif resa.shape[0] >0: #at least one guide is from seta435            #if resa['sgID_1'][0] != resa['sgID_2'][0]:436            if f[2]==0 or f[3] == 0:437                #st.write('came in 1')438                if not resb.empty: # and resb['sgID_1'][0] != resb['sgID_2'][0]: #second guide in from setb439                    resa[['sgID_2',	'sgRNA_2',	'chr_sgRNA_2',	'position_sgRNA_2']] = resb[['sgID_1',	'sgRNA_1',	'chr_sgRNA_1',	'position_sgRNA_1']] 440                    resa['sgID_1_2'] = resa['sgID_1']+"|"+resa['sgID_2']441                    if f[2]==0:442                        resa['gene']=gene_n443                        resa['guide_type']=str(gflga1)+"-3"444                        #dft_order_table=dft_order_table.append(resa)445                        dft_order_table=pd.concat([dft_order_table,resa])446                    else: # f[2]==0:447                        resa['gene']=gene_n448                        resa['guide_type']=str(gflga1)+"-4"449                        #dft_order_table=dft_order_table.append(resa)450                        dft_order_table=pd.concat([dft_order_table,resa])451                else:452                    dft_notfound_all=pd.concat([dft_notfound_all,ref_listA], ignore_index = True)453                    dft_notfound_all=pd.concat([dft_notfound_all,ref_listB], ignore_index = True)454                    dft_notfound_all=pd.concat([dft_notfound_all,ref_listC], ignore_index = True)                   455 456            elif f[4]==0 or f[5] == 0:457                #st.write('came in 2')458                #if resa['sgID_1'][0] != resa['sgID_2'][0]:459                if not resc.empty: # and resc['sgID_1'][0] != resc['sgID_2'][0]: # resc.shape[0]>0: #second guide is from setc460                    resa[['sgID_2',	'sgRNA_2',	'chr_sgRNA_2',	'position_sgRNA_2']] = resc[['sgID_1',	'sgRNA_1',	'chr_sgRNA_1',	'position_sgRNA_1']] 461                    resa['sgID_1_2'] = resa['sgID_1']+"|"+resa['sgID_2']462                    #dft_order_table=dft_order_table.append(resa)463                    if f[4]==0:464                        resa['gene']=gene_n465                        resa['guide_type']=str(gflga1)+"-5"466                        #dft_order_table=dft_order_table.append(resa)467                        dft_order_table=pd.concat([dft_order_table,resa])468                    else: # f[2]==0:469                        resa['gene']=gene_n470                        resa['guide_type']=str(gflga1)+"-6"471                        #dft_order_table=dft_order_table.append(resa)472                        dft_order_table=pd.concat([dft_order_table,resa])473                else:474                    dft_notfound_all=pd.concat([dft_notfound_all,ref_listA], ignore_index = True)475                    dft_notfound_all=pd.concat([dft_notfound_all,ref_listB], ignore_index = True)476                    dft_notfound_all=pd.concat([dft_notfound_all,ref_listC], ignore_index = True)477                    478 479        elif resb.shape[0]>0: #at least one guide480            if gflgb1==0:481                if resb['sgID_1'][0] != resb['sgID_2'][0]:482                    resb['gene']=gene_n483                    resb['guide_type']='3-4'484                    #dft_order_table=dft_order_table.append(resb)485                    dft_order_table=pd.concat([dft_order_table,resb])486                else:487                    dft_notfound_all=pd.concat([dft_notfound_all,ref_listA], ignore_index = True)488                    dft_notfound_all=pd.concat([dft_notfound_all,ref_listB], ignore_index = True)489                    dft_notfound_all=pd.concat([dft_notfound_all,ref_listC], ignore_index = True)490                    491                492            elif f[4]==0 or f[5] == 0:493                #if not resc.empty and resc['sgID_1'][0] != resc['sgID_2'][0]:494                resb[['sgID_2',	'sgRNA_2',	'chr_sgRNA_2',	'position_sgRNA_2']] = resc[['sgID_1',	'sgRNA_1',	'chr_sgRNA_1',	'position_sgRNA_1']] 495                resb['sgID_1_2'] = resb['sgID_1']+"|"+resb['sgID_2']496                #dft_order_table=dft_order_table.append(resb)497                if f[4]==0:498                    resb['gene']=gene_n499                    resb['guide_type']=str(gflgb1+2)+"-5"500                    #dft_order_table=dft_order_table.append(resb)501                    dft_order_table=pd.concat([dft_order_table,resb])502                else: # f[2]==0:503                    resb['gene']=gene_n504                    resb['guide_type']=str(gflgb1+2)+"-6"505                    #dft_order_table=dft_order_table.append(resb)506                    dft_order_table=pd.concat([dft_order_table,resb])507            else:508                dft_notfound_all=pd.concat([dft_notfound_all,ref_listA], ignore_index = True)509                dft_notfound_all=pd.concat([dft_notfound_all,ref_listB], ignore_index = True)510                dft_notfound_all=pd.concat([dft_notfound_all,ref_listC], ignore_index = True)511                512 513        elif resc.shape[0]>0: #at least one guide514            if gflgc1==0:515                if resc['sgID_1'][0] != resc['sgID_2'][0]:516                    resc['gene']=gene_n517                    resc['guide_type']='5-6'518                    #dft_order_table=dft_order_table.append(resc)519                    dft_order_table=pd.concat([dft_order_table,resc])520                else:521                    dft_notfound_all=pd.concat([dft_notfound_all,ref_listA], ignore_index = True)522                    dft_notfound_all=pd.concat([dft_notfound_all,ref_listB], ignore_index = True)523                    dft_notfound_all=pd.concat([dft_notfound_all,ref_listC], ignore_index = True)524            else:525                dft_notfound_all=pd.concat([dft_notfound_all,ref_listA], ignore_index = True)526                dft_notfound_all=pd.concat([dft_notfound_all,ref_listB], ignore_index = True)527                dft_notfound_all=pd.concat([dft_notfound_all,ref_listC], ignore_index = True)528                529 530        else:531            dft_notfound_all=pd.concat([dft_notfound_all,ref_listA], ignore_index = True)532            dft_notfound_all=pd.concat([dft_notfound_all,ref_listB], ignore_index = True)533            dft_notfound_all=pd.concat([dft_notfound_all,ref_listC], ignore_index = True)534 535    536            537    if dft_order_table.shape[0]>0:   538        #check total guides found539        # st.write(str(set12.shape[0]))540        # st.write(str(set34.shape[0]))541        # st.write(str(set56.shape[0]))542        st.write('**Please note that for guides matching to multiple locations (an example is ABCC6), only first pair is returned**')543        szt=set12.shape[0]     544        szf=dft_order_table.shape[0] 545        # st.write(str(dft_order_table.shape[0]))  546        szd=szt-szf547        if szd>0:548            st.write('Order Ready '+ref_sel+' guides List: '+str(szd)+'/'+str(szt)+' **guides were not found**')549            tbl_disp(dft_order_table,'select_genes','SetA_CHM13',5)550        else:551            st.write('Order Ready '+ref_sel+' guides List')552            tbl_disp(dft_order_table,'select_genes','SetA_CHM13',5)553    else:554        st.write('**No guides found in ListA, ListB and ListC**')555    if dft_notfound_all.shape[0]>0:556        st.write('**Guides not found in any lists**')557        tbl_disp(dft_notfound_all,'select_genes','SetA_CHM13',6)558    559def assemble_tbl(t):560    dft = pd.DataFrame(columns=['sgID_1','sgRNA_1','chr_sgRNA_1','position_sgRNA_1','sgID_2','sgRNA_2','chr_sgRNA_2','position_sgRNA_2', 'sgID_1_2'])561    #for i in range(0,t.shape[0],2):562    mid=int(t.shape[0]/2)563    for i in range(int(t.shape[0]/2)):564        l1=t.iloc[[i]]565        l1.columns=['sgID_1','sgRNA_1','chr_sgRNA_1','position_sgRNA_1','mutated_guide',	'strand',	'num_mismatch']566 567        #l2=t.iloc[[i+1]]568        l2=t.iloc[[mid]]569        l2.columns=['sgID_2','sgRNA_2','chr_sgRNA_2','position_sgRNA_2','mutated_guide2',	'strand2',	'num_mismatch2']570        listA_concatenated_match_LR1=pd.concat([l1.reset_index(drop=True),l2.reset_index(drop=True)],axis=1)571        listA_concatenated_match_LR1=listA_concatenated_match_LR1[['sgID_1','sgRNA_1','chr_sgRNA_1','position_sgRNA_1','sgID_2','sgRNA_2','chr_sgRNA_2','position_sgRNA_2']]572        listA_concatenated_match_LR1['sgRNA_1']=listA_concatenated_match_LR1['sgRNA_1'].str.slice(0, 20)573        listA_concatenated_match_LR1['sgRNA_2']=listA_concatenated_match_LR1['sgRNA_2'].str.slice(0, 20)574        listA_concatenated_match_LR1['sgID_1_2']=listA_concatenated_match_LR1['sgID_1']+"|"+listA_concatenated_match_LR1['sgID_2']575        #dft=dft.append(listA_concatenated_match_LR1)576        dft=pd.concat([dft,listA_concatenated_match_LR1])577        578        mid=mid+1579        580    return dft581    582#Get non-targeting lists583def get_lists_non_targeting(ref_list,list_found_ref,list_notfound_ref):584    585    #This module retrieves guide_id and searches for guide sequences from the table586    #st.table(ref_list)587    a_ref=[]  588    for i in range(len(ref_list)):589        a_ref.append(ref_list.sgID_AB.values[i].split('|')[0])590        a_ref.append(ref_list.sgID_AB.values[i].split('|')[1])591 592    set_found0_ref=[]593    for i in range(len(a_ref)):594        set_found0_ref.append(list_found_ref[list_found_ref['gene']==a_ref[i]])595    list_concatenated_found_ref = pd.concat(set_found0_ref)596    list_concatenated_match_ref = list_concatenated_found_ref[list_concatenated_found_ref.num_mismatch == 0] #only select guides with zero mismatches for match list, MISSMATCH LIST LATER597    #get matching to Alternating loci's598    list_concatenated_match_alt_ref = list_concatenated_match_ref[~list_concatenated_match_ref['chr'].str.contains('chr')]599    #Also remove Alternate loci's data600    list_concatenated_match_ref = list_concatenated_match_ref[list_concatenated_match_ref['chr'].str.contains('chr')]601    #st.table(list_concatenated_match_ref)602    #also create new list with both sgRNAs in one row603    dft=pd.DataFrame(columns=['gene','ref_guide',	'chr',	'position',	'mutated_guide',	'strand',	'num_mismatch'])604    if list_concatenated_match_ref.shape[0]>0:605        t=list_concatenated_match_ref.reset_index(drop=True)606        #st.table(t)607        608        ##########609        #check even/odd entries610        if t.shape[0]==1:611            612            t1=t.loc[t.index.repeat(2)].reset_index(drop=True)613            #st.write(t1)614            dft=assemble_tbl(t1)615            616        elif t.shape[0]%2==0: #even617            dft=assemble_tbl(t)618 619        else: #odd620            t1 = pd.DataFrame(columns=['gene','ref_guide',	'chr',	'position',	'mutated_guide',	'strand',	'num_mismatch'])621            i=0622            while i <t.shape[0]:623                if i<t.shape[0]-1:624                    if t.iloc[i]['gene'] == t.iloc[i+1]['gene'] and t.iloc[i]['chr'] == t.iloc[i+1]['chr'] and t.iloc[i]['position'] == t.iloc[i+1]['position']:625                        626                        t1=pd.concat([t1,t.iloc[[i]]], ignore_index = True)627                        t1=pd.concat([t1,t.iloc[[i+1]]], ignore_index = True)628                        i=i+2629                    else: #repeat entries630                        t1=pd.concat([t1,t.iloc[[i]]], ignore_index = True)631                        t1=pd.concat([t1,t.iloc[[i]]], ignore_index = True)632                        #st.table(t1)633                        i=i+1634                else:635                    t1=pd.concat([t1,t.iloc[[i]]], ignore_index = True)636                    t1=pd.concat([t1,t.iloc[[i]]], ignore_index = True)637                    i=i+1638                    #st.table(t1)639                    640                    641            dft=assemble_tbl(t1)642    list_concatenated_mutated_ref = list_concatenated_found_ref[list_concatenated_found_ref.num_mismatch > 0]643    list_concatenated_mutated_ref=list_concatenated_mutated_ref.sort_values('position')644    645    #Also remove Alternate loci's data646    list_concatenated_mutated_alt_ref = list_concatenated_mutated_ref[~list_concatenated_mutated_ref['chr'].str.contains('chr')]647    list_concatenated_mutated_ref = list_concatenated_mutated_ref[list_concatenated_mutated_ref['chr'].str.contains('chr')]648    dft_mut = pd.DataFrame(columns=['sgID_1','sgRNA_1','chr_sgRNA_1','position_sgRNA_1','sgID_2','sgRNA_2','chr_sgRNA_2','position_sgRNA_2', 'sgID_1_2'])649    650    if list_concatenated_mutated_ref.shape[0]>0:        651        dft_mut = get_mutated_res(list_concatenated_mutated_ref)652    #check not found        653    seta_notfound0_ref=list_notfound_ref[list_notfound_ref['gene']==a_ref[0]]654    seta_notfound1_ref=list_notfound_ref[list_notfound_ref['gene']==a_ref[1]]655    #st.write(list_notfound_ref[list_notfound_ref['gene']==a_ref[0]])656    #st.write(seta_notfound0_ref)657    #st.write(seta_notfound1_ref)658    #add guideflg1 to return which guide is found659    guideflg1=0660    if seta_notfound0_ref.shape[0]>0:661        guideflg1=2662    if seta_notfound1_ref.shape[0]>0:663        guideflg1=1664    list_concatenated_notfound_ref = pd.concat([seta_notfound0_ref,seta_notfound1_ref])665    #st.table(a_ref)666    #st.table(seta_notfound1_ref)667    #st.table(dft)668    #st.table(dft_mut)669    return dft, dft_mut,list_concatenated_notfound_ref,list_concatenated_match_ref,list_concatenated_mutated_ref,list_concatenated_match_alt_ref,list_concatenated_mutated_alt_ref,guideflg1670    ###########671#Get All Guides Stats672#def process_all_guides(glist,list,ref_type,guide_type):673def process_all_guides(glist,for_list,f_list,nf_list):674    #st.write(type(glist))675    #st.table(for_list)676    #for_list=for_list.reset_index()677    variant_set=glist['gene']678    dft_c = pd.DataFrame(columns=['gene','guide_type','protospacer_A','protospacer_B'])    679    dft_resc=pd.DataFrame(columns=['sgID_1',	'sgRNA_1',	'chr_sgRNA_1',	'position_sgRNA_1',	'sgID_2',	'sgRNA_2',	'chr_sgRNA_2',	'position_sgRNA_2',	'sgID_1_2'])  680    dft_res_mutc=pd.DataFrame(columns=['sgID_1',	'sgRNA_1',	'chr_sgRNA_1',	'position_sgRNA_1',	'sgID_2',	'sgRNA_2',	'chr_sgRNA_2',	'position_sgRNA_2',	'sgID_1_2'])  681    dft_notfoundc=pd.DataFrame(columns=['gene','ref_guide'])  682    df_matched_guides_ref = pd.DataFrame(columns=['gene','ref_guide',	'chr',	'position',	'mutated_guide',	'strand',	'num_mismatch'])683    df_matched_alt_ref = pd.DataFrame(columns=['gene','ref_guide',	'chr',	'position',	'mutated_guide',	'strand',	'num_mismatch'])684    df_mutated_guides_ref = pd.DataFrame(columns=['gene','ref_guide',	'chr',	'position',	'mutated_guide',	'strand',	'num_mismatch'])685    df_mutated_guides_alt_ref = pd.DataFrame(columns=['gene','ref_guide',	'chr',	'position',	'mutated_guide',	'strand',	'num_mismatch'])686 687 688    #st.table(for_list)689    for i in range(variant_set.shape[0]):690        #st.write(variant_set.iloc[i])691        ref_listC=for_list[for_list['sgID_AB']==variant_set.iloc[i]][['guide_type','protospacer_A','protospacer_B','sgID_AB']]692        ref_listC =ref_listC[['sgID_AB','guide_type','protospacer_A','protospacer_B']]693        #st.table(ref_listC)694        #st.table(ref_listC)695            696        res,res_mut,res_notfound,list_match,list_mutated,list_match_alt,list_mutated_alt,gflgc1=get_lists_non_targeting(ref_listC,f_list,nf_list)697        698        699        #dft_c=dft_c.append(ref_listC)  700        if res.shape[0]>0:  701            dft_resc=pd.concat([dft_resc,res])702        if res_mut.shape[0]>0:703            dft_res_mutc=pd.concat([dft_res_mutc,res_mut])704        if res_notfound.shape[0]>0:    705            dft_notfoundc= pd.concat([dft_notfoundc,res_notfound])706        if list_match.shape[0]>0:    707            df_matched_guides_ref= pd.concat([df_matched_guides_ref,list_match])708        if list_mutated.shape[0]>0:    709            df_mutated_guides_ref= pd.concat([df_mutated_guides_ref,list_mutated])710        if list_match_alt.shape[0]>0:    711            df_matched_alt_ref=pd.concat([df_matched_alt_ref,list_mutated])712        if list_mutated_alt.shape[0]>0:                713            df_mutated_guides_alt_ref=pd.concat([df_mutated_guides_alt_ref,list_mutated_alt])714 715    if df_matched_guides_ref.shape[0]>0:716        #st.write(type(df_matched_guides_ref['gene']))717        gl=df_matched_guides_ref['gene']718        dupesm=gl[gl.duplicated()]719    if df_mutated_guides_ref.shape[0]>0:720        gl=df_mutated_guides_ref['gene']721        dupesmu=gl[gl.duplicated()]722    #now check common between matched and mutated723    # if dupesm.shape[0]>0 and dupesmu.shape[0]>0:724    #     common_list = set(dupesm).intersection(dupesmu)    725    #     st.table(common_list)    726    #     st.write('common guides between matched and mutated lists are: '+len(common_list))727        728            729    if df_matched_guides_ref.shape[0]>0:730        if dupesm.shape[0]>0:731            st.write('**Matched Guides**: '+str(df_matched_guides_ref.shape[0])+' and: '+str(dupesm.shape[0])+' are repeated guides (matched to multiple locations)')732            tbl_disp(df_matched_guides_ref,'select_genes','SetC_GRCh38',17)733            #st.table(dupesm,'select_genes','SetC_GRCh38',17)734            tbl_disp(dupesm,'select_genes','SetC_GRCh38',17)735        else:736            st.write('**Matched Guides**: '+str(df_matched_guides_ref.shape[0]))737            tbl_disp(df_matched_guides_ref,'select_genes','SetC_GRCh38',17)738            739    if df_matched_alt_ref.shape[0]>0:740        st.write('**Matched Guides to Alt Loci**: '+str(df_matched_alt_ref.shape[0]))741        tbl_disp(df_matched_alt_ref,'select_genes','SetC_GRCh38',17)742    if df_mutated_guides_ref.shape[0]>0:743        #gl=df_mutated_guides_ref['gene']744        #dupesmu=gl[gl.duplicated()]745        if dupesmu.shape[0]>0:746            st.write('**Mutated Guides (some might have >1 guides)**: '+str(df_mutated_guides_ref.shape[0])+' and: '+str(dupesmu.shape[0])+' are repeated guides')747            tbl_disp(df_mutated_guides_ref,'select_genes','SetC_GRCh38',18)748            #st.table(dupesmu)749        else:750            st.write('**Mutated Guides (some might have >1 guides)**: '+str(df_mutated_guides_ref.shape[0]))751            tbl_disp(df_mutated_guides_ref,'select_genes','SetC_GRCh38',18)752            753    if df_mutated_guides_alt_ref.shape[0]>0:754        st.write('**Mutated Guides to Alt Loci**: '+str(df_mutated_guides_alt_ref.shape[0]))755        tbl_disp(df_mutated_guides_alt_ref,'select_genes','SetC_GRCh38',18)756 757    if dft_notfoundc.shape[0]>0:758        st.write('**Guides Not Found**: '+str(dft_notfoundc.shape[0]))759        tbl_disp(dft_notfoundc,'select_genes','SetC_GRCh38',19)760        761#CALC BASED ON LIST, GUIDE TYPE AND REFERENCE 762 763#END GENERAL FUNCTIONS764 765 766st.title('Long Read Guides Search')767st.write('**Important:** Please note that **MTMR3** is not present in guides_c list, so we have **removed it from list a and list b**')768#tbl_disp(regulara,'variant','ref_guides',0,1)  769 770 771Calc = st.sidebar.radio(772    "",773    ('ReadME', 'Single/Multiple Guides','All','Not_Found'))774 775if Calc == 'ReadME':776    expander = st.expander("How to use this app")   777    #st.header('How to use this app')778    expander.markdown('Please select **Single Gene** OR **Multiple Genes** Menue checkbox from the sidebar')779    expander.markdown('Select a Gene (from genes dropdown list) OR Multiple genes (from table)')780    expander.markdown('A table showing all reference gudies from three LISTS will appear in the main panel. **Please not some of the genes (for example A1BG and GJB7) have multiple guide pairs and all of these are selected.**')781    expander.markdown('To see results for each of the selected reference guide from ListA, ListB and ListC, Please select respective checkbox')782    expander.markdown('Results are shown as two tables, **Matched** and **Mutated** guides tables and **NOT FOUND** table if guides are not found in GRCh38 and LR reference fasta files')783    expander.markdown('**Mutated** guides table shows the genomic postion in GRCh38 and LR Fasta file along other fields. **If a guide is found in GRCh38 but not in LR fasta, then corresponding columns will be NA**')784    expander.markdown('**Mutated** guides table shows the genomic postion in GRCh38 and LR Fasta file along other fields. **If a guide is found in GRCh38 but not in LR fasta, then corresponding columns will be NA**')785    786    expander1 = st.expander('Introduction')787    788    expander1.markdown(789        """ This app helps navigate all probable genomic **miss-matched/Mutations (upto 2 bp)** for a given sgRNA (from 3 lists of CRISPRi dual sgRNA libraries) in GRCh38 reference fasta and a Reference fasta generated from BAM generated against KOLF2.1J longread data.790            """791            )792    expander1.markdown('Merged bam file was converted to fasta file using following steps:')793    expander1.markdown('- samtools mpileup to generate bcf file')794    expander1.markdown('- bcftools to generate vcf file')795    expander1.markdown('- bcftools consensus to generate fasta file')796    expander1.markdown('A GPU based [Cas-OFFinder](http://www.rgenome.net/cas-offinder/) tool was used to find off-target sequences (upto 2 miss-matched) for each geiven reference guide against GRCh38 and LR fasta references.')797     798elif Calc=='Single/Multiple Guides':799    flg_a_fount=0800    flg_b_fount=0801    flg_c_fount=0802    #st.write('**General Stats:**')803    #st.write('**GRCh38 Stats: Guides Found: **'+str(lsita_ref_found_sz)+"/"+str(lista_sz))804    with st.form(key='columns_in_form'):805        c2, c3 = st.columns(2)806        with c2:807            multi_genes = st.multiselect(808            'Please select genes list to start processing',809            variants_s)810        Updated=st.form_submit_button(label = 'Update')811    listA_concatenated_orig = pd.DataFrame(columns=['gene','sgID_AB','guide_type','protospacer_A','protospacer_B'])    812    reflistA_concatenated = pd.DataFrame(columns=['gene','sgID_AB','guide_type','protospacer_A','protospacer_B'])    813    reflistB_concatenated = pd.DataFrame(columns=['gene','sgID_AB','guide_type','protospacer_A','protospacer_B'])    814    reflistC_concatenated = pd.DataFrame(columns=['gene','sgID_AB','guide_type','protospacer_A','protospacer_B'])    815    for variant in multi_genes:816        ref_listA=listA[listA['gene']==variant][['gene','guide_type','protospacer_A','protospacer_B','sgID_AB']]817        ref_listA = ref_listA[['gene','sgID_AB','guide_type','protospacer_A','protospacer_B']]818        #ref_listA.columns=['gene','guide_type','protospacer_A','protospacer_B']819        reflistA_concatenated=pd.concat([reflistA_concatenated,ref_listA])820            821        ref_listB=listB[listB['gene']==variant][['gene','guide_type','protospacer_A','protospacer_B','sgID_AB']]822        ref_listB = ref_listB[['gene','sgID_AB','guide_type','protospacer_A','protospacer_B']]823        #ref_listB.columns=['gene','guide_type','protospacer_A','protospacer_B']824        reflistB_concatenated=pd.concat([reflistB_concatenated,ref_listB])825        826        ref_listC=listC[listC['gene']==variant][['gene','guide_type','protospacer_A','protospacer_B','sgID_AB']]827        ref_listC = ref_listC[['gene','sgID_AB','guide_type','protospacer_A','protospacer_B']]828        #ref_listC.columns=['gene','guide_type','protospacer_A','protospacer_B']829        reflistC_concatenated=pd.concat([reflistC_concatenated,ref_listC])830        listA_concatenated_orig = pd.concat([listA_concatenated_orig,ref_listA,ref_listB,ref_listC])831    832    if listA_concatenated_orig.shape[0] > 0:833        834        #st.markdown(table_edit,unsafe_allow_html=True)835        st.write('**Input** Guides (all 6 from 3 sets).')836        st.write('**Please Select Guides common to ALL 3 Lists to procede further Processing**')837        st.markdown(caution_genes,unsafe_allow_html=True)838 839        with st.form(key='columns_in_form_a'):840            c2, c3 = st.columns([10,2])841            with c2:842                get_table_order=tbl_disp(listA_concatenated_orig,'variant','ref_guides',111,0)  843            with c3:844                ref_sel = st.radio("Select Reference",845                            ('CHM13','GRCh38'),846                            horizontal=True) 847                848            Updated1=st.form_submit_button(label = 'Generate Order Ready Table')849        if not isinstance(get_table_order, type(None)): #  and Updated1:# and get_table_order.shape[0]>0:850            if ref_sel=='GRCh38':851                852                list_founda=listA_found_ref853                list_notfounda=listA_notfound_ref854                list_foundb=listB_found_ref855                list_notfoundb=listB_notfound_ref856                list_foundc=listC_found_ref857                list_notfoundc=listC_notfound_ref858 859            else:860                list_founda=listA_found_lr861                list_notfounda=listA_notfound_lr862                list_foundb=listB_found_lr863                list_notfoundb=listB_notfound_lr864                list_foundc=listC_found_lr865                list_notfoundc=listC_notfound_lr866 867                868            variant_set12=get_table_order[get_table_order['guide_type']=='1-2']['sgID_AB']869            variant_set34=get_table_order[get_table_order['guide_type']=='3-4']['sgID_AB']870            variant_set56=get_table_order[get_table_order['guide_type']=='5-6']['sgID_AB']871            #st.table(variant_set12)872            #st.write(variant_set12)873            if variant_set12.shape[0]==variant_set34.shape[0]==variant_set56.shape[0]:874                #########Here we call order ready table875                #order_ready_tbl_GRCh38(variant_set12,variant_set34,variant_set56)876                #order_ready_tbl_CHM13(variant_set12,variant_set34,variant_set56,listA_found_lr,listA_notfound_lr,listB_found_lr,listB_notfound_lr,listC_found_lr,listC_notfound_lr)877                order_ready_tbl_CHM13(variant_set12,variant_set34,variant_set56,list_founda,list_notfounda,list_foundb,list_notfoundb,list_foundc,list_notfoundc,ref_sel)878                ########END ORDER READY TABLE879                880 881            elif variant_set12.shape[0]!=variant_set34.shape[0]:882                st.markdown("""**<span style='color:red'>SetA and SetB</span> guides are not same, Please correct the problem and re-run**""",unsafe_allow_html=True)883            elif variant_set12.shape[0]!=variant_set56.shape[0]:884                st.markdown("""**<span style='color:red'>SetA and SetC</span> guides are not same, Please correct the problem and re-run**""",unsafe_allow_html=True)885            elif variant_set34.shape[0]!=variant_set56.shape[0]:886                st.markdown("""**<span style='color:red'>SetB and SetC</span> guides are not same, Please correct the problem and re-run**""",unsafe_allow_html=True)887 888            else:889                st.markdown("""**<span style='color:red'>Probably Mixed guides are selected from three lists, Please correct the problem and re-run</span>**""",unsafe_allow_html=True)890    else:891        st.write('**Please select guides and Press Update Button to Begin Processing**')892 893    if 'get_table_order' in locals():    894        if not isinstance(get_table_order, type(None)):895            st.write('**For List wise results, Please select a List**')896            reflistA_concatenated=get_table_order[get_table_order['guide_type']=='1-2']897            reflistA_concatenated.drop("_selectedRowNodeInfo",axis=1,inplace=True)898            reflistB_concatenated=get_table_order[get_table_order['guide_type']=='3-4']899            reflistB_concatenated.drop("_selectedRowNodeInfo",axis=1,inplace=True)900            reflistC_concatenated=get_table_order[get_table_order['guide_type']=='5-6']901            reflistC_concatenated.drop("_selectedRowNodeInfo",axis=1,inplace=True)902 903            #st.write('**Important:** If a guides is **not** in **found, mutated and not_found list (such as GSTT1), then it is found in Alternative Loci and Removed**')904            with st.form(key='columns_in_form_lists'):905                c2, c3= st.columns([10,1])#([10,10])906                with c2:907                    List_Selected = st.selectbox('Please select list',908                    ('','ListA','ListB','ListC'))909                Show_ListResults=st.form_submit_button(label = 'GO')910            911            #ListARes = st.checkbox('Results For SetA',key=300)  912            if List_Selected=='ListA':# and not isinstance(get_table, type(None)):#get_table!=None:  913                ref_list= listA914                st.write('**Please select Guides From Table Below  to processes from ListA**')915                with st.form(key='columns_in_form_listsA'):916                    c2, c3= st.columns([100,2])#([10,10])917                    with c2:918                        get_table=tbl_disp(reflistA_concatenated,variant,'ref_guides',2,0)     919                        #List_Selected = st.selectbox('Please select list',920                        #('ListA','ListB','ListC'))921                    Show_ListResults=st.form_submit_button(label = 'Show ListA Results')922            923                #st.write('**Please select Guides From Table Below  to processes from ListA**')924                #get_table=tbl_disp(reflistA_concatenated,variant,'ref_guides',2,0)     925                if not isinstance(get_table, type(None)):  926                    if ref_sel=='GRCh38':927                        list_found=listA_found_ref928                        list_notfound=listA_notfound_ref929                    else:930                       931                        list_found=listA_found_lr932                        list_notfound=listA_notfound_lr933 934                    variant_set=get_table['sgID_AB']  935                    dft_a = pd.DataFrame(columns=['gene','guide_type','protospacer_A','protospacer_B'])    936                    dft_resa=pd.DataFrame(columns=['sgID_1',	'sgRNA_1',	'chr_sgRNA_1',	'position_sgRNA_1',	'sgID_2',	'sgRNA_2',	'chr_sgRNA_2',	'position_sgRNA_2',	'sgID_1_2'])  937                    dft_res_muta=pd.DataFrame(columns=['sgID_1',	'sgRNA_1',	'chr_sgRNA_1',	'position_sgRNA_1',	'sgID_2',	'sgRNA_2',	'chr_sgRNA_2',	'position_sgRNA_2',	'sgID_1_2'])  938                    dft_notfounda=pd.DataFrame(columns=['gene','ref_guide'])  939                    df_matched_guides_ref = pd.DataFrame(columns=['gene','ref_guide',	'chr',	'position',	'mutated_guide',	'strand',	'num_mismatch'])940                    df_mutated_guides_ref = pd.DataFrame(columns=['gene','ref_guide',	'chr',	'position',	'mutated_guide',	'strand',	'num_mismatch'])941                    #CHECK FOR GRCh38942                    for i in range(variant_set.shape[0]):943                        #ref_listA=listA[listA['sgID_AB']==variant_set.iloc[i]['gene']][['guide_type','protospacer_A','protospacer_B','sgID_AB']]944                        ref_listA=ref_list[ref_list['sgID_AB']==variant_set.iloc[i]][['guide_type','protospacer_A','protospacer_B','sgID_AB']]945                        ref_listA = ref_listA[['sgID_AB','guide_type','protospacer_A','protospacer_B']]946                        947                        #ref_listA.columns=['gene','guide_type','protospacer_A','protospacer_B']948                        #st.table(ref_listA)949                        res,res_mut,res_notfound,list_match,list_mutated,gflga1=get_lists(ref_listA,list_found,list_notfound)950                        #dft_a=dft_a.append(ref_listA)  951                        if res.shape[0]>0:952                            dft_resa=pd.concat([dft_resa,res])953                        if res_mut.shape[0]>0:954                            dft_res_muta=pd.concat([dft_res_muta,res_mut])955                        if res_notfound.shape[0]>0:    956                            dft_notfounda= pd.concat([dft_notfounda,res_notfound])957                        if list_match.shape[0]>0:    958                            df_matched_guides_ref= pd.concat([df_matched_guides_ref,list_match])959                        if list_mutated.shape[0]>0:    960                            df_mutated_guides_ref= pd.concat([df_mutated_guides_ref,list_mutated])961                    962                    #st.write('Selected Reference Guides for **Set A**')963                    #tbl_disp(dft_a,'All','ReferenceGuides',0)964                    st.write('**Important:** If a guides is **not** in **found, mutated and not_found list (such as GSTT1), then it is found in Alternative Loci and Removed**')965                    if dft_resa.shape[0]>0:966                        st.write('Matched to '+ref_sel+' Reference Guides for **Set A**')967                        tbl_disp(dft_resa,'select_genes','SetA_GRCh38',3)968                    elif dft_res_muta.shape[0]>0:969                        st.write('None of the guides Matched, So reporting **Mutated to** '+ref_sel+' Reference Guides for **Set A**')970                        st.markdown(caution1,unsafe_allow_html=True)971                        tbl_disp(dft_res_muta,'select_genes','SetA_Mutated_GRCh38',4)972                    if dft_notfounda.shape[0]>0:973                        st.write('**SetA Guides Not Found in '+ref_sel+' (None of the guides are Matched/Mutated)**')974                        #tbl_disp(dft_notfound,'select_genes','SetA_Notfound_GRCh38')975                        st.table(dft_notfounda)976 977            #ListBRes = st.checkbox('Results For SetB',key=40)  978            if List_Selected=='ListB': # and not isinstance(get_table, type(None)):#get_table!=None:  979                ref_list= listB980                st.write('**Please select Guides From Table Below to processes from ListB**')  981                with st.form(key='columns_in_form_listsA'):982                    c2, c3= st.columns([100,2])#([10,10])983                    with c2:984                        get_table=tbl_disp(reflistB_concatenated,variant,'ref_guides',2,0)     985                    Show_ListResults=st.form_submit_button(label = 'Show ListB Results')986                if not isinstance(get_table, type(None)):    987                    if ref_sel=='GRCh38':988                        989                        list_found=listB_found_ref990                        list_notfound=listB_notfound_ref991                    else:992                       993                        list_found=listB_found_lr994                        list_notfound=listB_notfound_lr995                    996                    #variant_set=get_table[['gene']]  997                    variant_set=get_table['sgID_AB']998                    dft_b = pd.DataFrame(columns=['gene','guide_type','protospacer_A','protospacer_B'])    999                    dft_resb=pd.DataFrame(columns=['sgID_1',	'sgRNA_1',	'chr_sgRNA_1',	'position_sgRNA_1',	'sgID_2',	'sgRNA_2',	'chr_sgRNA_2',	'position_sgRNA_2',	'sgID_1_2'])  1000                    dft_res_mutb=pd.DataFrame(columns=['sgID_1',	'sgRNA_1',	'chr_sgRNA_1',	'position_sgRNA_1',	'sgID_2',	'sgRNA_2',	'chr_sgRNA_2',	'position_sgRNA_2',	'sgID_1_2'])  1001                    dft_notfoundb=pd.DataFrame(columns=['gene','ref_guide'])  1002                    df_matched_guides_ref = pd.DataFrame(columns=['gene','ref_guide',	'chr',	'position',	'mutated_guide',	'strand',	'num_mismatch'])1003                    df_mutated_guides_ref = pd.DataFrame(columns=['gene','ref_guide',	'chr',	'position',	'mutated_guide',	'strand',	'num_mismatch'])1004                    #CHECK FOR GRCh381005                    for i in range(variant_set.shape[0]):1006                        #ref_listB=listB[listB['gene']==variant_set.iloc[i]['gene']][['guide_type','protospacer_A','protospacer_B','sgID_AB']]1007                        ref_listB=ref_list[ref_list['sgID_AB']==variant_set.iloc[i]][['guide_type','protospacer_A','protospacer_B','sgID_AB']]1008                        ref_listB =ref_listB[['sgID_AB','guide_type','protospacer_A','protospacer_B']]1009                        1010                        #ref_listB.columns=['gene','guide_type','protospacer_A','protospacer_B']1011                        res,res_mut,res_notfound,list_match,list_mutated,gflgb1=get_lists(ref_listB,list_found,list_notfound)1012                        #dft_b=dft_b.append(ref_listB)  1013                        if res.shape[0]>0:1014                            dft_resb=pd.concat([dft_resb,res])1015                        if res_mut.shape[0]>0:1016                            dft_res_mutb=pd.concat([dft_res_mutb,res_mut])1017                        if res_notfound.shape[0]>0:    1018                            dft_notfoundb= pd.concat([dft_notfoundb,res_notfound])1019                        if list_match.shape[0]>0:    1020                            df_matched_guides_ref= pd.concat([df_matched_guides_ref,list_match])1021                        if list_mutated.shape[0]>0:    1022                            df_mutated_guides_ref= pd.concat([df_mutated_guides_ref,list_mutated])1023                    1024                    #st.write('Selected Reference Guides for **Set B**')1025                    #tbl_disp(dft_b,'All','ReferenceGuides',0)1026                    st.write('**Important:** If a guides is **not** in **found, mutated and not_found list (such as GSTT1), then it is found in Alternative Loci and Removed**')1027                    if dft_resb.shape[0]>0:1028                        st.write('Matched to '+ref_sel+' Reference Guides for **Set B**')1029                        tbl_disp(dft_resb,'select_genes','SetB_GRCh38',10)1030                    elif dft_res_mutb.shape[0]>0:1031                        st.write('None of the guides Matched, So reporting **Mutated to '+ref_sel+' Reference Guides for **Set B**')1032                        st.markdown(caution1,unsafe_allow_html=True)1033                        tbl_disp(dft_res_mutb,'select_genes','SetB_Mutated_GRCh38',11)1034                    if dft_notfoundb.shape[0]>0:1035                        st.write('**SetB Guides Not Found in '+ref_sel+' (None of the guides are Matched/Mutated)**')1036                        #tbl_disp(dft_notfound,'select_genes','SetA_Notfound_GRCh38')1037                        st.table(dft_notfoundb)1038                        1039                        1040                    1041            #ListCRes = st.checkbox('Results For SetC',key=50)  1042            if List_Selected=='ListC': # and not isinstance(get_table, type(None)):#get_table!=None: 1043                ref_list= listC1044                1045                st.write('**Please select Guides From Table Below to processes from ListC**')  1046                with st.form(key='columns_in_form_listsA'):1047                    c2, c3= st.columns([100,2])#([10,10])1048                    with c2:1049                        get_table=tbl_disp(reflistC_concatenated,variant,'ref_guides',2,0)     1050                    Show_ListResults=st.form_submit_button(label = 'Show ListC Results')1051                if not isinstance(get_table, type(None)):    1052                    if ref_sel=='GRCh38':1053                        1054                        list_found=listC_found_ref1055                        list_notfound=listC_notfound_ref1056                    else:1057                       1058                        list_found=listC_found_lr1059                        list_notfound=listC_notfound_lr1060                    variant_set=get_table['sgID_AB']1061                    dft_c = pd.DataFrame(columns=['gene','guide_type','protospacer_A','protospacer_B'])    1062                    dft_resc=pd.DataFrame(columns=['sgID_1',	'sgRNA_1',	'chr_sgRNA_1',	'position_sgRNA_1',	'sgID_2',	'sgRNA_2',	'chr_sgRNA_2',	'position_sgRNA_2',	'sgID_1_2'])  1063                    dft_res_mutc=pd.DataFrame(columns=['sgID_1',	'sgRNA_1',	'chr_sgRNA_1',	'position_sgRNA_1',	'sgID_2',	'sgRNA_2',	'chr_sgRNA_2',	'position_sgRNA_2',	'sgID_1_2'])  1064                    dft_notfoundc=pd.DataFrame(columns=['gene','ref_guide'])  1065                    df_matched_guides_ref = pd.DataFrame(columns=['gene','ref_guide',	'chr',	'position',	'mutated_guide',	'strand',	'num_mismatch'])1066                    df_mutated_guides_ref = pd.DataFrame(columns=['gene','ref_guide',	'chr',	'position',	'mutated_guide',	'strand',	'num_mismatch'])1067                    #CHECK FOR GRCh381068                    for i in range(variant_set.shape[0]):1069                        #ref_listC=listC[listC['gene']==variant_set.iloc[i]['gene']][['guide_type','protospacer_A','protospacer_B','sgID_AB']]1070                        ref_listC=ref_list[ref_list['sgID_AB']==variant_set.iloc[i]][['guide_type','protospacer_A','protospacer_B','sgID_AB']]1071                        ref_listC =ref_listC[['sgID_AB','guide_type','protospacer_A','protospacer_B']]1072                        1073                        #ref_listC.columns=['gene','guide_type','protospacer_A','protospacer_B']1074                        res,res_mut,res_notfound,list_match,list_mutated,gflgc1=get_lists(ref_listC,list_found,list_notfound)1075                        #dft_c=dft_c.append(ref_listC)  1076                        if res.shape[0]>0:1077                            dft_resc=pd.concat([dft_resc,res])1078                        if res_mut.shape[0]>0:1079                            dft_res_mutc=pd.concat([dft_res_mutc,res_mut])1080                        if res_notfound.shape[0]>0:    1081                            dft_notfoundc= pd.concat([dft_notfoundc,res_notfound])1082                        if list_match.shape[0]>0:    1083                            df_matched_guides_ref= pd.concat([df_matched_guides_ref,list_match])1084                        if list_mutated.shape[0]>0:    1085                            df_mutated_guides_ref= pd.concat([df_mutated_guides_ref,list_mutated])1086                    1087                    #st.write('Selected Reference Guides for **Set C**')1088                    #tbl_disp(dft_c,'All','ReferenceGuides',0)1089                    st.write('**Important:** If a guides is **not** in **found, mutated and not_found list (such as GSTT1), then it is found in Alternative Loci and Removed**')1090                    if dft_resc.shape[0]>0:1091                        st.write('Matched to '+ref_sel+' Reference Guides for **Set C**')1092                        tbl_disp(dft_resc,'select_genes','SetC_GRCh38',17)1093                    elif dft_res_mutc.shape[0]>0:1094                        st.write('None of the guides Matched, So reporting **Mutated to '+ref_sel+' Reference Guides for **Set C**')1095                        st.markdown(caution1,unsafe_allow_html=True)1096                        tbl_disp(dft_res_mutc,'select_genes','SetC_Mutated_GRCh38',18)1097                    if dft_notfoundc.shape[0]>0:1098                        st.write('**SetC Guides Not Found in '+ref_sel+' (None of the guides are Matched/Mutated)**')1099                        #tbl_disp(dft_notfound,'select_genes','SetA_Notfound_GRCh38')1100                        st.table(dft_notfoundc)1101                        1102 1103elif Calc=='Not_Found':1104    ListAResNotFound = st.checkbox('Results For SetA',key=30)  1105    if ListAResNotFound and listA_notfound_lr.shape[0]>0:1106        listA_notfound_LR_sorted=listA_notfound_lr.sort_values('gene')1107        sz1a=listA_notfound_LR_sorted.shape[0]1108        vaild_guides_a = listA_notfound_LR_sorted[~listA_notfound_LR_sorted['gene'].str.contains("non")]1109        1110        1111        sz2a=vaild_guides_a.shape[0]1112        st.write(str(sz2a)+"/"+str(sz1a)+' Guides Not Found')1113        tbl_disp(vaild_guides_a,'all_not_found','SetA_KOLF2.1',23,0)1114 1115        #now get gene names only1116        genesa=vaild_guides_a['gene'].str.split('_').str[0]1117        genesa1=genesa[genesa.duplicated(keep=False)]1118        genesa2=genesa1.unique()1119        pair_lista=[]1120        for g in genesa2:1121            g1=vaild_guides_a[vaild_guides_a['gene'].str.contains(g)]1122            g2=g1.reset_index(drop=True)1123            pair_lista.append([g2.gene[0],g2.ref_guide[0],g2.gene[1],g2.ref_guide[1]])1124        pair_missmatch_a = pd.DataFrame(pair_lista, columns=['sgID_1','sgRNA_1','sgID_2','sgRNA_2'])1125        sz22a=pair_missmatch_a.shape[0]1126        st.write(str(sz22a)+"/"+str(sz2a)+' Paired Guides Not Found')1127        tbl_disp(pair_missmatch_a,'all_not_found','SetA_KOLF2.1',23,0)1128 1129 1130 1131        non_targeting_guides_a = listA_notfound_LR_sorted[listA_notfound_LR_sorted['gene'].str.contains("non")]1132        sz3a=non_targeting_guides_a.shape[0]1133        st.write(str(sz3a)+"/"+str(sz1a)+' no-targeting Guides Not Found')1134        tbl_disp(non_targeting_guides_a,'all_not_found','SetA_KOLF2.1',23,0)1135 1136    ListBResNotFound = st.checkbox('Results For SetB',key=40)  1137    if ListBResNotFound:1138        listB_notfound_LR_sorted=listB_notfound_lr.sort_values('gene')1139        sz1b=listB_notfound_LR_sorted.shape[0]1140        vaild_guides_b = listB_notfound_LR_sorted[~listB_notfound_LR_sorted['gene'].str.contains("non")]1141        sz2b=vaild_guides_b.shape[0]1142        st.write(str(sz2b)+"/"+str(sz1b)+' Guides Not Found')1143        tbl_disp(vaild_guides_b,'all_not_found','SetA_KOLF2.1',23,0)1144        1145        #now get gene names only1146        genesb=vaild_guides_b['gene'].str.split('_').str[0]1147        genesb1=genesb[genesb.duplicated(keep=False)]1148        genesb2=genesb1.unique()1149        pair_listb=[]1150        for g in genesb2:1151            g1=vaild_guides_b[vaild_guides_b['gene'].str.contains(g)]1152            g2=g1.reset_index(drop=True)1153            pair_listb.append([g2.gene[0],g2.ref_guide[0],g2.gene[1],g2.ref_guide[1]])1154        pair_missmatch_b = pd.DataFrame(pair_listb, columns=['sgID_1','sgRNA_1','sgID_2','sgRNA_2'])1155        sz22b=pair_missmatch_b.shape[0]1156        st.write(str(sz22b)+"/"+str(sz2b)+' Paired Guides Not Found')1157        tbl_disp(pair_missmatch_b,'all_not_found','SetA_KOLF2.1',23,0)1158        1159        1160        non_targeting_guides_b = listB_notfound_LR_sorted[listB_notfound_LR_sorted['gene'].str.contains("non")]1161        sz3b=non_targeting_guides_b.shape[0]1162        st.write(str(sz3b)+"/"+str(sz1b)+' no-targeting Guides Not Found')1163        tbl_disp(non_targeting_guides_b,'all_not_found','SetA_KOLF2.1',23,0)1164    ListCResNotFound = st.checkbox('Results For SetC',key=50)  1165    if ListCResNotFound:1166        listC_notfound_LR_sorted=listC_notfound_lr.sort_values('gene')1167        sz1c=listC_notfound_LR_sorted.shape[0]1168        vaild_guides_c = listC_notfound_LR_sorted[~listC_notfound_LR_sorted['gene'].str.contains("non")]1169        sz2c=vaild_guides_c.shape[0]1170        st.write(str(sz2c)+"/"+str(sz1c)+' Guides Not Found')1171        tbl_disp(vaild_guides_c,'all_not_found','SetA_KOLF2.1',23,0)1172        1173        #now get gene names only1174        genesc=vaild_guides_c['gene'].str.split('_').str[0]1175        genesc1=genesc[genesc.duplicated(keep=False)]1176        genesc2=genesc1.unique()1177        pair_listc=[]1178        for g in genesc2:1179            g1=vaild_guides_c[vaild_guides_c['gene'].str.contains(g)]1180            g2=g1.reset_index(drop=True)1181            pair_listc.append([g2.gene[0],g2.ref_guide[0],g2.gene[1],g2.ref_guide[1]])1182        pair_missmatch_c = pd.DataFrame(pair_listc, columns=['sgID_1','sgRNA_1','sgID_2','sgRNA_2'])1183        sz22c=pair_missmatch_c.shape[0]1184        st.write(str(sz22c)+"/"+str(sz2c)+' Paired Guides Not Found')1185        tbl_disp(pair_missmatch_c,'all_not_found','SetA_KOLF2.1',23,0)1186        1187        1188        non_targeting_guides_c = listC_notfound_LR_sorted[listC_notfound_LR_sorted['gene'].str.contains("non")]1189        sz3c=non_targeting_guides_c.shape[0]1190        st.write(str(sz3c)+"/"+str(sz1c)+' no-targeting Guides Not Found')1191        tbl_disp(non_targeting_guides_c,'all_not_found','SetA_KOLF2.1',23,0)1192 1193else:1194    guidetype = st.radio("Select Guide Type",('Non-targetting','Regular'),horizontal=True) 1195    if guidetype=='Non-targetting':1196        with st.form(key='columns_in_form_non'):1197            c2, c3 = st.columns([5,5])#([10,10])1198            with c2:1199                guides_List = st.selectbox('Please select list',1200                ('ListA','ListB','ListC'))

Showing the first 1,200 of 1283 lines. Download the file for the rest.