コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="isUpdate"></param>
        /// <returns></returns>
        private DataTable CreatePfamDnaRnaInteractTable(bool isUpdate)
        {
            string[]  pfamDnaRnaCols = { "PdbID",    "BuID",           "ChainDomainID", "PfamID", "DnaRnaChain", "DnaRnaSymmetryString",
                                         "AsymChain", "SymmetryString", "DnaRnaSeqID",   "SeqID",  "HmmSeqID" };
            DataTable pfamDnaRnaTable = new DataTable("pfamDnaRnas");

            foreach (string col in pfamDnaRnaCols)
            {
                pfamDnaRnaTable.Columns.Add(new DataColumn(col));
            }
            if (!isUpdate)
            {
                DbCreator dbCreate          = new DbCreator();
                string    createTableString = "Create Table " + pfamDnaRnaTable.TableName + " ( " +
                                              " PdbID CHAR(4) NOT NULL, " +
                                              " BuID VARCHAR(8) NOT NULL, " +
                                              " PfamID VARCHAR(40) NOT NULL, " +
                                              " ChainDomainID INTEGER NOT NULL, " +
                                              " DnaRnaChain CHAR(3) NOT NULL, " +
                                              " DnaRnaSymmetryString VARCHAR(15), " +
                                              " DnaRnaSeqID INTEGER NOT NULL, " +
                                              " AsymChain CHAR(3) NOT NULL, " +
                                              " SymmetryString VARCHAR(15), " +
                                              " SeqID INTEGER NOT NULL, " +
                                              " HmmSeqID INTEGER NOT NULL);";
                dbCreate.CreateTableFromString(ProtCidSettings.protcidDbConnection, createTableString, pfamDnaRnaTable.TableName);

                string createIndexString = "CREATE INDEX " + pfamDnaRnaTable.TableName + "_idx1 ON " + pfamDnaRnaTable.TableName + "(PdbID, ChainDomainID);";
                dbCreate.CreateIndex(ProtCidSettings.protcidDbConnection, createIndexString, pfamDnaRnaTable.TableName);
            }
            return(pfamDnaRnaTable);
        }
コード例 #2
0
ファイル: ChainLigands.cs プロジェクト: ijlab/ProtCID
        /// <summary>
        ///
        /// </summary>
        private DataTable InitializeTable(bool isUpdate)
        {
            string[]  pfamLigandColumns = { "PdbID", "AsymID",    "ChainAsymID", "SeqID", "ChainSeqID", "Distance",
                                            "Atom",   "ChainAtom", "Residue",     "ChainResidue" };
            DataTable pfamLigandTable = new DataTable("ChainLigands");

            foreach (string ligandCol in pfamLigandColumns)
            {
                pfamLigandTable.Columns.Add(new DataColumn(ligandCol));
            }
            if (!isUpdate)
            {
                DbCreator dbCreate          = new DbCreator();
                string    createTableString = "Create Table " + pfamLigandTable.TableName + " (" +
                                              " PdbID CHAR(4) NOT NULL, " +
                                              " AsymID CHAR(3) NOT NULL, " +
                                              //    " Ligand CHAR(5) NOT NULL, " +
                                              " ChainAsymID CHAR(3), " +
                                              " SeqID INTEGER NOT NULL, " +
                                              " ChainSeqID INTEGER NOT NULL, " +
                                              " ATOM CHAR(4) NOT NULL, " +
                                              " ChainATom CHAR(4), " +
                                              " Residue CHAR(3), " +
                                              " ChainResidue CHAR(3), " +
                                              " Distance FLOAT" +
                                              " );";
                dbCreate.CreateTableFromString(ProtCidSettings.buCompConnection, createTableString, pfamLigandTable.TableName);
                string createIndexString = "CREATE INDEX " + pfamLigandTable.TableName + "_idx1 ON " + pfamLigandTable.TableName + "(PdbID, AsymID)";
                dbCreate.CreateIndex(ProtCidSettings.buCompConnection, createIndexString, pfamLigandTable.TableName);
            }
            return(pfamLigandTable);
        }
コード例 #3
0
        private void InitializeDbTables()
        {
            DbCreator dbCreate          = new DbCreator();
            string    createTableString = string.Format("CREATE Table {0} ( " +
                                                        " GroupSeqID INTEGER NOT NULL, " +
                                                        " SpaceGroup1 VARCHAR(30) NOT NULL, ASU1 VARCHAR(255) NOT NULL, PDBID1 CHAR(4) NOT NULL, " +
                                                        " NumOfInterfaces1 INTEGER NOT NULL, " +
                                                        " NumOfSgInterfaces1 INTEGER NOT NULL, NumOfSimInterfaces1 INTEGER NOT NULL, " +
                                                        " SpaceGroup2 VARCHAR(30) NOT NULL, ASU2 VARCHAR(255) NOT NULL, PDBID2 CHAR(4) NOT NULL, " +
                                                        " NumOfInterfaces2 INTEGER NOT NULL, " +
                                                        " NumOfSgInterfaces2 INTEGER NOT NULL, NumOfSimInterfaces2 INTEGER NOT NULL, " +
                                                        " MaxQ FLOAT NOT NULL, MinQ FLOAT NOT NULL, " +
                                                        " LeftMaxQ FLOAT NOT NULL, LeftMinQ FLOAT NOT NULL, Identity FLOAT NOT NULL, " +
                                                        " LeftMaxAsa1 FLOAT NOT NULL, LeftMaxAsa2 FLOAT NOT NULL);",
                                                        GroupDbTableNames.dbTableNames[GroupDbTableNames.ReduntCrystForms]);

            dbCreate.CreateTableFromString(ProtCidSettings.protcidDbConnection, createTableString,
                                           GroupDbTableNames.dbTableNames[GroupDbTableNames.ReduntCrystForms]);
            string indexString = string.Format("CREATE INDEX {0}_Idx1 ON {0} (PdbID1);",
                                               GroupDbTableNames.dbTableNames[GroupDbTableNames.ReduntCrystForms]);

            dbCreate.CreateIndex(ProtCidSettings.protcidDbConnection, indexString,
                                 GroupDbTableNames.dbTableNames[GroupDbTableNames.ReduntCrystForms]);
            indexString = string.Format("CREATE INDEX {0}_Idx2 ON {0} (PdbID2);",
                                        GroupDbTableNames.dbTableNames[GroupDbTableNames.ReduntCrystForms]);
            dbCreate.CreateIndex(ProtCidSettings.protcidDbConnection, indexString,
                                 GroupDbTableNames.dbTableNames[GroupDbTableNames.ReduntCrystForms]);
        }
