示例#1
0
        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();
        }
示例#2
0
        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();
        }
示例#3
0
 //Flag true only CA will be readed
 public MolData(string fileName,PDBMODE flag,INPUTMODE mode,CHAIN_MODE chainFlag=CHAIN_MODE.SINGLE)
 {
     using (StreamReader rr = new StreamReader(fileName))            {
         switch (mode)
         {
             case INPUTMODE.PROTEIN:
                 mol = new Molecule( flag,chainFlag);
                 break;
             case INPUTMODE.RNA:
                 mol = new MoleculeRNA(flag);
                 break;
         }
         
         bool res = mol.ReadMolecule(rr);
         if (!res)
             return;
         if (mol.Chains.Count == 0)
         {
             ErrorBase.AddErrors("Error in reading file: " + fileName + "\nCannot find residues, file will not be considered!");
             rr.Close();
             return;
         }
        molLength = mol.Chains[0].chainSequence.Length;         
     }
     //CenterMol();
 }
示例#4
0
        public string AddPDB(string fileName, PDBMODE flag, CHAIN_MODE flagChain = CHAIN_MODE.SINGLE)
        {
            string name = Path.GetFileName(fileName);

            if (molDic != null && molDic.ContainsKey(name))
            {
                return(name);
            }
            try
            {
                MolData molD = new MolData(fileName, flag, mode, flagChain);
                if ((molD.mol == null || molD.mol.Chains == null || molD.mol.Chains.Count == 0))
                {
                    ErrorBase.AddErrors("PDB reading: file " + fileName + " is removed from consideration it looks that it has wrong format");
                    return(null);
                }
                molDic.Add(name, molD);

                return(name);
            }
            catch (IncorrectSideChainException ex)
            {
                ErrorBase.AddErrors("PDB reading: file " + fileName + " is removed from consideration because\n" + ex.Message);
            }
            catch (Exception ee)
            {
                ErrorBase.AddErrors("PDB reading: file " + fileName + " is removed from consideration because\n" + ee.Message);
            }
            return(null);
        }
示例#5
0
        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;
        }
示例#6
0
        //Flag true only CA will be readed
        public MolData(string fileName, PDBMODE flag, INPUTMODE mode, CHAIN_MODE chainFlag = CHAIN_MODE.SINGLE)
        {
            using (StreamReader rr = new StreamReader(fileName))            {
                switch (mode)
                {
                case INPUTMODE.PROTEIN:
                    mol = new Molecule(flag, chainFlag);
                    break;

                case INPUTMODE.RNA:
                    mol = new MoleculeRNA(flag);
                    break;
                }

                bool res = mol.ReadMolecule(rr);
                if (!res)
                {
                    return;
                }
                if (mol.Chains.Count == 0)
                {
                    ErrorBase.AddErrors("Error in reading file: " + fileName + "\nCannot find residues, file will not be considered!");
                    rr.Close();
                    return;
                }
                molLength = mol.Chains[0].chainSequence.Length;
            }
            //CenterMol();
        }
示例#7
0
        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;
        }
示例#8
0
 public Rmsd(string dirName,string alignFile,bool flag,PDBMODE allAtoms,string refJuryProfile=null)
 {
     this.dirName = dirName;
     this.alignFile = alignFile;
     this.flag = flag;
     this.allAtoms = allAtoms;
     this.refJuryProfile = refJuryProfile;
 }
示例#9
0
 public Rmsd(List <string> fileNames, string alignFile, bool flag, PDBMODE allAtoms, string refJuryProfile = null)
 {
     this.fileNames      = fileNames;
     this.alignFile      = alignFile;
     this.flag           = flag;
     this.allAtoms       = allAtoms;
     this.refJuryProfile = refJuryProfile;
 }
示例#10
0
 public Rmsd(List <string> fileNames, string alignFile, bool flag, PDBMODE allAtoms,string refJuryProfile=null)
 {
     this.fileNames = fileNames;
     this.alignFile = alignFile;
     this.flag = flag;
     this.allAtoms = allAtoms;
     this.refJuryProfile = refJuryProfile;
 }
示例#11
0
 public Rmsd(string dirName, string alignFile, bool flag, PDBMODE allAtoms, string refJuryProfile = null)
 {
     this.dirName        = dirName;
     this.alignFile      = alignFile;
     this.flag           = flag;
     this.allAtoms       = allAtoms;
     this.refJuryProfile = refJuryProfile;
 }
示例#12
0
 public void AddPDB(List <string> structures, PDBMODE flag, ref int currentProgress)
 {
     molDic = new Dictionary <string, MolData>(structures.Count);
     foreach (var item in structures)
     {
         AddPDB(item, flag);
         currentProgress++;
     }
 }
