Example #1
0
        void PrepareSift()
        {
            pdbs = new PDBFiles();
            maxV = listFiles.Count * 2+1;
            foreach (var item in listFiles)
            {
                string[] aux = item.Split('\\');
                //  if (!fileList.ContainsKey(aux[aux.Length-1]))
                //       continue;

                string strName;
                strName = pdbs.AddPDB(item, PDBMODE.ALL_ATOMS);
                if (strName != null)
                {
                    pdbs.molDic[strName].CreateSideChainContactMap(11.0f, true);
                    pdbs.molDic[strName].CleanMolData();

                }
                currentV++;
            }
            step = (double)(stop - start) / binNumber;

            for (double i = start; i < stop; i += step)
                binLen.Add(i + step);

        }
Example #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();
        }
 protected void ReadPdbs(List <string> structures)
 {
    try
    {
        pdbs = new PDBFiles();
        foreach (var item in structures)
        {
             pdbs.AddPDB(item, PDBMODE.ONLY_SEQ);
             currentProgress++;
        }
      //  pdbs.AddPDB(structures, PDBMODE.ONLY_CA,ref currentV);
        //pdbs.AddPDB(structures, PDBMODE.ONLY_SEQ, ref currentV);
    }
    catch (Exception ex)
    {
        throw new Exception(ex.Message);
    }
    
 }
Example #4
0
        public  ClusterOutput RunSift(string dirName)
        {
            Options opt=new Options();
            opt.ReadDefaultFile();

            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);

            listFiles = new List<string>(files.Length);
            foreach(var item in files)
                listFiles.Add(item);

            return Shape();

        }
Example #5
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();
 }
Example #6
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();
         }
Example #7
0
        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();            
        }
Example #8
0
        public override int Run(object processParams)
        {
            Dictionary<int, List<int>> contacts= new Dictionary<int, List<int>>();
            string fileName = ((ThreadFiles)(processParams)).fileName;

            List<string> files = threadingList[((ThreadFiles)(processParams)).threadNumber];// CheckFile(listFile);
            if (files.Count == 0)
                return 0;
            StreamWriter wr;
                                 
            if (File.Exists(fileName))
                wr = File.AppendText(fileName);
            else
                wr = new StreamWriter(fileName);

            if (wr == null)
                throw new Exception("Cannot open file: " + fileName);

            PDBFiles pdbs = new PDBFiles();

            string refSeqFile = ((ThreadFiles)(processParams)) + ".ref";
            pdbs.ReadRefSeq(refSeqFile);
            maxV = files.Count;
            try
            {
                foreach (var item in files)
                {
                    string strName;
                    //strName = pdbs.AddPDB(item, PDBMODE.CA_CB);
                    if (this.GetType() == typeof(ContactProfile))
                        strName = pdbs.AddPDB(item, PDBMODE.ALL_ATOMS);
                    else
                        strName = pdbs.AddPDB(item, PDBMODE.ONLY_CA);
                    if(strName!=null)
                        MakeProfiles(strName,pdbs.molDic[strName], wr);

                    currentProgress++;
                }
            }
            catch (Exception ex)
            {
               // wr.Close();
                throw new Exception(ex.Message);
            }

            wr.Close();
            currentProgress = maxV;
            return 0;
        }
       protected void MakeProfiles(string strName,MolData molDic,StreamWriter wr,int k)
       {
           if (molDic != null)
           {
               PDBFiles pdb = new PDBFiles();
               pdb.AddPDB(strName, PDBMODE.ONLY_CA);
               DebugClass.WriteMessage("Make Started");
               //int []contact=pdbs.molDic[strName].CreateFullContactMap(8.5f);
               //molDic.CreateFullContactMap(9.5f,contact[k]);//correct
               List<string> cc=new List<string>(pdb.molDic.Keys);
               pdb.molDic[cc[0]].indexMol = molDic.indexMol;
               GenerateContactMap(pdb.molDic[cc[0]],k);
               //pdb.molDic[cc[0]].CreateFullContactMap(8.5f, contact[k]);               
               //molDic.CreateFullContactMap(8.5f,contact[k]);
               //pdbs.molDic[strName].CreateContactMap(9.5f, "CB");

            
               for (int i = 0; i < contact[k].Length; i++)
                   if (contact[k][i] == 1)
                       contOne[i]++;
               int j = 0;
               for (int i = 0; i < contact[k].Length - 1; i++)
               {
                   if (contact[k][i] == 1)
                       contactToString[k][j++] = '1';
                   else
                       contactToString[k][j++] = '0';

                   contactToString[k][j++] = ' ';
               }
               if (contact[k][contact[k].Length - 1] == 1)
                   contactToString[k][j] = '1';
               else
                   contactToString[k][j] = '0';

               string all = new string(contactToString[k], 0, j);

               wr.WriteLine(">" + cc[0]);
               //for (int i = 0; i < contact[k].Length-1; i++)               
                 //  wr.Write(contact[k][i]+" ");
               //wr.Write(contact[k][contact.Length-1]);
               wr.WriteLine(all);
               //wr.WriteLine();
               //molDic.CleanMolData();
               DebugClass.WriteMessage("Make finished");
           }
          
       }