コード例 #4
0
ファイル: NonredundantCfGroups.cs プロジェクト: ijlab/ProtCID
        private void InitializeDbTable()
        {
            DbCreator dbCreat           = new DbCreator();
            string    createTableString = string.Format("CREATE TABLE {0} ( " +
                                                        " GroupSeqID INTEGER NOT NULL, " +
                                                        " CfGroupID INTEGER NOT NULL, " +
                                                        " PdbID CHAR(4) NOT NULL, " +
                                                        " SpaceGroup VARCHAR(30) NOT NULL, " +
                                                        " ASU VARCHAR(255) NOT NULL);",
                                                        GroupDbTableNames.dbTableNames[GroupDbTableNames.NonredundantCfGroups]);

            dbCreat.CreateTableFromString(ProtCidSettings.protcidDbConnection, createTableString,
                                          GroupDbTableNames.dbTableNames[GroupDbTableNames.NonredundantCfGroups]);

            string indexString = string.Format("Create Index {0}_pdb on {0} (PdbID);",
                                               GroupDbTableNames.dbTableNames[GroupDbTableNames.NonredundantCfGroups]);

            dbCreat.CreateIndex(ProtCidSettings.protcidDbConnection, indexString,
                                GroupDbTableNames.dbTableNames[GroupDbTableNames.NonredundantCfGroups]);

            indexString = string.Format("Create Index {0}_groupcf on {0} (GroupSeqID, CfGroupID);",
                                        GroupDbTableNames.dbTableNames[GroupDbTableNames.NonredundantCfGroups]);
            dbCreat.CreateIndex(ProtCidSettings.protcidDbConnection, indexString,
                                GroupDbTableNames.dbTableNames[GroupDbTableNames.NonredundantCfGroups]);
        }
コード例 #5
0
ファイル: LigandComPfamHmm.cs プロジェクト: ijlab/ProtCID
        /// <summary>
        /// 
        /// </summary>
        /// <param name="isUpdate"></param>
        private void CreateTables(bool isUpdate)
        {
            InitializeComHmmTable();

            if (! isUpdate)
            {
                DbCreator dbCreate = new DbCreator ();
                 string dbCreateTableString = "Create Table " + tableName + " ( " +
                    "PfamID Varchar(40) Not Null, " +
                    "PdbID1 char(4) Not Null, " +
                    "ChainDomainID1 Integer Not Null, " +
                    "LigandChain1 char(3) Not Null, " +
                    "PdbID2 char(4) Not Null, " +
                    "ChainDomainID2 Integer Not Null, " +
                    "LigandChain2 char(3) Not Null, " +
                    "NumOfHmmSites1 Integer Not Null, " +
                    "NumOfHmmSites2 Integer Not Null, " +
                    "NumOfComHmmSites Integer Not Null, " +
                    "Jscore FLOAT Not Null);";
                dbCreate.CreateTableFromString(ProtCidSettings.protcidDbConnection, dbCreateTableString, tableName);
                string indexString = "Create Index PfamLigandComHmm_pfam on " + tableName + " (PfamID)";
                dbCreate.CreateIndex(ProtCidSettings.protcidDbConnection, indexString, tableName);
                indexString = "Create Index PfamLigandComHmm_pdb on " + tableName + "(PdbID1, PdbID2)";
                dbCreate.CreateIndex(ProtCidSettings.protcidDbConnection, indexString, tableName);
                indexString = "Create Index PfamLigandComHmm_pdb1 on " + tableName + "(PdbID1, ChainDomainID1)";
                dbCreate.CreateIndex(ProtCidSettings.protcidDbConnection, indexString, tableName);
                indexString = "Create Index PfamLigandComHmm_pdb2 on " + tableName + "(PdbID2, ChainDomainID2)";
                dbCreate.CreateIndex(ProtCidSettings.protcidDbConnection, indexString, tableName);
            }
        }
