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 override void Run(DCDFile dcd) { DCDReader dcdReader = new DCDReader(null); string modelName = null; int counter = 0; string fileName; StreamWriter wr; PDBFiles pdbs = new PDBFiles(); Dictionary <string, int> modelList = null; fileName = GetProfileFileName(dcd); if (File.Exists(fileName)) { modelList = CheckFile(dcd); wr = File.AppendText(fileName); } else { wr = new StreamWriter(fileName); } if (wr == null) { throw new Exception("Cannot open file: " + fileName); } dcdReader.DCDPrepareReading(dcd.dcdFile, dcd.pdbFile); bool cont = true; do { MemoryStream mStream = new MemoryStream(); StreamWriter write = new StreamWriter(mStream); cont = dcdReader.ReadAndSavePDB(write); modelName = "Model" + counter++; if (modelList == null || modelList.ContainsKey(modelName)) { continue; } mStream.Position = 0; if (this.GetType() == typeof(ContactProfile)) { pdbs.AddPDB(mStream, PDBMODE.ALL_ATOMS, modelName); } else { pdbs.AddPDB(mStream, PDBMODE.ONLY_CA, modelName); } if (pdbs.molDic.ContainsKey(modelName)) { MakeProfiles(modelName, pdbs.molDic[modelName], wr); } }while (cont); dcdReader.FinishDCDReading(); wr.Close(); }