diff --git a/pfam_matrix.py b/pfam_matrix.py new file mode 100644 index 0000000..9b0db92 --- /dev/null +++ b/pfam_matrix.py @@ -0,0 +1,137 @@ +import pandas as pd +import numpy as np +import progressbar +import os +import json +import sys +from prepare_synteny_matrix import read_data_homology,load_neighbor_genes +from process_data import create_map_list +from process_negative import read_database_txt + + +def get_score_overlap(x,y,pfam_db,pfam_map): + df_1=pfam_db.loc[pfam_map[x]] + df_2=pfam_db.loc[pfam_map[y]] + l=list(df_2.domain) + c=0 + c_1=0 + for _,row in df_1.iterrows(): + if row.domain in l:#check if the domain exists in the list + c_1+=1 + st=int(df_2[df_2["domain"]==row.domain].hmm_from)#get the start + end=int(df_2[df_2["domain"]==row.domain].hmm_to)#get the end + if (int(row.hmm_from)>st and int(row.hmm_from)st and int(row.hmm_from)