コード例 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="isUpdate"></param>
        /// <returns></returns>
        private DataTable CreateTable(bool isUpdate)
        {
            string tableName = "PfamClansInPDB";

            string[]  clanColumns       = { "ClanAcc", "NumPfams", "NumPfamsPdb", "NumPfamsPeptide", "NumPfamsDnaRna", "NumEntries", "NumUniprots" };
            DataTable pfamClansPdbTable = new DataTable(tableName);

            foreach (string col in clanColumns)
            {
                pfamClansPdbTable.Columns.Add(new DataColumn(col));
            }

            if (!isUpdate)
            {
                string createTableString = "Create Table " + tableName + " ( " +
                                           " ClanAcc              VARCHAR(10) NOT NULL, " +
                                           " NumPfams             Integer NOT NULL, " +
                                           " NumPfamsPdb          Integer NOT NULL, " +
                                           " NumPfamsPeptide      Integer NOT NULL, " +
                                           " NumPfamsDnaRna       Integer NOT NULL, " +
                                           " NumEntries           Integer NOT NULL, " +
                                           " NumUniProts          Integer NOT NULL " +
                                           ");";
                DbCreator dbCreator = new DbCreator();
                dbCreator.CreateTableFromString(ProtCidSettings.pdbfamDbConnection, createTableString, "PfamClansInPDB");
            }
            return(pfamClansPdbTable);
        }
コード例 #7
0
 /// <summary>
 /// Creates the database.
 /// </summary>
 public void CreateDatabase()
 {
     NotBusy = false;
     Connecting(this, EventArgs.Empty);
     DbCreator.Create(AsBuilder.ConnectionString, ConfigurationService.CurrentSchemaVersion);
     NotBusy = true;
 }
コード例 #8
0
 /// <summary>
 /// Tests this instance.
 /// </summary>
 private void Test()
 {
     NotBusy = false;
     Connecting(this, EventArgs.Empty);
     DbCreator.Test(AsBuilder.ConnectionString);
     NotBusy = true;
 }
コード例 #9
0
        /// <summary>
        ///
        /// </summary>
        private void InitializeDbTables()
        {
            DbCreator dbCreate = new DbCreator();

            if (dbCreate.IsTableExist(ProtCidSettings.protcidDbConnection, crystBuInterfaceCompTables[(int)BuType.PDB].TableName))
            {
                return;
            }
            string createTableString = string.Format("Create Table {0} ( " +
                                                     "PdbID CHAR(4) NOT NULL, InterfaceId INTEGER NOT NULL, " +
                                                     "BuID VARCHAR(8), BuInterfaceID INTEGER, QScore FLOAT);",
                                                     crystBuInterfaceCompTables[(int)BuType.PDB].TableName);

            dbCreate.CreateTableFromString(ProtCidSettings.protcidDbConnection, createTableString, crystBuInterfaceCompTables[(int)BuType.PDB].TableName);

            string indexString = string.Format("Create INDEX {0}_Idx1 " +
                                               " ON {0} (PdbID, InterfaceID);", crystBuInterfaceCompTables[(int)BuType.PDB].TableName);

            dbCreate.CreateIndex(ProtCidSettings.protcidDbConnection, indexString, crystBuInterfaceCompTables[(int)BuType.PDB].TableName);


            createTableString = string.Format("Create Table {0} ( " +
                                              "PdbID CHAR(4) NOT NULL, InterfaceId INTEGER NOT NULL, " +
                                              "BuID VARCHAR(8), BuInterfaceID INTEGER, QScore FLOAT);",
                                              crystBuInterfaceCompTables[(int)BuType.PISA].TableName);
            dbCreate.CreateTableFromString(ProtCidSettings.protcidDbConnection, createTableString, crystBuInterfaceCompTables[(int)BuType.PISA].TableName);

            indexString = string.Format("Create INDEX {0}_Idx1 " +
                                        " ON {0} (PdbID, InterfaceID);", crystBuInterfaceCompTables[(int)BuType.PISA].TableName);
            dbCreate.CreateIndex(ProtCidSettings.protcidDbConnection, indexString, crystBuInterfaceCompTables[(int)BuType.PISA].TableName);
        }
コード例 #10
0
 public LoginViewModel()
 {
     db = new DbCreator();
     db.CreateDbConnection();
     LoginCommand = new RelayCommand(Login);
     CloseCommand = new RelayCommand(Close);
 }
コード例 #11
0
ファイル: PfamLigandClusters.cs プロジェクト: ijlab/ProtCID
        /// <summary>
        ///
        /// </summary>
        /// <param name="isUpdate"></param>
        private void CreateTables(bool isUpdate)
        {
            pfamLigandClusterTable = new DataTable(tableName);
            string[] clusterCols = { "PfamID", "ClusterID", "PdbID", "ChainDomainID", "LigandChain", "LigandFileChain" };
            foreach (string col in clusterCols)
            {
                pfamLigandClusterTable.Columns.Add(new DataColumn(col));
            }

            if (!isUpdate)
            {
                DbCreator dbCreate          = new DbCreator();
                string    createTableString = "Create Table " + tableName + " ( " +
                                              "PfamID varchar(40) NOT NULL, " +
                                              "ClusterID Integer NOT NULL, " +
                                              "PdbID char(4) Not Null, " +
                                              "ChainDomainID Integer Not Null, " +
                                              "LigandChain char(3) Not Null, " +
                                              "LigandFileChain char(3) Not Null);";
                dbCreate.CreateTableFromString(ProtCidSettings.protcidDbConnection, createTableString, tableName);
                string createIndexString = "Create Index " + tableName + "_cluster ON " + tableName + "(PfamID, ClusterID);";
                dbCreate.CreateIndex(ProtCidSettings.protcidDbConnection, createIndexString, tableName);
                createIndexString = "Create Index " + tableName + "_pdb ON " + tableName + "(PdbID, ChainDomainID);";
                dbCreate.CreateIndex(ProtCidSettings.protcidDbConnection, createIndexString, tableName);
            }
        }
