public double RegSVMEncode(string input, string CalTotalAminoV)
        
{
            
string Amino = "ACDEFGHIKLMNPQRSTVWY";
            
double[] AminoValue = new double[20];
            
string pat = @"\-?[0-9]*\.?[0-9]*";
            Regex r 
= new Regex(pat, RegexOptions.IgnoreCase);
            MatchCollection matches 
= r.Matches(CalTotalAminoV);
            
int j=0;
            
foreach (Match m in matches)
            
{
                
if ((m.Value != null&& (m.Value != ""))
                
{
                    AminoValue[j] 
= Convert.ToDouble(m.Value);
                    j
++;
                }

            }

           char[] ArrayAmino = Amino.ToCharArray();         
           
double TotalNum = 0;
            Hashtable ht 
= new Hashtable();
            
for (int i = 0; i < ArrayAmino.Length; i++)
            
{
                ht.Add(ArrayAmino[i], AminoValue[i]);
            }

            input 
= input.Trim().ToUpper();
            
char[] ArrayInput = input.ToCharArray();
            
for (int i = 0; i < ArrayInput.Length; i++)
            
{
                TotalNum 
+= Convert.ToDouble(ht[ArrayInput[i]]);
            }

            return TotalNum;
        }
posted on 2007-01-30 20:32  ekeen  阅读(267)  评论(0编辑  收藏  举报