示例#13
0
 public Rmsd(DCDFile dcd, string alignFile, bool flag, PDBMODE allAtoms, string refJuryProfile = null)
 {
     order = true;
     dirSettings.Load();
     this.dcd            = dcd;
     this.alignFile      = alignFile;
     this.flag           = flag;
     this.allAtoms       = allAtoms;
     this.refJuryProfile = refJuryProfile;
 }
示例#14
0
        public string ParseAtomLine(Molecule molecule, string pdbLine, PDBMODE flag)
        {
            try
            {
                string atomName = pdbLine.Substring(12, 4).Trim();

                if (!CheckAtomName(atomName))
                {
                    return("Wrong Atom name: " + atomName + " atom will be removed");
                }

                string residueName = pdbLine.Substring(17, 3).Trim();
                if (!CheckResidue(residueName))
                {
                    return("Incorrect residue name: " + residueName);
                }

                this.AtomName = atomName;
                //ResidueName = ResidueIdentifier(residueName);
                tabParam[0] = (short)ResidueIdentifier(residueName);

                //ResidueSequenceNumber = Convert.ToInt16(pdbLine.Substring(22, 4));
                tabParam[2] = Convert.ToInt16(pdbLine.Substring(22, 4));

                //ChainIdentifier = (pdbLine.Substring(21, 1))[0];
                tabParam[1] = (short)(pdbLine.Substring(21, 1))[0];
                //if (ResidueName == 'O') ChainIdentifier = ' ';
                //if (tabParam[0] == 'O') ChainIdentifier = ' ';
                if (tabParam[0] == 'O')
                {
                    tabParam[1] = (short)' ';
                }
                else //if (ChainIdentifier == ' ') ChainIdentifier = '1';
                if (tabParam[1] == ' ')
                {
                    tabParam[1] = (short)'1';
                }

                float x = float.Parse(pdbLine.Substring(30, 7), CultureInfo.InvariantCulture);
                float y = float.Parse(pdbLine.Substring(38, 7), CultureInfo.InvariantCulture);
                float z = float.Parse(pdbLine.Substring(46, 7), CultureInfo.InvariantCulture);


                if (flag != PDBMODE.ONLY_SEQ)
                {
                    Position = new Point3D(x, y, z);
                }
            }
            catch (Exception ex)
            {
                return("Error in reading ATOM line: " + ex.Message);
            }

            return(null);
        }
示例#15
0
        public Rmsd(DCDFile dcd, string alignFile, bool flag, PDBMODE allAtoms, string refJuryProfile = null)
        {
            order = true;
            dirSettings.Load();
            this.dcd = dcd;
            this.alignFile=alignFile;
            this.flag=flag;
            this.allAtoms=allAtoms;
            this.refJuryProfile = refJuryProfile;

        }
示例#16
0
        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;
        }
示例#17
0
        public void AddPDB(string [] structures, PDBMODE flag, ref int currentProgress)
        {
            if (mode == INPUTMODE.RNA)
            {
                flag = PDBMODE.ONLY_P;
            }

            foreach (var item in structures)
            {
                AddPDB(item, flag);
                currentProgress++;
            }
        }
示例#18
0
        internal Residue(Molecule molecule, Atom atom,PDBMODE flag)
        {
          //  this.molecule = molecule;
            //this.residueName = atom.ResidueName;
            this.residueName = (char)atom.tabParam[0];
            //this.chainIdentifier = atom.ChainIdentifier;
            this.tabParam[0] = atom.tabParam[1];
            //this.residueSequenceNumber = atom.ResidueSequenceNumber;         
            //this.residueSequenceNumber = atom.tabParam[2];         
            this.tabParam[1] = atom.tabParam[2];         

            atoms = new List<Atom>();
            this.atoms.Add(atom);
            //AddAtom(atom);
            //this.residueIdentifier = Residue.GetResidueIdentifier(this.residueName);
        }
示例#19
0
        internal Residue(Molecule molecule, Atom atom, PDBMODE flag)
        {
            //  this.molecule = molecule;
            //this.residueName = atom.ResidueName;
            this.residueName = (char)atom.tabParam[0];
            //this.chainIdentifier = atom.ChainIdentifier;
            this.tabParam[0] = atom.tabParam[1];
            //this.residueSequenceNumber = atom.ResidueSequenceNumber;
            //this.residueSequenceNumber = atom.tabParam[2];
            this.tabParam[1] = atom.tabParam[2];

            atoms = new List <Atom>();
            this.atoms.Add(atom);
            //AddAtom(atom);
            //this.residueIdentifier = Residue.GetResidueIdentifier(this.residueName);
        }