コード例 #12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="isUpdate"></param>
        private void InitializeTables(bool isUpdate)
        {
            string tableName = "PdbPfamDomainFileInfo";

            string[] tableCols = { "PdbID", "DomainID", "EntityID", "AsymChain", "SeqStart", "SeqEnd", "FileStart", "FileEnd" };
            domainFileInfoTable = new DataTable(tableName);
            foreach (string col in tableCols)
            {
                domainFileInfoTable.Columns.Add(new DataColumn(col));
            }

            if (!isUpdate)
            {
                DbCreator dbCreate          = new DbCreator();
                string    createTableString = "CREATE TABLE " + tableName + " ( " +
                                              "PdbID CHAR(4) NOT NULL, " +
                                              "DomainID BIGINT NOT NULL, " +
                                              "EntityID INTEGER NOT NULL, " +
                                              "AsymChain CHAR(3) NOT NULL, " +
                                              "SeqStart INTEGER NOT NULL, " +
                                              "SeqEnd INTEGER NOT NULL, " +
                                              "FileStart INTEGER NOT NULL, " +
                                              "FileEnd INTEGER NOT NULL );";
                dbCreate.CreateTableFromString(createTableString, tableName);
                string createIndexString = "CREATE INDEX " + tableName + "_idx1 ON " + tableName + "(PdbID);";
                dbCreate.CreateIndex(createIndexString, tableName);
                createIndexString = "CREATE INDEX " + tableName + "_idx2 ON " + tableName + "(DomainID);";
                dbCreate.CreateIndex(createIndexString, tableName);
            }
        }
コード例 #13
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private DataTable CreateTables(bool isUpdate)
        {
            DataTable pepInterfaceClusterStatTable = new DataTable("PfamPepClusterSumInfo");

            string[] sumColumns = { "PfamID",        "ClusterID",  "NumEntries",  "NumPepPfams",    "NumUnpSeqs", "NumCFs",
                                    "NumPepUnpSeqs", "NumPepSeqs", "SurfaceArea", "MinSeqIdentity", "ClusterInterface" };
            foreach (string col in sumColumns)
            {
                pepInterfaceClusterStatTable.Columns.Add(new DataColumn(col));
            }

            if (!isUpdate)
            {
                DbCreator dbCreate          = new DbCreator();
                string    createTableString = "Create Table " + pepInterfaceClusterStatTable.TableName + " ( " +
                                              " PfamID VARCHAR(40) NOT NULL, " +
                                              " ClusterID Integer Not NULL, " +
                                              " NumEntries Integer NOT NULL, " +
                                              " NumCFs Integer  NOT NULL," +
                                              " NumPepPfams Integer NOT NULL, " +
                                              " NumUnpSeqs Integer NOT NULL, " +
                                              " NumPepUnpSeqs Integer Not NULL, " +
                                              " NumPepSeqs Integer Not NULL, " +
                                              " SurfaceArea FLOAT, " +
                                              " MinSeqIdentity FLOAT, " +
                                              " ClusterInterface CHAR(10));";
                dbCreate.CreateTableFromString(ProtCidSettings.protcidDbConnection, createTableString, pepInterfaceClusterStatTable.TableName);
            }
            return(pepInterfaceClusterStatTable);
        }
コード例 #14
0
        /// <summary>
        ///
        /// </summary>
        private void InitializeResiduesContactsTables()
        {
            DbCreator dbCreator = new DbCreator();

            string tableName         = "SgInterfaceResidues";
            string createTableString = "CREATE TABLE " + tableName + " ( " +
                                       "PDBID        CHAR(4) NOT NULL, " +
                                       "INTERFACEID  INTEGER NOT NULL, " +
                                       "RESIDUE1     CHAR(3) NOT NULL, " +
                                       "SEQID1       CHAR(5) NOT NULL,  " +
                                       "RESIDUE2     CHAR(3) NOT NULL, " +
                                       "SEQID2       CHAR(5) NOT NULL, " +
                                       "DISTANCE     FLOAT NOT NULL);";

            dbCreator.CreateTableFromString(ProtCidSettings.protcidDbConnection, createTableString, tableName);
            string createIdxString = string.Format("CREATE INDEX {0}_Idx1 ON {0} (PdbID, InterfaceID);", tableName);

            dbCreator.CreateIndex(ProtCidSettings.protcidDbConnection, createIdxString, tableName);


            tableName         = "SgInterfaceContacts";
            createTableString = "CREATE TABLE " + tableName + " ( " +
                                "PDBID        CHAR(4) NOT NULL, " +
                                "INTERFACEID  INTEGER NOT NULL, " +
                                "RESIDUE1     CHAR(3) NOT NULL, " +
                                "SEQID1       CHAR(5) NOT NULL,  " +
                                "RESIDUE2     CHAR(3) NOT NULL, " +
                                "SEQID2       CHAR(5) NOT NULL, " +
                                "DISTANCE     FLOAT NOT NULL);";
            dbCreator.CreateTableFromString(ProtCidSettings.protcidDbConnection, createTableString, tableName);
            createIdxString = string.Format("CREATE INDEX {0}_Idx1 ON {0} (PdbID, InterfaceID);", tableName);
            dbCreator.CreateIndex(ProtCidSettings.protcidDbConnection, createIdxString, tableName);
        }
