public Best5(List <ClusterOutput> outputs, bool flag = false) { InitializeComponent(); if (outputs.Count == 0) { return; } this.Text = outputs[0].name.Split('_')[0]; int countPP = 0, countMP = 0, countPPS = 0, countMPS = 0, countPC = 0, countMC = 0; if (outputs.Count > 0) { //dataGridView1.Rows.Add(outputs.Count+1); int i = 0; foreach (var item in outputs) { StatClust cl = Calc(item, flag); if (cl == null) { continue; } dataGridView1.Rows.Add(1); dataGridView1.Rows[i].Cells[0].Value = item.name; dataGridView1.Rows[i].Cells[1].Value = item.dirName; if (cl != null) { dataGridView1.Rows[i].Cells[2].Value = cl.size; dataGridView1.Rows[i].Cells[3].Value = cl.reference; dataGridView1.Rows[i].Cells[4].Value = String.Format("{0:0.00}", cl.rmsd); if (pl.ContainsKey(cl.native)) { if (pl[cl.native] > cl.rmsd) { dataGridView1.Rows[i].Cells[5].Value = "+"; countPP++; } else { dataGridView1.Rows[i].Cells[5].Value = "-"; countMP++; } if (pl_smart[cl.native] > cl.rmsd) { dataGridView1.Rows[i].Cells[6].Value = "+"; countPPS++; } else { dataGridView1.Rows[i].Cells[6].Value = "-"; countMPS++; } if (calibur[cl.native] > cl.rmsd) { dataGridView1.Rows[i].Cells[7].Value = "+"; countPC++; } else { dataGridView1.Rows[i].Cells[7].Value = "-"; countMC++; } } i++; } } dataGridView1.Rows.Add(1); dataGridView1.Rows[i].Cells[5].Value = "Plus=" + countPP + " Minus=" + countMP; dataGridView1.Rows[i].Cells[6].Value = "Plus=" + countPPS + " Minus=" + countMPS; dataGridView1.Rows[i].Cells[7].Value = "Plus=" + countPC + " Minus=" + countMC; dataGridView1.Rows.Add(1); dataGridView1.Rows[i + 1].Cells[5].Value = "Avr=" + (avrSum / avrCount).ToString(); } }
private StatClust Calc(ClusterOutput outp,bool flag) { List <string> five=new List<string>(); List<string> listFiles = new List<string>(); //if (outp == null || outp.clusters == null) // return null; if(outp==null || outp.dirName==null) return null; string []aux=outp.dirName.Split(Path.DirectorySeparatorChar); string native=aux[aux.Length-1]+".pdb"; string dirM = ""; for (int i = 0; i < aux.Length - 1; i++) dirM += aux[i] + Path.DirectorySeparatorChar; native = dirM + native; if(!File.Exists(native)) return null; five.Add(native); // jury1D jury = new jury1D(outp.dirName, "", "C:\\data\\dcd\\SS_SA9internal.profiles"); // jury1D jury = new jury1D(outp.dirName, "", "C:\\data\\dcd\\SS3_SA9_jury_internal.profiles"); //jury1D jury = new jury1D(outp.dirName, "", "C:\\data\\dcd\\SS8_SA3_jury_internal.profiles"); jury1D jury; // jury1D jury = new jury1D(outp.dirName, "", "C:\\data\\dcd\\SS_Contact_jury_internal.profiles"); if(outp.clusters!=null) { outp.clusters.Sort((a,b)=>b.Count.CompareTo(a.Count)); int end = outp.clusters.Count; if (outp.clusters.Count > 5) end = 5; for (int i = 0; i < end; i++) { listFiles.Clear(); foreach (var item in outp.clusters[i]) { listFiles.Add(outp.dirName + Path.DirectorySeparatorChar+item); } // // //Sift sift = new Sift(listFiles); //ClusterOutput oo = sift.Shape(); if (flag) { DistanceMeasure distRmsd = new Rmsd(listFiles, "", false, uQlustCore.PDB.PDBMODE.ONLY_CA); distRmsd.InitMeasure(); string strName = distRmsd.GetReferenceStructure(outp.clusters[i]); five.Add(outp.dirName + Path.DirectorySeparatorChar + strName); } else { jury = new jury1D(); jury.PrepareJury(listFiles, "", "Z:\\dcd\\SS3_SA9_jury_internal.profiles"); ClusterOutput oo = jury.JuryOptWeights(outp.clusters[i]); if (oo == null) continue; five.Add(outp.dirName + Path.DirectorySeparatorChar + oo.juryLike[0].Key); } //five.Add(outp.dirName + Path.DirectorySeparatorChar + outp.clusters[i][0]); } } if (outp.hNode != null) { int end; List<List<string>> cli=outp.hNode.GetClusters(10); cli.Sort((a, b) => b.Count.CompareTo(a.Count)); outp.clusters = new List<List<string>>(); end = cli.Count; if (cli.Count > 5) end = 5; for (int i = 0; i < end; i++) { // listFiles.Clear(); //foreach (var item in cli[i]) //{ //listFiles.Add( //} listFiles.Clear(); foreach (var item in cli[i]) { listFiles.Add(outp.dirName + Path.DirectorySeparatorChar + item); } jury = new jury1D(); jury.PrepareJury(listFiles, "", "C:\\data\\dcd\\SS8_SA3_jury_internal.profiles"); outp.clusters.Add(cli[0]); //jury ClusterOutput oo = jury.JuryOptWeights(cli[i]); if (oo == null) continue; five.Add(outp.dirName + Path.DirectorySeparatorChar + cli[i][0]); //five.Add(outp.dirName + Path.DirectorySeparatorChar + strName); } } if (outp.juryLike != null) { int end = outp.juryLike.Count; if (outp.juryLike.Count > 5) end = 5; for (int i = 0; i < end; i++) five.Add(outp.dirName + Path.DirectorySeparatorChar + outp.juryLike[i].Key); } // DistanceMeasure dist; // dist = new Rmsd(five, "", false, PDB.PDBMODE.ONLY_CA); // dist = new MaxSub(five, "", false); Dictionary<string, double> cc = ReadScore(aux[aux.Length - 1]); if (cc == null) return null ; StatClust stCLust = new StatClust(); string[] tt1 = native.Split(Path.DirectorySeparatorChar); stCLust.native = tt1[tt1.Length - 1]; for (int i = 1; i < five.Count; i++) { string[] tt2 = five[i].Split(Path.DirectorySeparatorChar); // double rmsd = dist.GetDistance(tt1[tt1.Length-1], tt2[tt2.Length-1]) /100.0; double rmsd=0; if (cc.ContainsKey(tt2[tt2.Length-1])) rmsd = cc[tt2[tt2.Length - 1]]; if (rmsd > stCLust.rmsd) { if (outp.juryLike != null) stCLust.size = outp.juryLike.Count; else stCLust.size = outp.clusters[i - 1].Count; stCLust.rmsd = rmsd; string[] dd = five[i].Split(Path.DirectorySeparatorChar); stCLust.reference = dd[dd.Length-1]; } } if (stCLust.rmsd < 1000) { avrSum += stCLust.rmsd; avrCount++; } if (outp.hNode != null) { outp.clusters.Clear(); outp.clusters = null; } return stCLust; }
private StatClust Calc(ClusterOutput outp, bool flag) { List <string> five = new List <string>(); List <string> listFiles = new List <string>(); //if (outp == null || outp.clusters == null) // return null; if (outp == null || outp.dirName == null) { return(null); } string [] aux = outp.dirName.Split(Path.DirectorySeparatorChar); string native = aux[aux.Length - 1] + ".pdb"; string dirM = ""; for (int i = 0; i < aux.Length - 1; i++) { dirM += aux[i] + Path.DirectorySeparatorChar; } native = dirM + native; if (!File.Exists(native)) { return(null); } five.Add(native); jury1D jury; if (outp.clusters != null) { outp.clusters.Sort((a, b) => b.Count.CompareTo(a.Count)); int end = outp.clusters.Count; if (outp.clusters.Count > 5) { end = 5; } for (int i = 0; i < end; i++) { listFiles.Clear(); foreach (var item in outp.clusters[i]) { listFiles.Add(outp.dirName + Path.DirectorySeparatorChar + item); } // // //Sift sift = new Sift(listFiles); //ClusterOutput oo = sift.Shape(); if (flag) { DistanceMeasure distRmsd = new Rmsd(listFiles, "", false, uQlustCore.PDB.PDBMODE.ONLY_CA); distRmsd.InitMeasure(); string strName = distRmsd.GetReferenceStructure(outp.clusters[i]); five.Add(outp.dirName + Path.DirectorySeparatorChar + strName); } else { jury = new jury1D(); //jury.PrepareJury(listFiles, "", "Z:\\dcd\\SS3_SA9_jury_internal.profiles"); ClusterOutput oo = jury.JuryOptWeights(outp.clusters[i]); if (oo == null) { continue; } five.Add(outp.dirName + Path.DirectorySeparatorChar + oo.juryLike[0].Key); } //five.Add(outp.dirName + Path.DirectorySeparatorChar + outp.clusters[i][0]); } } if (outp.hNode != null) { int end; List <List <string> > cli = outp.hNode.GetClusters(10); cli.Sort((a, b) => b.Count.CompareTo(a.Count)); outp.clusters = new List <List <string> >(); end = cli.Count; if (cli.Count > 5) { end = 5; } for (int i = 0; i < end; i++) { // listFiles.Clear(); //foreach (var item in cli[i]) //{ //listFiles.Add( //} listFiles.Clear(); foreach (var item in cli[i]) { listFiles.Add(outp.dirName + Path.DirectorySeparatorChar + item); } jury = new jury1D(); jury.PrepareJury(listFiles, "", "C:\\data\\dcd\\SS8_SA3_jury_internal.profiles"); outp.clusters.Add(cli[0]); //jury ClusterOutput oo = jury.JuryOptWeights(cli[i]); if (oo == null) { continue; } five.Add(outp.dirName + Path.DirectorySeparatorChar + cli[i][0]); //five.Add(outp.dirName + Path.DirectorySeparatorChar + strName); } } if (outp.juryLike != null) { int end = outp.juryLike.Count; if (outp.juryLike.Count > 5) { end = 5; } for (int i = 0; i < end; i++) { five.Add(outp.dirName + Path.DirectorySeparatorChar + outp.juryLike[i].Key); } } // DistanceMeasure dist; // dist = new Rmsd(five, "", false, PDB.PDBMODE.ONLY_CA); // dist = new MaxSub(five, "", false); Dictionary <string, double> cc = ReadScore(aux[aux.Length - 1]); if (cc == null) { return(null); } StatClust stCLust = new StatClust(); string[] tt1 = native.Split(Path.DirectorySeparatorChar); stCLust.native = tt1[tt1.Length - 1]; for (int i = 1; i < five.Count; i++) { string[] tt2 = five[i].Split(Path.DirectorySeparatorChar); // double rmsd = dist.GetDistance(tt1[tt1.Length-1], tt2[tt2.Length-1]) /100.0; double rmsd = 0; if (cc.ContainsKey(tt2[tt2.Length - 1])) { rmsd = cc[tt2[tt2.Length - 1]]; } if (rmsd > stCLust.rmsd) { if (outp.juryLike != null) { stCLust.size = outp.juryLike.Count; } else { stCLust.size = outp.clusters[i - 1].Count; } stCLust.rmsd = rmsd; string[] dd = five[i].Split(Path.DirectorySeparatorChar); stCLust.reference = dd[dd.Length - 1]; } } if (stCLust.rmsd < 1000) { avrSum += stCLust.rmsd; avrCount++; } if (outp.hNode != null) { outp.clusters.Clear(); outp.clusters = null; } return(stCLust); }