## calculating a set of z-scores :: Please explain how to represent this procedure

Hello! I need to know how to represent this procedure mathematically. I am trying to have a program of mine published, but I need to represent this as an equation to the best of my abilities first!

I will first explain how the operation works, and then I will display my attempt at it.

PROCEDURE:
We have two lists of elements: subjects and targets (i's & j's) These elements are actually protein sequences. We have two text files each containing our subjects and targets respectively

Now, we have two functions:
$\displaystyle \displaystyle Sw(i,j) = R$
$\displaystyle \displaystyle Sw^\prime(i) = \{j_1,j_2,j_3\}$

In other words, the Sw() function takes two elements : a subject sequence (i) and a target sequence (j) and returns a raw numerical bit-score called "R".

Now, the Sw'() function will take 1 subject sequence (i) and return 3 targets (j's).

Now, here is the procedure I need proper mathematical syntax: I have I written this in pseudo-code/python (lol)

Code:
from numpy import std,average,shuffle

shuffled_Rs = []

def myscores(i):
for j in Sw_prime(i):
R = Sw(i,j)
for i in range(500):
shuffled_j = shuffle(j)
shuffled_Rs.append( Sw(i,shuffled_j) )
standard_deviation = std(shuffled_Rs)
average = mean(shuffled_Rs)
z_score = (R - average) / standard_deviation
return answers