示例#20
0
        public string AddPDB(MemoryStream stream, PDBMODE flag, string modelName)
        {
            try
            {
                MolData molD = new MolData();
                if (!molD.ReadMolData(stream, flag, modelName))
                {
                    return(null);
                }
                molDic.Add(modelName, molD);

                return(modelName);
            }
            catch (IncorrectSideChainException ex)
            {
                ErrorBase.AddErrors("PDB reading: file " + modelName + " is removed from consideration because\n" + ex.Message);
            }
            return(null);
        }
示例#21
0
        public bool ReadMolData(MemoryStream stream, PDBMODE flag,string modelName)
        {
            StreamReader rr = new StreamReader(stream);
            mol = new Molecule(flag);
            bool res = mol.ReadMolecule(rr);
            if (!res)
            {
                return false;
            }

            if (mol.Chains.Count == 0)
            {
                ErrorBase.AddErrors("Error in reading file: " + modelName + "\nCannot find residues, file will not be considered!");
                return false;
            }
            molLength = mol.Chains[0].chainSequence.Length;

            return true;
            //CenterMol();
        }
示例#22
0
        public bool ReadMolData(MemoryStream stream, PDBMODE flag, string modelName)
        {
            StreamReader rr = new StreamReader(stream);

            mol = new Molecule(flag);
            bool res = mol.ReadMolecule(rr);

            if (!res)
            {
                return(false);
            }

            if (mol.Chains.Count == 0)
            {
                ErrorBase.AddErrors("Error in reading file: " + modelName + "\nCannot find residues, file will not be considered!");
                return(false);
            }
            molLength = mol.Chains[0].chainSequence.Length;

            return(true);
            //CenterMol();
        }
示例#23
0
        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();
        }
示例#24
0
        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;
        }
示例#25
0
        public string AddPDB(string fileName,PDBMODE flag,CHAIN_MODE flagChain=CHAIN_MODE.SINGLE)
        {
            string name = Path.GetFileName(fileName);
            if(molDic!=null && molDic.ContainsKey(name))            
                return name;
            try
            {
                MolData molD = new MolData(fileName, flag,mode,flagChain);
                if ((molD.mol == null || molD.mol.Chains == null || molD.mol.Chains.Count == 0))
                {
                    ErrorBase.AddErrors("PDB reading: file " + fileName + " is removed from consideration it looks that it has wrong format");
                    return null;
                }
                molDic.Add(name, molD);

                return name;

            }
            catch (IncorrectSideChainException ex)
            {
                ErrorBase.AddErrors("PDB reading: file " + fileName + " is removed from consideration because\n" + ex.Message);
            }
            catch (Exception ee)
            {
                ErrorBase.AddErrors("PDB reading: file " + fileName + " is removed from consideration because\n" + ee.Message);
            }
            return null;
        }
示例#26
0
 public void AddPDB(string []structures,PDBMODE flag,ref int currentProgress)
 {
     
     foreach (var item in structures)
     {
         AddPDB(item, flag);
         currentProgress++;
     }
 }
示例#27
0
 public void AddPDB(List<string> structures, PDBMODE flag,ref int currentProgress)
 {
     molDic = new Dictionary<string, MolData>(structures.Count);
     foreach (var item in structures)
     {
         AddPDB(item, flag);
         currentProgress++;
     }            
 }
示例#28
0
        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();
        }
示例#29
0
 internal Molecule(PDBMODE flag,CHAIN_MODE flagChain=CHAIN_MODE.SINGLE)
 {
     this.flag = flag;
     this.flagChain=flagChain;
 }
示例#30
0
        public MoleculeRNA(PDBMODE flag):base(flag)
        {

        }
示例#31
0
 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();
 }
示例#32
0
        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();
         }
示例#33
0
        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;
        }
示例#34
0
        public string AddPDB(MemoryStream stream, PDBMODE flag,string modelName)
        {
            try
            {
                MolData molD = new MolData();
                if (!molD.ReadMolData(stream, flag,modelName))
                {
                    return null;
                }
                molDic.Add(modelName, molD);

                return modelName;

            }
            catch (IncorrectSideChainException ex)
            {
                ErrorBase.AddErrors("PDB reading: file " + modelName+ " is removed from consideration because\n" + ex.Message);
            }
            return null;
        }
示例#35
0
 public MoleculeRNA(PDBMODE flag) : base(flag)
 {
 }
示例#36
0
        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;
         }
示例#37
0
 internal Molecule(PDBMODE flag, CHAIN_MODE flagChain = CHAIN_MODE.SINGLE)
 {
     this.flag      = flag;
     this.flagChain = flagChain;
 }