Example #1
0
 public ThresholdCForm(ThresholdCInput obj,bool flag,List<string> profiles=null)
 {
     InitializeComponent();
     if (profiles != null)
     {
         button3.Visible = true;
         profileFile = profiles[0];
     }
     else
         button3.Visible = false;
     if (flag)
         distanceControl1.FreezDist();
     Settings set = new Settings();
     set.Load();
     if (set.mode == INPUTMODE.RNA)
         distanceControl1.HideAtoms = true;
     if (obj != null)
     {
         numericUpDown1.Value = (decimal)obj.distThresh;
         minCluster.Value = (decimal)obj.bakerNumberofStruct;
         distanceControl1.profileName = obj.hammingProfile;
         distanceControl1.distDef = obj.hDistance;
         distanceControl1.CAtoms = obj.hAtoms;
     }
     
 }
        public SelectBestToNatiive(List <string> structures)
        {
            InitializeComponent();
            Settings set = new Settings();
            set.Load();
            if (set.mode == INPUTMODE.RNA)
                selectBest1.HideAtoms = true;

            this.structures = new List<string>(structures);
        }
Example #3
0
        public KMeansForm(KmeansInput obj, bool flag,INPUTMODE inputmode,List<string> profiles=null)
        {
            InitializeComponent();
            this.inputmode = inputmode;
            if (profiles != null)
            {
                button3.Visible = true;
                profileFile = profiles[0];
            }
            else
                button3.Visible = false;
            distanceControl1.changedProfile = juryChanged;
            Settings set = new Settings();
            set.Load();
            if (set.mode == INPUTMODE.RNA)
                distanceControl1.HideAtoms = true;

            jury1DSetup1.profileNameChanged = juryChanged;
            if (flag)
                distanceControl1.FreezDist();


            if (obj != null)
            {
                kmeansMaxK.Value = (decimal)obj.maxK;
                if (obj.kMeans_init == Initialization.Jury1D)
                {
                    juryRadio.Checked = true;
                    randomRadio.Checked = false;
                }
                else
                {
                    juryRadio.Checked = false;
                    randomRadio.Checked = true;
                }

                distanceControl1.distDef = obj.kDistance;
                distanceControl1.CAtoms = obj.kAtoms;
                distanceControl1.profileName = obj.hammingProfile;
                jury1DSetup1.profileName = obj.jury1DProfile;
                numericUpDown1.Value = obj.maxIter;
                distanceControl1.reference = obj.reference1Djury;
                distanceControl1.referenceProfile = obj.jury1DProfile;
            }
        }
Example #4
0
        public ClusterStat(ClusterOutput output,string winName)
        {
            this.output = output;
            this.alignFile = output.alignFile;// output[0].loadableProfile;
            InitializeComponent();
            Settings set = new Settings();
            set.Load();
            if (set.mode == INPUTMODE.RNA)
                distanceControl1.HideAtoms = true;
            dataGridView2.Columns[1].ValueType=typeof(Double);
            this.Text = winName;
            if (output == null)
                return;


            if (output!=null && output.hNode != null)
                button2.Visible = true;
            else
            {
                button3.Enabled = true;
                if(output.clusters!=null)
                    selected = output.clusters;
                else
                    if (output.juryLike != null)
                    {
                        selected = new List<List<string>>();
                        List<string> n = new List<string>();
                        foreach (var item in output.juryLike)
                            n.Add(item.Key);
                        selected.Add(n);
                    }
            }
            string fileName = output.dirName + ".pdb";
            if (File.Exists(fileName))
                textBox1.Text = fileName;
            if (Directory.Exists(output.dirName))
            {
                dirName = output.dirName;
                textBox2.Text = dirName;
            }
            fileName=output.dirName+Path.DirectorySeparatorChar+Path.GetFileName(output.dirName);
            if (File.Exists(fileName))
                textBox3.Text = fileName;
        }
