int GetDist(DistanceMeasures distance,string dirName,string item1,string item2) { DistanceMeasure dist = null; List<string> targets = new List<string>(); if(!item1.Contains(dirName)) targets.Add(dirName + Path.DirectorySeparatorChar + item1); else targets.Add(item1); targets.Add(dirName + Path.DirectorySeparatorChar + item2); switch (distance) { case DistanceMeasures.HAMMING: dist = new JuryDistance(targets, "", false, ""); break; case DistanceMeasures.MAXSUB: dist = new MaxSub(targets, "", false); break; case DistanceMeasures.RMSD: dist = new Rmsd(targets, "", false, PDB.PDBMODE.ONLY_CA); break; case DistanceMeasures.GDT_TS: dist = new GDT_TS(targets, "", false); break; } dist.InitMeasure(); return GetDist(dist, item1, item2); }
private DistanceMeasure CreateMeasureForDCD(DCDFile dcd, DistanceMeasures measure, PDB.PDBMODE atoms, bool jury1d, string alignFileName, string profileName = null, string refJuryProfile = null) { DistanceMeasure dist = null; switch (measure) { case DistanceMeasures.HAMMING: if (refJuryProfile == null || !jury1d) { throw new Exception("Sorry but for jury measure you have to define 1djury profile to find reference structure"); } else { dist = new JuryDistance(dcd, alignFileName, true, profileName, refJuryProfile); } break; case DistanceMeasures.RMSD: dist = new Rmsd(dcd, alignFileName, jury1d, atoms, refJuryProfile); break; case DistanceMeasures.MAXSUB: dist = new MaxSub(dcd, alignFileName, jury1d, refJuryProfile); break; case DistanceMeasures.GDT_TS: dist = new GDT_TS(dcd, alignFileName, jury1d, refJuryProfile); break; } dist.InitMeasure(); return(dist); }
DistanceMeasure PrepareDistance(DistanceMeasures distance,List <string> targets,string alignFile,string profileName) { DistanceMeasure dist=null; switch (distance) { case DistanceMeasures.HAMMING: dist = new JuryDistance(targets, alignFile, false, profileName); break; case DistanceMeasures.MAXSUB: dist = new MaxSub(targets, alignFile, false); break; case DistanceMeasures.RMSD: dist = new Rmsd(targets, alignFile, false, PDB.PDBMODE.ONLY_CA); break; case DistanceMeasures.GDT_TS: dist = new GDT_TS(targets, alignFile, false); break; } dist.InitMeasure(); return dist; }
private void SaveAll() { DistanceMeasure dist = null; Settings set = new Settings(); set.Load(); string[] files; if (set.extension.Length > 0) { files = Directory.GetFiles(directory, set.extension); } else { files = Directory.GetFiles(directory); } List <string> fileList = new List <string>(2); StreamWriter r = new StreamWriter(saveFile); maxV = files.Length; foreach (var item in files) { fileList.Clear(); fileList.Add(item); fileList.Add(markStructure); switch (distanceControl1.distDef) { case DistanceMeasures.HAMMING: dist = new JuryDistance(fileList, null, false, distanceControl1.profileName, distanceControl1.referenceProfile); break; case DistanceMeasures.RMSD: dist = new Rmsd(fileList, null, false, distanceControl1.CAtoms, null); break; case DistanceMeasures.MAXSUB: dist = new MaxSub(fileList, null, false, null); break; case DistanceMeasures.GDT_TS: dist = new GDT_TS(fileList, null, false, null); break; } dist.InitMeasure(); try { int val = dist.GetDistance(Path.GetFileName(fileList[1]), Path.GetFileName(fileList[0])); currentV++; if (val < int.MaxValue) { r.WriteLine(fileList[0] + " " + (double)val / 100); } else { r.WriteLine(fileList[0] + " NaN"); } } catch (Exception ex) { exc = ex; } } r.Close(); currentV = maxV; }
private DistanceMeasure CreateMeasure(string processName, string dirName, DistanceMeasures measure, PDB.PDBMODE atoms, bool jury1d, string alignFileName, string profileName = null, string refJuryProfile = null) { DistanceMeasure dist = null; switch (measure) { case DistanceMeasures.HAMMING: if (alignFileName != null) { dist = new JuryDistance(alignFileName, jury1d, profileName, refJuryProfile); } else { dist = new JuryDistance(dirName, alignFileName, jury1d, profileName, refJuryProfile); } break; case DistanceMeasures.TANIMOTO: if (alignFileName != null) { dist = new Tanimoto(alignFileName, jury1d, profileName, refJuryProfile); } else { dist = new Tanimoto(dirName, alignFileName, jury1d, profileName, refJuryProfile); } break; case DistanceMeasures.COSINE: if (alignFileName != null) { dist = new CosineDistance(alignFileName, jury1d, profileName, refJuryProfile); } else { dist = new CosineDistance(dirName, alignFileName, jury1d, profileName, refJuryProfile); } break; case DistanceMeasures.RMSD: if (dirName == null) { throw new Exception("RMSD and MAXSUB measures cannot be used for aligned profiles!"); } dist = new Rmsd(dirName, alignFileName, jury1d, atoms, refJuryProfile); break; case DistanceMeasures.MAXSUB: if (dirName == null) { throw new Exception("RMSD and MAXSUB measures cannot be used for aligned profiles!"); } dist = new MaxSub(dirName, alignFileName, jury1d, refJuryProfile); break; case DistanceMeasures.GDT_TS: if (dirName == null) { throw new Exception("RMSD and MAXSUB measures cannot be used for aligned profiles!"); } dist = new GDT_TS(dirName, alignFileName, jury1d, refJuryProfile); break; } return(dist); }