コード例 #15
0
        /// <summary>
        ///
        /// </summary>
        public static void InitializeGroupTable()
        {
            DbCreator dbCreator         = new DbCreator();
            string    createTableString = "";
            string    createIndexString = "";
            string    tableName         = ProtCidSettings.dataType + "HomoSeqInfo";

            createTableString = "CREATE TABLE " + tableName + " ( " +
                                "GroupSeqID INTEGER NOT NULL, " +
                                "PdbID CHAR(4) NOT NULL, " +
                                "SpaceGroup VARCHAR(30) NOT NULL, " +
                                "ASU VARCHAR(50) NOT NULL, " +
                                "Method VARCHAR(100) NOT NULL, " +
                                "Resolution FLOAT NOT NULL, " +
                                "InPfam CHAR NOT NULL);";
            dbCreator.CreateTableFromString(ProtCidSettings.protcidDbConnection, createTableString, tableName);
            createIndexString = string.Format("CREATE INDEX {0}_idx1 ON {0} (GroupSeqID);", tableName);
            dbCreator.CreateIndex(ProtCidSettings.protcidDbConnection, createIndexString, tableName);
            createIndexString = string.Format("CREATE INDEX {0}_idx2 ON {0} (PdbID);", tableName);
            dbCreator.CreateIndex(ProtCidSettings.protcidDbConnection, createIndexString, tableName);

            tableName         = ProtCidSettings.dataType + "Groups";
            createTableString = "CREATE TABLE " + tableName + " ( " +
                                "GroupSeqID INTEGER NOT NULL, " +
                                "EntryPfamArch BLOB Sub_Type TEXT NOT NULL);";
            dbCreator.CreateTableFromString(ProtCidSettings.protcidDbConnection, createTableString, tableName);
            createIndexString = string.Format("CREATE INDEX {0}_idx1 ON {0} (GroupSeqID);", tableName);
            dbCreator.CreateIndex(ProtCidSettings.protcidDbConnection, createIndexString, tableName);
        }
コード例 #16
0
        public RegistViewModel()
        {
            db = new DbCreator();
            db.CreateDbConnection();

            RegistCommand = new RelayCommand(Regist);
            CloseCommand  = new RelayCommand(Close);
        }
コード例 #17
0
ファイル: BuCompTables.cs プロジェクト: ijlab/ProtCID
        /// <summary>
        ///
        /// </summary>
        public static void InitializeDomainDbTables()
        {
            DbCreator dbCreator         = new DbCreator();
            string    tableName         = "";
            string    createTableString = "";
            string    createIndexString = "";

            #region domain interfaces data
            foreach (string buType in BuCompBuilder.buTypes)
            {
                if (buType == "asu")
                {
                    tableName = buType + "PfamDomainInterfaces";
                }
                else
                {
                    tableName = buType + "PfamBuDomainInterfaces";
                }
                createTableString = "CREATE TABLE " + tableName + " ( " +
                                    "RelSeqID INTEGER NOT NULL, " +
                                    "PdbID CHAR(4) NOT NULL, " +
                                    "BUID VARCHAR(8) NOT NULL, " +
                                    "InterfaceID INTEGER NOT NULL, " +
                                    "DomainInterfaceID INTEGER NOT NULL, " +
                                    "DomainID1 INTEGER NOT NULL, " +
                                    "DomainID2 INTEGER NOT NULL, " +
                                    "IsReversed CHAR(1) NOT NULL );";
                dbCreator.CreateTableFromString(ProtCidSettings.buCompConnection, createTableString, tableName);
                createIndexString = string.Format("CREATE INDEX {0}_Idx1 ON {0} (PdbID, BuID);", tableName);
                dbCreator.CreateIndex(ProtCidSettings.buCompConnection, createIndexString, tableName);

                if (buType == "asu")
                {
                    tableName         = "AsuIntraDomainInterfaces";
                    createTableString = "CREATE TABLE AsuIntraDomainInterfaces ( " +
                                        "RelSeqID INTEGER NOT NULL, " +
                                        "PdbID CHAR(4) NOT NULL, " +
                                        "AsymChain CHAR(3) NOT NULL, " +
                                        "DomainInterfaceID INTEGER NOT NULL, " +
                                        "DomainID1 INTEGER NOT NULL, " +
                                        "DomainID2 INTEGER NOT NULL, " +
                                        "IsReversed CHAR(1) NOT NULL);";
                    dbCreator.CreateTableFromString(ProtCidSettings.buCompConnection, createTableString, tableName);
                    createIndexString = string.Format("CREATE INDEX AsuIntraDInterfaces_Idx1 ON {0} (PdbID, AsymChain);", tableName);
                    dbCreator.CreateIndex(ProtCidSettings.buCompConnection, createIndexString, tableName);
                }
            }

            tableName         = "PfamRelations";
            createTableString = "CREATE TABLE " + tableName + " ( " +
                                "RelSeqID INTEGER NOT NULL, " +
                                "FamilyCode1 VARCHAR(15) NOT NULL, " +
                                "FamilyCode2 VARCHAR(15) NOT NULL );";
            dbCreator.CreateTableFromString(ProtCidSettings.buCompConnection, createTableString, tableName);
            createIndexString = string.Format("CREATE INDEX {0}_Idx1 ON {0} (RelSeqID);", tableName);
            dbCreator.CreateIndex(ProtCidSettings.buCompConnection, createIndexString, tableName);
            #endregion
        }
