<jupyter_start><jupyter_text>Load Data and Libraries<jupyter_code>from Bio import SearchIO
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib as mpl
import seaborn as sns
%matplotlib inline


num_hit = 0
#now parse the output
hit_list = []
hit_ids = []
counts = []
qnames = []
with open('overlap_hmm_blast.txt', 'r') as input:
    for qresult in SearchIO.parse(input, 'hmmer3-tab'):
        query_id = qresult.id  #sequence ID from fasta
        qnames.append(query_id)
        hits = qresult.hits
        hit_ids = hit_ids+qresult.hit_keys
        hit_list.append(hits)
        num_hits = len(hits)
        counts.append(num_hits)
        num_hit = num_hit + num_hits
print(num_hit)<jupyter_output>2181<jupyter_text>Hits by HMM Model<jupyter_code>df_query = pd.DataFrame({'Names': qnames, 
                   'Hit Counts': counts}, columns=['Names','Hit Counts'])
df_query = df_query.sort_values(by=['Hit Counts'], ascending=False)
top_n = df_query.head(10)
top_n
## Number of VOGS identified
y = df_query['Names'].str.contains('VOG')
df2=df_query[y]
df2.head(7)
f = plt.subplots(figsize=(10, 10))
sns.pointplot(x='Names', y='Hit Counts', data=df_query, markers=["o"], linestyles=["-"])
plt.yticks(fontsize=15)
plt.xticks([])
plt.title('Count of Virulence Factor Hits in Dataset', fontsize=18)
plt.xlabel('Virulence Factor Categories', fontsize=18)
plt.ylabel('Hit Counts', fontsize=16)
plt.tight_layout()
sns.despine(trim=True, left=True)
plt.savefig('HMM_Hit_Counts.jpg', transparent=True)
### Top N Hits
sns.factorplot(x="Hit Counts", y="Names", data=top_n, kind="bar", palette="vlag", size=10)


#axes = plt.gca()
#axes.set_xlim([0,10])
plt.yticks(fontsize=15)
plt.xticks(fontsize=15)
plt.title('Abundances of Top 10 Virulence Factor \n Hits in Phage Protein Database', fontsize=18)
plt.xlabel('Virulence Factor Hit Count', fontsize=18)
plt.ylabel('Top Virulence Factor Identities', fontsize=16)
plt.tight_layout()

#sns.despine(trim=True, left=True)
plt.savefig('Top_VF_Hit_Plot.jpg', transparent=True)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14292659212445308, 'fraction_numerical': 0.019445794846864366, 'mean_word_length': 5.411214953271028, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '2564', 'license': 'MIT', 'n_tokens_mistral': 836, 'n_tokens_neox': 766, 'n_words': 163, 'path': 'Virulence_HMMs/Overlap_Databases.ipynb', 'repo_name': 'glickmac/VF_HMM', 'size': '2057'}