<jupyter_start><jupyter_text>This should be renamed, to something along the lines of bertPredictionDict<jupyter_code># export
def aaPosDict(aas):
    aaDict = {}
    for aaPos in range(len(aas)):
        aa = aas[aaPos]
        aaDict[aa] = aaPos
    return aaDict
aaPosDict("ACDEFGHIKLMNPQRSTVWY")
# export 
def bertPredictionDF(seq, aas="ACDEFGHIKLMNPQRSTVWY"):
  aaDict = aaPosDict(aas)
  bertPredDict = {}
  # posPredictions = []
  for aaPos in range(len(seq)):
    aa = seq[aaPos]
    maskPosSeq = maskifySeq(seq, aaPos)
    predictions = unmasker(maskPosSeq, top_k=30)
    predList = [0]*len(aas)
    for prediction in predictions:
      predAA = prediction["token_str"]
      if predAA in aaDict:
        predList[aaDict[predAA]] = prediction["score"]
    bertPredDict[aaPos] = predList
  bertPredDF = berteomeDF.modelPredDF(bertPredDict,seq, aas).predDf
  return bertPredDF
bertPredictionDF("MENDEL")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11087420042643924, 'fraction_numerical': 0.0031982942430703624, 'mean_word_length': 4.396551724137931, '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': '94973', 'license': 'Apache-2.0', 'n_tokens_mistral': 366, 'n_tokens_neox': 346, 'n_words': 68, 'path': 'nbs/01_bert.ipynb', 'repo_name': 'tijeco/berteome', 'size': '938'}