Exemplo n.º 1
0
 private void bwNewKitYDNAJob_DoWork(object sender, DoWorkEventArgs e)
 {
     try
     {
         string[]      lines = File.ReadAllLines(e.Argument.ToString());
         StringBuilder sb    = new StringBuilder();
         string[]      data  = null;
         string[]      snp   = null;
         foreach (string line in lines)
         {
             data = line.Replace("\"", "").Split(new char[] { ',' });
             //"Type","Position","SNPName","Derived","OnTree","Reference","Genotype","Confidence"
             if (data[0] == "Known SNP")
             {
                 if (data[3] == "Yes(+)")
                 {
                     sb.Append(data[2] + "+, ");
                 }
                 else if (data[3] == "No(-)")
                 {
                     sb.Append(data[2] + "-, ");
                 }
             }
             else if (data[0] == "Novel Variant")
             {
                 if (ymap.ContainsKey(data[1]))
                 {
                     snp = GGKUtilLib.getYSNP(data[1], data[6]);
                     if (snp[0].IndexOf(";") == -1)
                     {
                         sb.Append(snp[0] + snp[1] + ", ");
                     }
                     else
                     {
                         sb.Append(snp[0].Substring(0, snp[0].IndexOf(";")) + snp[1] + ", ");
                     }
                 }
             }
         }
         //
         ysnps = sb.ToString().Trim();
         if (ysnps.Length > 0)
         {
             ysnps = ysnps.Substring(0, ysnps.Length - 1);
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Unable to get Y-SNPs from " + e.Argument.ToString());
     }
 }