public Rmsd(DCDFile dcd, string alignFile, bool flag, PDBMODE allAtoms, string refJuryProfile = null) : base(dcd, alignFile, flag, refJuryProfile) { DCDReader readDCD = new DCDReader(dcd); dirSettings.Load(); pdbs = new PDBFiles(); readDCD.DCDPrepareReading(dcd.dcdFile, dcd.pdbFile); int counter = 0; bool cont = true; do { MemoryStream mStream = new MemoryStream(); StreamWriter wStream = new StreamWriter(mStream); cont = readDCD.ReadAndSavePDB(wStream); string name = "Model" + counter++; mStream.Position = 0; pdbs.AddPDB(mStream, allAtoms, name); }while(cont); readDCD.FinishDCDReading(); pdbs.FindReferenceSeq(); pdbs.MakeAlignment(alignFile); if (pdbs is ErrorBase) { AddErrors(pdbs.errors); } opt = new Optimization(); structNames = CheckAvailableStructures(); order = true; }
public Rmsd(DCDFile dcd, string alignFile, bool flag, PDBMODE allAtoms, string refJuryProfile = null) : base(dcd, alignFile, flag, refJuryProfile) { DCDReader readDCD = new DCDReader(dcd); dirSettings.Load(); pdbs = new PDBFiles(); readDCD.DCDPrepareReading(dcd.dcdFile, dcd.pdbFile); int counter = 0; bool cont = true; do { MemoryStream mStream = new MemoryStream(); StreamWriter wStream = new StreamWriter(mStream); cont=readDCD.ReadAndSavePDB(wStream); string name = "Model" + counter++; mStream.Position = 0; pdbs.AddPDB(mStream, allAtoms, name); } while(cont); readDCD.FinishDCDReading(); pdbs.FindReferenceSeq(); pdbs.MakeAlignment(alignFile); if(pdbs is ErrorBase) AddErrors(pdbs.errors); opt = new Optimization(); structNames = CheckAvailableStructures(); order = true; }
protected void InitMeasure(DCDFile dcd, string alignFile, bool flag, PDBMODE allAtoms, string refJuryProfile = null) { base.InitMeasure(dcd, alignFile, flag, refJuryProfile); DCDReader readDCD = new DCDReader(dcd); pdbs = new PDBFiles(); readDCD.DCDPrepareReading(dcd.dcdFile, dcd.pdbFile); int counter = 0; bool cont = true; do { MemoryStream mStream = new MemoryStream(); StreamWriter wStream = new StreamWriter(mStream); cont = readDCD.ReadAndSavePDB(wStream); string name = "Model" + counter++; mStream.Position = 0; pdbs.AddPDB(mStream, allAtoms, name); }while(cont); readDCD.FinishDCDReading(); pdbs.FindReferenceSeq(); pdbs.MakeAlignment(alignFile); structNames = CheckAvailableStructures(); atomDic = pdbs.MakeAllAtomsDic(); }
public Rmsd(List <string> fileNames, string alignFile, bool flag, PDBMODE allAtoms, string refJuryProfile = null) : base(fileNames, alignFile, flag, refJuryProfile) { dirSettings.Load(); pdbs = new PDBFiles(); pdbs.AddPDB(fileNames, allAtoms); pdbs.FindReferenceSeq(); pdbs.MakeAlignment(null); opt = new Optimization(); structNames = CheckAvailableStructures(); order = true; }
protected void InitMeasure(string dirName, string alignFile, bool flag, PDBMODE allAtoms, string refJuryProfile = null) { base.InitMeasure(dirName, alignFile, flag, refJuryProfile); pdbs = new PDBFiles(); string[] files; if (dirSettings.extension == null) { files = Directory.GetFiles(dirName); } else { files = Directory.GetFiles(dirName, dirSettings.extension); } if (files.Length == 0) { throw new Exception("In selected directory " + dirName + " there are no files with extesion " + dirSettings.extension); } maxV = files.Length; string refSeqFile = dirName + ".ref"; pdbs.ReadRefSeq(refSeqFile); currentV = 0; pdbs.AddPDB(files, allAtoms, ref currentV); if (pdbs.molDic.Keys.Count == 0) { throw new Exception("Non pdb files correctly read"); } pdbs.FindReferenceSeq(); pdbs.MakeAlignment(alignFile); structNames = CheckAvailableStructures(); order = true; atomDic = pdbs.MakeAllAtomsDic(); }
protected void InitMeasure(List <string> fileNames, string alignFile, bool flag, PDBMODE allAtoms, string refJuryProfile = null) { base.InitMeasure(fileNames, alignFile, flag, refJuryProfile); dirSettings.Load(); pdbs = new PDBFiles(); maxV = fileNames.Count; currentV = 0; pdbs.AddPDB(fileNames, allAtoms, ref currentV); if (pdbs.molDic.Keys.Count == 0) { throw new Exception("Unable to read pdb data!!"); } pdbs.FindReferenceSeq(); if (pdbs.molDic.Count == 0) { throw new Exception("All pdb structures have been removed. No Data!"); } pdbs.MakeAlignment(null); structNames = CheckAvailableStructures(); order = true; atomDic = pdbs.MakeAllAtomsDic(); }
public Rmsd(string dirName, string alignFile, bool flag, PDBMODE allAtoms, string refJuryProfile = null) : base(dirName, alignFile, flag, refJuryProfile) { dirSettings.Load(); pdbs = new PDBFiles(); string[] files; if (dirSettings.extension == null) { files = Directory.GetFiles(dirName); } else { files = Directory.GetFiles(dirName, dirSettings.extension); } if (files.Length == 0) { throw new Exception("In selected directory " + dirName + " there are no files with extesion " + dirSettings.extension); } string refSeqFile = dirName + ".ref"; pdbs.ReadRefSeq(refSeqFile); pdbs.AddPDB(files, allAtoms); if (pdbs.molDic.Keys.Count == 0) { throw new Exception("Non pdb files correctly read"); } pdbs.FindReferenceSeq(); pdbs.MakeAlignment(alignFile); opt = new Optimization(); structNames = CheckAvailableStructures(); order = true; }
public Rmsd(string dirName,string alignFile,bool flag,PDBMODE allAtoms,string refJuryProfile=null):base(dirName,alignFile,flag,refJuryProfile) { dirSettings.Load(); pdbs = new PDBFiles(); string[] files; if(dirSettings.extension==null) files = Directory.GetFiles(dirName); else files = Directory.GetFiles(dirName, dirSettings.extension); if (files.Length == 0) throw new Exception("In selected directory " + dirName + " there are no files with extesion " + dirSettings.extension); string refSeqFile = dirName + ".ref"; pdbs.ReadRefSeq(refSeqFile); pdbs.AddPDB(files, allAtoms); if (pdbs.molDic.Keys.Count == 0) throw new Exception("Non pdb files correctly read"); pdbs.FindReferenceSeq(); pdbs.MakeAlignment(alignFile); opt=new Optimization(); structNames = CheckAvailableStructures(); order = true; }
public Rmsd(List <string> fileNames, string alignFile, bool flag, PDBMODE allAtoms,string refJuryProfile=null) : base(fileNames, alignFile, flag,refJuryProfile) { dirSettings.Load(); pdbs = new PDBFiles(); pdbs.AddPDB(fileNames, allAtoms); pdbs.FindReferenceSeq(); pdbs.MakeAlignment(null); opt = new Optimization(); structNames = CheckAvailableStructures(); order = true; }
public override void RunThreads(string fileName) { List <string> files = CheckFile(fileName); if (files.Count == 0) { return; } //Task[] runnigTask = new Task[threadNumbers]; //Task startProg; maxV = files.Count * 2; ReadPdbs(files); if (pdbs.molDic.Count == 0) { return; } string aux = Path.GetDirectoryName(files[0]).TrimEnd(Path.DirectorySeparatorChar); string refSeqFile = aux + ".ref"; if (File.Exists(refSeqFile)) { pdbs.ReadRefSeq(refSeqFile); } else { pdbs.FindReferenceSeq(); } pdbs.MakeAlignment(null); if (contOne == null) { string molDicKey = ""; foreach (var item in pdbs.molDic.Keys) { molDicKey = item; break; } int len = pdbs.molDic[molDicKey].indexMol.Length; contOne = new int[len * (len + 1) / 2]; contact = new byte[threadNumbers][]; contactToString = new char [threadNumbers][]; for (int i = 0; i < threadNumbers; i++) { contact[i] = new byte [len * (len + 1) / 2]; contactToString[i] = new char [len * (len + 1)]; } for (int i = 0; i < contOne.Length; i++) { contOne[i] = 0; } for (int i = 0; i < threadNumbers; i++) { for (int j = 0; j < contOne.Length; j++) { contact[i][j] = 0; } } } auxFiles = new List <string> [threadNumbers]; List <string> allFiles = new List <string>(pdbs.molDic.Keys); for (int i = 0; i < threadNumbers; i++) { auxFiles[i] = new List <string>((i + 1) * pdbs.molDic.Count / threadNumbers - i * pdbs.molDic.Count / threadNumbers); for (int j = i * allFiles.Count / threadNumbers; j < (i + 1) * allFiles.Count / threadNumbers; j++) { auxFiles[i].Add(files[j]); } } for (int i = 0; i < threadNumbers; i++) { Params p = new Params(); p.fileName = fileName; p.k = i; resetEvents[p.k] = new ManualResetEvent(false); ThreadPool.QueueUserWorkItem(new WaitCallback(RunMakeProfiles), (object)p); } for (int i = 0; i < threadNumbers; i++) { resetEvents[i].WaitOne(); } //JoinFiles(fileName); CuttProfiles(fileName); currentProgress = maxV; }