public static void PerformLocalBlast(string querypath, string ncbipath, string localpath, string outputpath, RunCommand command, BlastType blastType, List<FastaObj> fastaSet, string fastaSetPath, bool inclWaitTime) { var lb = new LocalBlaster(ncbipath, localpath, outputpath); lb.CreateLocalBlastDatabase(command, blastType, fastaSet, fastaSetPath, inclWaitTime); lb.PerformBlast(querypath, inclWaitTime); //var bo = Program.localBlaster.PerformBlast(queryPath, true); }
public void CreateLocalBlastDatabase(RunCommand command, BlastType blastType, List<FastaObj> fastaSet, string fastaSetPath, bool includeWaitTime) { this._blastType = blastType; this._fastaSetPath = fastaSetPath; if (this._blastType == BlastType.Null) return; this.command = command; //Name for local db if (this._localDBPath.EndsWith(@"\")) this._localDBPath += @"\"; var outFilePath = this._localDBPath + @"\~tempLocalBlastDB"; //Check for part of db, if exists, remove to force new db creation if (File.Exists(outFilePath + ".pin")) File.Delete(outFilePath + ".pin"); var btype = DBCommands[(int)blastType]; if (fastaSet != null) { this._fastaDBSet = fastaSet; File.Delete(fastaSetPath); FastaObj.CreateMultiFastaFile(fastaSetPath, fastaSet); } var cs = @"makeblastdb -in " + fastaSetPath + " -dbtype " + btype + " -out " + outFilePath; if (!File.Exists(fastaSetPath)) return; //Create new Database through c# command line simulator/wrapper. Wait for completion command.RunCommandLine(cs, this._NCBIBlasteEXEPath); if (includeWaitTime) while (command.isRunning) { } }
public void Reduce(RunCommand command, string tempDirectory, string queryPath, Dictionary<ArCOGObj, List<FastaObj>> dict) { for (int i = 0; i < dict.Count; i++) { List<FastaObj> cl; dict.TryGetValue(dict.Keys.ToList<ArCOGObj>()[i], out cl); this.CreateLocalBlastDatabase(command, LocalBlaster.BlastType.Protein, cl, tempDirectory + @"\tempFastaDB.fa", true); int w = 0; var cf = new List<FastaObj>(this.FastaDBSet); while (w < cf.Count) { cf[w].CreateLocalFasta(queryPath); var tbo = this.PerformBlast(queryPath, true); this.RemoveDataBaseRedundancy(tbo, .8, false); w++; } continue; } }