Skip to main content
. 2023 Jan 19;11(2):284. doi: 10.3390/biomedicines11020284
Algorithm 1 The algorithm for transformation of SMILES strings into SMILES matrices
Require: D ▹ SMILES dataset
    U←Ø ▹ Unique symbols
    m←0 ▹ Maximal symbol length
    s←"" ▹ Empty symbol
    for each SMILES∈D do
          for each s∈SMILES do
                if s∉U then
                       U⌢s
                end if
                if dim(SMILES)>m then
                       m←dim(SMILES)
                end if
          end for
    end for
    Tdim(U)×m ▹ One-hot matrix to be filled
    T←Ø ▹ Transformed dataset
    P←Ø ▹ MP values from dataset
    y←0 ▹ Output value
    for each SMILES∈D do
          i←0 ▹ For tracking vector columns
          for each s∈SMILES do
                P←DP
                y←Dy
                if s∈U then
                     LetxbesuchthatUx=s
                     Tx,i=1
                     ∀x′∈dim(U)∧x′≠x⇒Tx′,i=0
                else
                     for each xin[1,dim(U)] do
                           Tx,i=0
                     end for
                end if
                i←i+1
                T←(P,T,y)
          end for
    end for