Example #5
0
        public RankingCForm(RankingCInput obj,ClusterAlgorithm alg,bool flag,INPUTMODE inputMode,List<string> profFiles=null)
        {
            this.alg = alg;
            this.inputMode = inputMode;
            InitializeComponent();
            if (profFiles != null)
            {
                profileFile = profFiles[0];
                button3.Visible = true;
            }
            else
                button3.Visible = false;
            Settings set = new Settings();
            set.Load();
            if (set.mode == INPUTMODE.RNA)
                distanceControl1.HideAtoms = true;

            if (flag)
            {
                distanceControl1.FreezDist();
                sift.Enabled = false;
                if (sift.Checked)
                {
                    jury1d.Checked = true;
                
                }
            }
            switch(alg)
            {    
                case ClusterAlgorithm.Jury1D:            
                    jury1d.Checked = true;
                    jury3d.Checked = false;
                    sift.Checked = false;
                    break;
                case ClusterAlgorithm.Jury3D:
                    jury1d.Checked = false;
                    jury3d.Checked = true;
                    sift.Checked = false;
                    break;
                case ClusterAlgorithm.Sift:
                    jury1d.Checked = false;
                    jury3d.Checked = false;
                    sift.Checked = true;
                    break;
                default:
                    jury1d.Checked = true;
                    jury3d.Checked = false;
                    sift.Checked = false;
                    break;
             }
            if (obj != null)
            {
                distanceControl1.distDef = obj.oDistance;
                distanceControl1.CAtoms = obj.oAtoms;
                distanceControl1.profileName = obj.hammingProfile;
                jury1DSetup1.profileName = obj.juryProfile;
                distanceControl1.referenceProfile = obj.referenceProfile;
                distanceControl1.reference = obj.reference1Djury;
            }
            if(jury1d.Checked)
                distanceControl1.Enabled = false;
        }
Example #6
0
        public Form1()
        {            
            InitializeComponent();
            InternalProfilesManager.RemoveProfilesFile();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
            
            System.OperatingSystem osinfo=System.Environment.OSVersion;
            DebugClass.WriteMessage("system: " + osinfo.VersionString+" "+Environment.Is64BitOperatingSystem);
            profiles=InternalProfilesManager.InitProfiles();

            manager.beginJob = AddItemToList;
            manager.updateJob = UpdateListBox;
            manager.message = ErrorMessage;


            TimeInterval.InitTimer(UpdateProgress);

/*            this.toolsToolStripMenuItem.DropDownItems.Remove(this.best5ToolStripMenuItem);
            this.toolsToolStripMenuItem.DropDownItems.Remove(this.compareBest5ToolStripMenuItem);
            this.toolsToolStripMenuItem.DropDownItems.Remove(this.best5RmsdCenterToolStripMenuItem);*/


            /*string[] dirs = Directory.GetDirectories("Y:\\casp10","T065*");
            foreach (var item in dirs)
            {
                string[] Files = Directory.GetFiles(item);
                List<string> ddd = new List<string>(Files);
               

                Rmsd rmsd = new Rmsd(ddd, "", false, PDB.PDBMODE.ONLY_CA);
                List <string> kk =new List<string>();
                foreach(var nn in Files)
                {
                    string[] aux = nn.Split(Path.DirectorySeparatorChar);
                    kk.Add(aux[aux.Length - 1]);
                }
                string []aa=item.Split(Path.DirectorySeparatorChar);
                rmsd.DistStat(kk,aa[aa.Length-1]);
            }*/
           /* List <string> ddd=new List<string>();
            ddd.Add("y:\\TASSER_decoys\\1af7.pdb");
            ddd.Add("y:\\TASSER_decoys\\1af7\\d1216.pdb");
            DistanceMeasure maxsub = new MaxSub(ddd, "", false);

            double cc = maxsub.GetDistance("1af7.pdb","d1216.pdb");*/

            try
            {
                manager.opt.ReadDefaultFile();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message);
            }

            Settings setCheck = new Settings();

            try
            {
                setCheck.Load();
            }
            catch
            {
                MessageBox.Show("First you have to set options!");
                SetSettings(false);
            }
            foreach (var item in Enum.GetValues(typeof(INPUTMODE)))
            {
                comboBox1.Items.Add(item);
            }
            comboBox1.SelectedItem = setCheck.mode;           

            foreach (var item in manager.opt.dataDir)
                listBox1.Items.Add((string)item);

            foreach (var item in manager.opt.dcdFiles)
                listBox1.Items.Add(item);

            foreach (var item in manager.opt.profileFiles)
                listBox1.Items.Add(item+" profiles");

            if (manager.opt.profileFiles.Count > 0)
            {
                radioButton1.Enabled = false;
                radioButton2.Enabled = false;
                radioButton3.Enabled = false;
                radioButton4.Checked = true;
            }

            SetDataDirOptions();
        }
Example #7
0
        private void setingsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SetSettings(true);
            
            Settings setCheck = new Settings();            
            setCheck.Load();
            InternalProfilesManager.RemoveProfilesFile();
            foreach (var item in profiles)
            {
                item.ClearProfiles();
                item.LoadProfiles();
                if (item.GetMode().Contains(setCheck.mode))
                    item.AddInternalProfiles();
            }

        }
