"""
Function of this code: one method of transforming DNA sequences to numerical values.
Contact for help: gch_liu@163.com 
"""

import numpy as np
def dna2numInteger(seq):
    N=len(seq);
    seq0=np.ones(N);
    for i in range(0,N):
        if seq[i]=='A':
            seq0[i]=2;
        elif seq[i]=='C':
            seq0[i]=1;
        elif seq[i]=='G':
            seq0[i]=3;
        else:   #seq(i)=='T';
            seq0[i]=0;
    return seq0;
if __name__=='__main__':
    print(dna2numInteger("ACTGTCGA"))