コード例 #18
0
ファイル: App.xaml.cs プロジェクト: jaywhen/Pmer
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            MainWindow mv = new MainWindow();

            this.MainWindow   = mv;
            this.ShutdownMode = ShutdownMode.OnMainWindowClose;

            // 检测是否具备弹出登录窗口的条件
            DbCreator db = new DbCreator();

            db.CreateDbConnection();
            bool isLogin = db.Init();

            if (!isLogin)
            {
                RegistView registView = new RegistView();
                bool?      result     = registView.ShowDialog();
                // 如果注册成功,显示登录界面
                if (result == true)
                {
                    LoginView lw  = new LoginView();
                    bool?     ret = lw.ShowDialog();
                    string    key = lw.PasswordBox.Password;
                    if (ret.Value == true)
                    {
                        mv = new MainWindow(true, key);
                        this.MainWindow = mv;
                        MainWindow.ShowDialog();
                    }
                } // 若用户关闭注册窗口,则退出进程
                else
                {
                    MainWindow.Close();
                }
            }
            else
            {
                LoginView loginView = new LoginView();

                bool?  resultLogin = loginView.ShowDialog();
                string key         = loginView.PasswordBox.Password;
                // 登录成功,进入主界面
                if (resultLogin.Value == true)
                {
                    mv = new MainWindow(true, key);
                    this.MainWindow = mv;
                    MainWindow.ShowDialog();
                } // 否则,退出进程
                else
                {
                    // 需要一个确认退出提示
                    MainWindow.Close();
                }
            }
        }
コード例 #19
0
ファイル: Main.cs プロジェクト: MaiconUnzer/DesignPatterns
        public static void Executar()
        {
            var sqlConnection = DbCreator.Database(Database.SqlServer)     // Retorna um Creator Concreto
                                .CreateConnector("minha connectionString") //Factory Method que retorna um produto concreto
                                .Connect();


            var oracleConnection = DbCreator.Database(Database.Oracle)        // Retorna um Creator Concreto
                                   .CreateConnector("minha connectionString") //Factory Method que retorna um produto concreto
                                   .Connect();
        }
コード例 #20
0
        /// <summary>
        ///
        /// </summary>
        private void CreatProtBudBuTableInDb()
        {
            string[] buColumns         = buQuery.BuTableColumns;
            string   createTableString = "Create Table " + buTableName + "( ";
            string   lowerCaseBuCol    = "";

            foreach (string buCol in buColumns)
            {
                lowerCaseBuCol = buCol.ToLower();
                if (lowerCaseBuCol == "pdbid")
                {
                    createTableString += "PdbID CHAR(4) NOT NULL, ";
                }
                else if (lowerCaseBuCol.IndexOf("buid") > -1)
                {
                    createTableString += (buCol + " VARCHAR(10), ");
                }
                else if (lowerCaseBuCol.IndexOf("_entity") > -1 ||
                         lowerCaseBuCol.IndexOf("_asymid") > -1 ||
                         lowerCaseBuCol.IndexOf("_auth") > -1 ||
                         lowerCaseBuCol.IndexOf("_abc") > -1)
                {
                    createTableString += (buCol + " BLOB SUB_TYPE TEXT NOT NULL, ");
                }
                else if (lowerCaseBuCol == "samebus")
                {
                    createTableString += (buCol + " CHAR(9), ");
                }
                else if (lowerCaseBuCol == "dna" || lowerCaseBuCol == "rna" || lowerCaseBuCol == "ligands")
                {
                    createTableString += (buCol + " CHAR(3), ");
                }
                else if (lowerCaseBuCol == "resolution")
                {
                    createTableString += (buCol + " VARCHAR(32), ");
                }
                else if (lowerCaseBuCol == "names")
                {
                    createTableString += (buCol + " BLOB SUB_TYPE TEXT NOT NULL, ");
                }
            }
            createTableString  = createTableString.TrimEnd(", ".ToCharArray());
            createTableString += ");";
            DbCreator dbCreat = new DbCreator();

            dbCreat.CreateTableFromString(ProtCidSettings.pdbfamDbConnection, createTableString, buTableName);

            string createIndexString = "Create Index " + buTableName + "_idx1 ON " + buTableName +
                                       " ( PdbID, PdbBuID, PisaBuID);";

            dbCreat.CreateIndex(ProtCidSettings.pdbfamDbConnection, createIndexString, buTableName);
        }