Example #8
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if ((INPUTMODE)comboBox1.SelectedItem == INPUTMODE.PROTEIN || (INPUTMODE)comboBox1.SelectedItem == INPUTMODE.RNA)
     {
         radioButton4.Visible = false;
         radioButton1.Visible = true;
         radioButton2.Checked = true;
         radioButton2.Visible = true;
         radioButton3.Visible = true;
     }
     else
     {
     //    radioButton4.Visible = true;
         radioButton4.Checked = true;
         radioButton1.Visible = false;
         radioButton2.Visible = false;
         radioButton3.Visible = false;
         
     }
     listBox1.Items.Clear();
     Settings s = new Settings();
     s.Load();
     s.mode = (INPUTMODE)comboBox1.SelectedItem;
     s.Save();
 }
        public HierarchicalCForm(HierarchicalCInput obj,ClusterAlgorithm alg,INPUTMODE mode,bool flag,List<string> profiles)
        {
            this.alg = alg;
            objCopy = obj;
            this.mode = mode;
            InitializeComponent();
            if (profiles != null)
            {
                button3.Visible = true;
                profileFile = profiles[0];
            }
            else
                button3.Visible = false;

            userHash1.regularizationOff();
            SizeHeight = this.Size.Height;
            distanceControl1.refChanged = ReferanceCheckChanged;
            //distanceControl1.FreezeCAtoms();
            Settings set = new Settings();
            set.Load();
            if (set.mode == INPUTMODE.RNA)
                distanceControl1.HideAtoms = true;
            
            foreach (var item in Enum.GetValues(typeof(AglomerativeType)))
                comboBox1.Items.Add(Enum.GetName(typeof(AglomerativeType),item));

            if (obj != null)
            {                
                comboBox1.SelectedItem=Enum.GetName(typeof(AglomerativeType),obj.linkageType);                
                numericBox1.Text = obj.numInitNodes.ToString();
                DBIndex.Value = (decimal)obj.indexDB;
                threshold.Value = (decimal)obj.numberOfStruct;
                maxRepeat.Value = (decimal)obj.repeatTime;
                maxK.Value = (decimal)obj.maxK;
                
                switch (alg)
                {
                    case ClusterAlgorithm.FastHCluster:
                        AglomRadio.Checked = false;
                        FastHClusterRadio.Checked = true;
                        KmeansRadio.Checked = false;
                        userHash1.Visible = false;
                        radioButton3.Checked = false;
                        groupBox1.Visible = true;
                        if (radioButton1.Checked)
                            if (distanceControl1.reference)
                                jury1DSetup3.Visible = false;
                            else
                                jury1DSetup3.Visible = true;
                        this.Size = new Size(this.Size.Width, SizeHeight / 2 + SizeHeight / 4);
                        distanceControl1.reference = obj.reference1DjuryFast;
                        distanceControl1.referenceProfile = obj.consensusProfile;
                        userHash1.profRefFile = obj.jury1DProfileFast;
                        break;
                    case ClusterAlgorithm.HKmeans:
                        AglomRadio.Checked = false;
                        FastHClusterRadio.Checked = false;
                        KmeansRadio.Checked = true;
                        groupBox1.Visible = false;
                        radioButton3.Checked = false;
                        userHash1.Visible = false;
                        this.Size = new Size(this.Size.Width, SizeHeight / 2 + SizeHeight/3);
                        distanceControl1.reference = obj.reference1DjuryKmeans;
                        distanceControl1.referenceProfile = obj.jury1DProfileKmeans;
                        break;
                    case ClusterAlgorithm.uQlustTree:
                        userHash1.Visible = true;
                        AglomRadio.Checked = false;
                        FastHClusterRadio.Checked = false;
                        KmeansRadio.Checked = false;
                        groupBox1.Visible = false;
                        radioButton3.Checked = true;
                        this.Size = new Size(this.Size.Width, SizeHeight);
                        distanceControl1.reference = obj.reference1DjuryH;
                        distanceControl1.referenceProfile = obj.jury1DProfileH;
                        break;
                    default://Aglomerative
                        AglomRadio.Checked = true;
                        FastHClusterRadio.Checked = false;
                        KmeansRadio.Checked = false;
                        groupBox1.Visible = false;
                        userHash1.Visible = false;
                        radioButton3.Checked = false;
                        distanceControl1.reference = obj.reference1DjuryAglom;
                        distanceControl1.referenceProfile = obj.jury1DProfileAglom;
                        break;
                }
                distanceControl1.distDef = obj.distance;
                distanceControl1.CAtoms = obj.atoms;
                distanceControl1.profileName = obj.hammingProfile;
                
                jury1DSetup3.profileName = obj.consensusProfile;
                checkBox2.Checked = obj.ItMeans;
                numericUpDown1.Value = obj.ItNum;
                if (obj.HConsensus)
                {
                    radioButton1.Checked = false;
                    radioButton2.Checked = true;
                }
                else
                {
                    radioButton1.Checked = true;
                    radioButton2.Checked = false;
                }
                if (flag)
                {
                    distanceControl1.FreezDist();
                  //  distanceControl1.distDef = DistanceMeasures.HAMMING;
                }
               // distanceControl1.CAtoms = PDB.PDBMODE.ONLY_CA;
                userHash1.SetHash(obj.hash);
            }
        }
