Algorithm 1:
Assigning mutational signatures to samples with SigProfilerAssignment
Input: (a vector corresponding to a set of mutations in a sample) and (a matrix corresponding to a set of known mutational signatures) | ||
Output: (the vector reflecting the activities of the known signatures in sample ) | ||
1: | , | |
2: | While FLAG = True: | |
3: | , | |
4: | , | |
5: | Set FLAG = False if remains constant and there is no addition or removal of signatures | |
END While | ||
6: | , | |
7: | Return | |
8: | FUNCTION removeSignatures | |
9: | While FLAG = True: | |
10: | For in 1 to size(, 2) do | // loop from 1 to the total number of signatures in |
11: | // remove the jth signature from | |
12: | , | |
END For | ||
13: | minIndex, | // find the signature set with least relative error |
14: | If | |
15: | ||
else | ||
16: | Return minValue, | |
END If | ||
END While | ||
END removeSignatures | ||
17: | FUNCTION addSignatures | |
18: | While FLAG = True: | |
19: | For in 1 to size(, 2) do | // loop from 1 to the total number of signatures in |
20: | // add the pth signature from | |
21: | , | |
END For | ||
22: | minIndex, | // find the signature set with least relative error |
23: | If | |
24: | ||
else | ||
25: | Return minValue, | |
END If | ||
END While | ||
END addSignatures | ||
26: | FUNCTION calcNNLS | |
27: | // Calculating NNLS with the Lawson-Hanson method | |
28: | // Computing relative error | |
29: | Return , | |
END calcNNLS |