コード例 #21
0
ファイル: HhrFileParser.cs プロジェクト: ijlab/ProtCID
        /// <summary>
        ///
        /// </summary>
        /// <param name="isUpdate"></param>
        /// <returns></returns>
        public DataTable CreateHHAlignmentTable(bool isUpdate, string tableName)
        {
            string[]  hhrAlignColumns = { "HitNo",         "Query",      "Hit",      "QueryLength", "HitLength",  "AlignLength",
                                          "Identity",       "Evalue",     "PValue",   "Score",       "Similarity", "Prob",
                                          "Sum_Probs",      "QueryStart", "QueryEnd", "HitStart",    "HitEnd",
                                          "QueryAlignment", "HitAlignment" /*, "QueryConsensus", "HitConsensus",
                                                                            * "QueryDssp", "HitDssp", "Confidence", "Match"*/};
            DataTable pfamHHalignTable = new DataTable(tableName);

            foreach (string hhCol in hhrAlignColumns)
            {
                pfamHHalignTable.Columns.Add(new DataColumn(hhCol));
            }

            if (!isUpdate)
            {
                DbCreator dbCreate          = new DbCreator();
                string    createIndexString = "";
                string    createTableString = "CREATE TABLE " + tableName + " ( " +
                                              "HitNO INTEGER NOT NULL, " +
                                              "Query VARCHAR(32) NOT NULL," +
                                              "Hit VARCHAR(32) NOT NULL, " +
                                              "QueryLength INTEGER, " +
                                              "HitLength INTEGER, " +
                                              "AlignLength INTEGER, " +
                                              "Identity FLOAT, " +
                                              "EValue  DOUBLE PRECISION, " +
                                              "PValue DOUBLE PRECISION, " +
                                              "Score DOUBLE PRECISION, " +
                                              "Similarity FLOAT, " +
                                              "Prob FLOAT, " +
                                              "Sum_Probs FLOAT, " +
                                              "QueryStart INTEGER, " + // for the input sequence
                                              "QueryEnd INTEGER, " +
                                              "HitStart INTEGER, " +
                                              "HitEnd INTEGER, " +
                                              "QueryAlignment BLOB Sub_Type 1, " +
                                              "HitAlignment BLOB Sub_Type 1);";

                /*     "QueryConsensus BLOB Sub_Type 1, " +
                 *   "HitConsensus BLOB Sub_Type 1, " +
                 *   "QueryDssp BLOB Sub_Type 1, " +
                 *   "HitDssp BLOB Sub_Type 1, " +
                 *   "Confidence BLOB Sub_Type 1, " +
                 *   "Match BLOB Sub_Type 1);";   */
                dbCreate.CreateTableFromString(ProtCidSettings.alignmentDbConnection, createTableString, tableName);
                createIndexString = "CREATE Index " + tableName + "_query ON " + tableName + "(Query)";
                dbCreate.CreateIndex(ProtCidSettings.alignmentDbConnection, createIndexString, tableName);
                createIndexString = "CREATE Index " + tableName + "_hit ON " + tableName + "(Hit)";
            }
            return(pfamHHalignTable);
        }
コード例 #22
0
        public void TestWrite()
        {
            Connector.Add <MySqlConnection>(
                "unit",
                "database=Read",
                "database=Write"
                );

            DbCreator creator = Connector.WriteInitor("unit");

            Assert.NotNull(creator);
            Assert.Equal("database=Write", creator().ConnectionString);
        }
コード例 #23
0
 // Delete the database if the user confirms
 public void DeleteDatabase()
 {
     NotBusy = false;
     if (MessageBox.Show(
             string.Format("Are you sure you want to delete database '{0}' on server: {1}?", AsBuilder.InitialCatalog, AsBuilder.DataSource),
             "Delete SQL Server Database?",
             MessageBoxButton.YesNo,
             MessageBoxImage.Question) == MessageBoxResult.Yes)
     {
         Connecting(this, EventArgs.Empty);
         DbCreator.Delete(AsBuilder.ConnectionString);
     }
     NotBusy = true;
 }
コード例 #24
0
        /// <summary>
        /// 泛型类型Emit初始化动态函数
        /// </summary>
        /// <param name="type">传入的数据库实例类型</param>
        /// <param name="connection">传入的连接字符串</param>
        /// <returns></returns>
        internal static DbCreator DynamicCreateor(Type type, string connection)
        {
            DynamicMethod method = new DynamicMethod("Db" + Guid.NewGuid().ToString(), type, new Type[0]);
            ILGenerator   il     = method.GetILGenerator();

#if NETSTANDARD1_3
            ConstructorInfo ctor = info.DeclaringType.GetConstructor(null);
#else
            ConstructorInfo ctor = type.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[] { typeof(string) }, null);
#endif
            il.Emit(OpCodes.Ldstr, connection);
            il.Emit(OpCodes.Newobj, ctor);
            il.Emit(OpCodes.Ret);
            DbCreator function = (DbCreator)(method.CreateDelegate(typeof(DbCreator)));
            return(function);
        }
コード例 #25
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dataType"></param>
        private void CreateDbRefTablesInDb(string dataType)
        {
            string    createTableString = "";
            string    createIndexString = "";
            DbCreator dbCreator         = new DbCreator();

            if (dataType == "sws")
            {
                createTableString = "CREATE TABLE " + dbRefTable.TableName + " ( " +
                                    " PdbID CHAR(4) NOT NULL, " +
                                    " RefID INTEGER NOT NULL, " +
                                    " EntityID INTEGER NOT NULL, " +
                                    //     " AuthorChain CHAR(3) NOT NULL, " +
                                    " DbAccession VARCHAR(15) NOT NULL, " +
                                    " PRIMARY KEY (PdbID, RefID));";
            }
            else
            {
                createTableString = "CREATE TABLE " + dbRefTable.TableName + " ( " +
                                    " PdbID CHAR(4) NOT NULL, " +
                                    " RefID INTEGER NOT NULL, " +
                                    " EntityID INTEGER NOT NULL, " +
                                    //     " AuthorChain CHAR(3) NOT NULL, " +
                                    " DbAccession VARCHAR(15) NOT NULL, " +
                                    " Isoform INTEGER NOT NULL, " +
                                    " PRIMARY KEY (PdbID, RefID));";
            }
            dbCreator.CreateTableFromString(createTableString, dbRefTable.TableName);
            createIndexString = "CREATE INDEX " + dbRefTable.TableName + "_idx1 ON " + dbRefTable.TableName + "(PdbID, EntityID);";
            dbCreator.CreateIndex(createIndexString, dbRefTable.TableName);

            createTableString = "CREATE TABLE" + dbRefSeqTable.TableName + " ( " +
                                " AlignID INTEGER NOT NULL, " +
                                " PdbID CHAR(4) NOT NULL, " +
                                " RefID INTEGER NOT NULL, " +
                                " AuthorChain CHAR(3) NOT NULL, " +
                                " DbAlignBeg INTEGER NOT NULL, " +
                                " DbAlignEnd INTEGER NOT NULL, " +
                                " AuthorAlignBeg INTEGER NOT NULL, " +
                                " AuthorAlignEnd INTEGER NOT NULL, " +
                                " SeqAlignBeg INTEGER NOT NULL, " +
                                " SeqAlignEnd INTEGER NOT NULL, " +
                                " PRIMARY KEY (PdbID, AlignID));";
            dbCreator.CreateTableFromString(createTableString, dbRefSeqTable.TableName);
            createIndexString = "CREATE INDEX " + dbRefSeqTable.TableName + "_idx1 ON " + dbRefSeqTable.TableName + "(PdbID, RefID);";
            dbCreator.CreateIndex(createIndexString, dbRefSeqTable.TableName);
        }
