/// <summary> /// /// </summary> /// <param name="pfamId"></param> private void DeleteObsoleteClusterData(string pfamId, List <string> updateEntryList) { string deleteString = string.Format("Delete From {0} Where PfamID = '{1}' AND PdbID In ({2});", tableName, pfamId, ParseHelper.FormatSqlListString(updateEntryList.ToArray())); dbUpdate.Delete(ProtCidSettings.protcidDbConnection, deleteString); }
/// <summary> /// /// </summary> /// <param name="updateEntries"></param> private void DeleteObsoleteData(string[] updateEntries) { string deleteString = ""; for (int i = 0; i < updateEntries.Length; i += 300) { string[] subEntries = ParseHelper.GetSubArray(updateEntries, i, 300); deleteString = string.Format("Delete From {0} Where PdbID1 IN ({1}) OR PdbID2 IN ({1});", tableName, ParseHelper.FormatSqlListString (subEntries)); dbUpdate.Delete(ProtCidSettings.protcidDbConnection, deleteString); } }
/// <summary> /// /// </summary> /// <param name="obsoleteCrcCodes"></param> public void DeleteHHalignments(string[] obsoleteCrcCodes) { string deleteString = ""; foreach (string crc in obsoleteCrcCodes) { deleteString = string.Format("Delete From hhglobal Where crc1 = '{0}' OR crc2 = '{0}';", crc); dbUpdate.Delete(localMysqlDbConnect, deleteString); } }
/// <summary> /// / /// </summary> /// <param name="groupId"></param> /// <param name="repEntries"></param> private void DeleteOrigHomoEntriesNowRepEntries(int groupId, string[] repEntries) { string queryString = string.Format("Select Distinct PdbID2 From {0} Where GroupSeqID = {1};", HomoGroupTables.homoGroupTables[HomoGroupTables.HomoRepEntryAlign].TableName, groupId); DataTable homoEntryTable = ProtCidSettings.protcidQuery.Query(queryString); string pdbId = ""; string deleteString = ""; List <string> nowRepEntryList = new List <string>(); foreach (DataRow homoEntryRow in homoEntryTable.Rows) { pdbId = homoEntryRow["PdbID2"].ToString(); if (Array.IndexOf(repEntries, pdbId) > -1) { nowRepEntryList.Add(pdbId); deleteString = string.Format("Delete From {0} WHere PdbID2 = '{1}';", HomoGroupTables.homoGroupTables[HomoGroupTables.HomoRepEntryAlign].TableName, pdbId); dbUpdate.Delete(ProtCidSettings.protcidDbConnection, deleteString); } } }
/// <summary> /// /// </summary> /// <param name="updateEntries"></param> private void DeletePdbCrcRecords(string[] delEntries) { string deleteString = ""; DbUpdate dbDelete = new DbUpdate(); foreach (string pdbId in delEntries) { deleteString = string.Format("Delete From pdbcrcmap Where pdb = '{0}';", pdbId); dbDelete.Delete(localMysqlDbConnect, deleteString); } }
/// <summary> /// /// </summary> public void RemoveObsoleteData() { StreamReader lsFileReader = new StreamReader(@"D:\DbProjectData\PDB\newls-pdb.txt"); string line = ""; List <string> entryList = new List <string> (); while ((line = lsFileReader.ReadLine()) != null) { entryList.Add(line.Substring(0, 4)); } lsFileReader.Close(); DbUpdate dbDelete = new DbUpdate(); string deleteString = ""; string crystInterfaceFileDir = @"D:\DbProjectData\InterfaceFiles_update\cryst"; string hashFolder = ""; foreach (string pdbId in entryList) { deleteString = string.Format("Delete From CrystEntryInterfaces Where PdbID = '{0}';", pdbId); dbDelete.Delete(ProtCidSettings.protcidDbConnection, deleteString); deleteString = string.Format("Delete From EntryInterfaceComp Where PdbID = '{0}';", pdbId); dbDelete.Delete(ProtCidSettings.protcidDbConnection, deleteString); deleteString = string.Format("Delete From DifEntryInterfaceComp " + "Where PdbID1 = '{0}' OR PdbID2 = '{0}';", pdbId); dbDelete.Delete(ProtCidSettings.protcidDbConnection, deleteString); deleteString = string.Format("Delete From FATCATALignments " + " Where QueryEntry = '{0}' OR HitEntry = '{0}';", pdbId); dbDelete.Delete(ProtCidSettings.alignmentDbConnection, deleteString); hashFolder = Path.Combine(crystInterfaceFileDir, pdbId.Substring(1, 2)); string[] crystInterfaceFiles = Directory.GetFiles(hashFolder, pdbId + "*"); foreach (string crystInterfaceFile in crystInterfaceFiles) { File.Delete(crystInterfaceFile); } } }
/// <summary> /// delete the alignment from database /// </summary> /// <param name="queryEntry"></param> /// <param name="queryChain"></param> /// <param name="hitEntry"></param> /// <param name="hitChain"></param> private void DeleteDbData(string queryEntry, string queryChain, string hitEntry, string hitChain) { string deleteString = string.Format("Delete From FatCatAlignments " + " Where (QueryEntry = '{0}' AND QueryChain = '{1}' AND " + " HitEntry = '{2}' AND HitChain = '{3}') " + " OR (QueryEntry = '{2}' AND QueryChain = '{3}' AND " + " HitEntry = '{0}' AND HitChain = '{1}');", queryEntry, queryChain, hitEntry, hitChain); dbUpdate.Delete(alignmentDbConnection, deleteString); /* deleteString = string.Format("Delete From FatCatAlignments " + * " Where QueryEntry = '{0}' AND QueryChain = '{1}' AND " + * " HitEntry = '{2}' AND HitChain = '{3}';", * hitEntry, hitChain, queryEntry, queryChain); * dbUpdate.Delete (alignmentDbConnection, deleteString);*/ }
/// <summary> /// /// </summary> /// <param name="obsPdbId"></param> /// <param name="tableName"></param> /// <param name="dbDelete"></param> public void DeleteEntryInfoFromTable(string obsPdbId, string tableName, DbQuery dbQuery, DbUpdate dbDelete) { string deleteString = ""; string queryString = string.Format("Select First 1 * From {0};", tableName); DataTable dbTable = dbQuery.Query(queryString); if (dbTable.Columns.Contains("PdbID")) { deleteString = string.Format("Delete From {0} Where PdbID = '{1}';", tableName, obsPdbId); } else if (dbTable.Columns.Contains("PdbID1")) { deleteString = string.Format("Delete From {0} Where PdbID1 = '{1}';", tableName, obsPdbId); } else if (dbTable.Columns.Contains("PdbID2")) { deleteString = string.Format("Delete From {0} Where PdbID2 = '{1}';", tableName, obsPdbId); } if (deleteString != "") { dbDelete.Delete(deleteString); } }
/// <summary> /// /// </summary> /// <param name="pdbId"></param> private void DeleteObsoleteBuData(string pdbId) { string deleteString = string.Format("Delete From {0} Where PdbID = '{1}';", buTableName, pdbId); dbUpdate.Delete(ProtCidSettings.pdbfamDbConnection, deleteString); }
/// <summary> /// /// </summary> /// <param name="pfamId"></param> private void DeletePfamLigandClusters(string pfamId) { string deleteString = string.Format("Delete From {0} Where PfamID = '{1}';", tableName, pfamId); dbUpdate.Delete(ProtCidSettings.protcidDbConnection, deleteString); }
/// <summary> /// /// </summary> /// <param name="pdbId"></param> /// <param name="tableName"></param> private void DeletePdbEntryData(string pdbId, string tableName) { string deleteString = string.Format("Delete From {0} Where pdb_id = '{1}';", tableName, pdbId); dbUpdate.Delete(bamDbConnect, deleteString); }
/// <summary> /// /// </summary> /// <param name="pdbId"></param> private void DeleteChainLigand(string pdbId) { string deleteString = string.Format("Delete From ChainLigands Where PdbID = '{0}';", pdbId); dbUpdate.Delete(ProtCidSettings.buCompConnection, deleteString); }
/// <summary> /// /// </summary> /// <param name="seqCode"></param> private void DeleteUpdateHhAlignData(string seqCode) { string deleteString = string.Format("Delete From {0} Where Query = '{1}' OR Hit = '{1}';", hhAlignTableName, seqCode); dbUpdate.Delete(ProtCidSettings.alignmentDbConnection, deleteString); }