Example #10
0
        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;
        }
Example #11
0
        private void EditProfile(string Path, bool edit,profileType type)
        {
            ProfileDefinitionForm profDef = null ;
            InternalProfileForm internalDef = null;
            profileNode node = null;
            profileNode newNode = null;
            DialogResult res=DialogResult.Cancel;

            if (edit)
            {
                    node = treeProfiles.FindNode(Path);
                    if (node.internalName!=null)
                    {
                        internalDef = new InternalProfileForm(node,filter);
                        res = internalDef.ShowDialog();
                        if (res == DialogResult.OK)
                        {
                            newNode = internalDef.localNode;
                            toolSave.Enabled = true;
                            toolStripButton6.Enabled = true;
                        }
                    }
                    else
                    {
                        profDef = new ProfileDefinitionForm(node);                        
                        res = profDef.ShowDialog();
                        if (res == DialogResult.OK)
                        {
                            newNode = profDef.profile;
                            toolSave.Enabled = true;
                            toolStripButton6.Enabled = true;
                        }
                    }
            }
            else
            {
                if (Path == null)
                    Path = "Profiles";
                if (type == profileType.EXTERNAL)
                {
                    profDef = new ProfileDefinitionForm();
                    res = profDef.ShowDialog();
                    if (res == DialogResult.OK)
                    {
                        node = profDef.profile;
                        node.internalName = null;
                        toolSave.Enabled = true;
                        toolStripButton6.Enabled = true;
                    }
                }
                else
                {
                    Settings set=new Settings();
                    set.Load();
                    InternalProfilesManager manager = new InternalProfilesManager();
                    List<profileNode> validProfiles = new List<profileNode>();
                    foreach (var item in InternalProfilesManager.internalList.Keys)
                        if (manager.CheckAccessibility(item, set.mode))
                            validProfiles.Add(item);

                    ListInternal intr = new ListInternal(validProfiles);

                    res = intr.ShowDialog();

                    if (res == DialogResult.OK)
                    {
                        InternalProfileForm intForm;
                        profileNode localNode = InternalProfilesManager.GetNode(intr.selectedProfile);
                        if(localNode.profName.Contains("Load"))
                            intForm = new InternalProfileForm(localNode,filter,false);
                        else
                            intForm = new InternalProfileForm(localNode,filter);

                        res = intForm.ShowDialog();
                        if (res == DialogResult.OK)
                        {
                            node = intForm.localNode;
                            node.profProgram = intr.selectedProfile;
                            newNode = node;
                            toolSave.Enabled = true;
                            toolStripButton6.Enabled = true;

                        }
                    }
                }
            }

            if (res == DialogResult.OK)
            {
                if (node != null && File.Exists(node.OutFileName))
                    File.Delete(node.OutFileName);
                //profChanged = true;

                if (!edit)
                {
                    //profChanged = true;
                    Regex exp = new Regex("^/");

                    TreeNode nodeT;//= new TreeNode(profDef.profile.profName);

                    string nPath = "";
                    if (Path != null)
                        nPath = exp.Replace(Path, "");
                    if (profilesView.SelectedNode == null)
                    {
                        nodeT = profilesView.Nodes[0].Nodes.Add(node.profName);
                        profilesView.Nodes[0].Expand();
                    }
                    else
                    {
                        nodeT = profilesView.SelectedNode.Nodes.Add(node.profName);
                        profilesView.SelectedNode.Expand();
                    }
                    nodeT.Tag = newNode;
                    Regex exp2 = new Regex("^Profiles");
                    Path = exp2.Replace(Path, "");
                    treeProfiles.AdddNode(Path, node);
                }
                else
                {
                    profilesView.SelectedNode.Text = node.profName;
                    treeProfiles.RemoveNode(Path);
                    Regex exp2 = new Regex("^Profiles");
                    Path = exp2.Replace(Path, "");
                    treeProfiles.AdddNode(ParentPath(Path),newNode);
                    node.CopyNode(newNode);
                    ShowTree();
                }

            }
        }