コード例 #26
0
ファイル: InterfaceStatData.cs プロジェクト: ijlab/ProtCID
        public void InitializeStatInfoTable(string type)
        {
            string[] statInfoCols = { "Category", "Single", "Pair", "Total" };
            dbStatInfoTable = new DataTable(type + "StatInfo");
            foreach (string statInfoCol in statInfoCols)
            {
                dbStatInfoTable.Columns.Add(new DataColumn(statInfoCol));
            }

            DbCreator dbCreate          = new DbCreator();
            string    createTableString = "Create Table " + type + "StatInfo ( " +
                                          " Category VARCHAR(30) NOT NULL, " +
                                          " Single Integer NOT NULL, " +
                                          " Pair Integer NOT NULL, " +
                                          " Total Integer NOT NULL );";

            dbCreate.CreateTableFromString(ProtCidSettings.protcidDbConnection, createTableString, type + "StatInfo");
        }
コード例 #27
0
ファイル: PfamLigandClusterHmm.cs プロジェクト: ijlab/ProtCID
 /// <summary>
 ///
 /// </summary>
 /// <param name="isUpdate"></param>
 private void CreateDbTable(bool isUpdate)
 {
     if (!isUpdate)
     {
         DbCreator dbCreate          = new DbCreator();
         string    createTableString = "Create Table " + tableName + " ( " +
                                       "PfamID varchar(40) NOT NULL, " +
                                       "ClusterID Integer NOT NULL, " +
                                       "PdbID char(4) Not Null, " +
                                       "ChainDomainID Integer Not Null, " +
                                       "LigandChain char(3) Not Null);";
         dbCreate.CreateTableFromString(ProtCidSettings.protcidDbConnection, createTableString, tableName);
         string createIndexString = "Create Index " + tableName + "_cluster ON " + tableName + "(PfamID, ClusterID);";
         dbCreate.CreateIndex(ProtCidSettings.protcidDbConnection, createIndexString, tableName);
         createIndexString = "Create Index " + tableName + "_pdb ON " + tableName + "(PdbID, ChainDomainID);";
         dbCreate.CreateIndex(ProtCidSettings.protcidDbConnection, createIndexString, tableName);
     }
 }
コード例 #28
0
        /// <summary>
        ///
        /// </summary>
        private void InitializeDbTable()
        {
            DbCreator dbCreator = new DbCreator();

            if (!dbCreator.IsTableExist(ProtCidSettings.buCompConnection, domainInterfaceCompTable.TableName))
            {
                string createTableString = "CREATE TABLE " + domainInterfaceCompTable.TableName + " ( " +
                                           "RelSeqID INTEGER NOT NULL, " +
                                           "PdbID1 VARCHAR(4) NOT NULL, " +
                                           "PdbID2 VARCHAR(4) NOT NULL, " +
                                           "BuID1 VARCHAR(8) NOT NULL, " +
                                           "BuID2 VARCHAR(8) NOT NULL, " +
                                           "DomainInterfaceID1 INTEGER NOT NULL, " +
                                           "DomainInterfaceID2 INTEGER NOT NULL, " +
                                           "Qscore FLOAT NOT NULL);";
                dbCreator.CreateTableFromString(ProtCidSettings.buCompConnection, createTableString, domainInterfaceCompTable.TableName);
            }
        }
コード例 #29
0
        static void Main(string[] args)
        {
            log.Info("Connection string           : " + connectionString);
            Console.WriteLine("Database Type               : " + dbtype);
            Console.WriteLine("Sleep Time                  : " + sleepTime);
            Console.WriteLine("Service Host                : " + predictionServiceHost + ":" + predictionServicePort);
            Console.WriteLine(" ");

            int sleep = 2000;

            int.TryParse(sleepTime, out sleep);

            Database dbStuff = new Database(DbCreator.Create(dbtype));

            int cnt     = 0;
            int maxWait = 10;

            while (true)
            {
                try
                {
                    dbStuff.Connect(connectionString);
                    break;
                }
                catch (Exception e)
                {
                    log.Error(e);
                    log.Warn("Cannot connect to DB... retrying in 10 seconds");
                    if (cnt++ < maxWait)
                    {
                        System.Threading.Thread.Sleep(10000);
                    }
                    else
                    {
                        break;
                    }
                }
            }


            var gen = new PredictionsGenerator(dbStuff, mode, predictionServiceHost + ":" + predictionServicePort);

            gen.Go();
        }
コード例 #30
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
            DbCreator.CreateDb(app);
        }