Please note that these objects are instantiated with the default options set and these defaults can be queried via the corresponding accessor method(s).
using ncbi::blast; try { // Task is specified by the eBlastp argument CBl2Seq bl2seq(query, subject, eBlastp); TSeqAlignVector results = bl2seq.Run(); } catch (const CBlastException& e) { // Handle exception ... }
Using the approach above guarantees that the BLAST options will be valid.
An alternative to this approach is to use the CBlastOptionsFactory to create a CBlastOptionsHandle object, which allows the caller to set options which are applicable to all variants of BLAST (e.g.: E-value threshold, effective search space, window size). Furthermore, this approach allows the caller to reuse the CBlastOptionsHandle object with multiple BLAST search objects:
using ncbi::blast; CRef<CBlastOptionsHandle> opts_handle(CBlastOptionsFactory::Create(eBlastn)); ... opts_handle.SetEvalueThreshold(1e-20); CBl2Seq bl2seq(query, subjects, opts_handle); ... opts_handle.SetEvalueThreshold(1e-10); CLocalBlast blast(query_factory, opts_handle, seq_src);
Validate method in its interface which is called by the BLAST search classes prior to performing the actual search, but users of the C++ BLAST options APIs might also want to invoke this method so that any exceptions thrown by the BLAST search classes can be guaranteed not originate from an incorrect setting of BLAST options. Please note that the Validate method throws a CBlastException in case of failure.
using ncbi::blast; CBlastNucleotideOptionsHandle opts_handle; opts_handle.SetTraditionalBlastnDefaults(); opts_handle.SetStrandOption(objects::eNa_strand_plus); CBl2Seq bl2seq(query, subject, opts_handle); TSeqAlignVector results = bl2seq.Run();
By using this interface, the likelihood of setting invalid options is reduced, but the validity of the options cannot be fully guaranteed.
GetOptions and SetOptions methods of the CBlastOptionsHandle hierarchy allow access to the CBlastOptions class, the lowest level class in the C++ BLAST options API which contains all options available to all variants of the BLAST algorithm. No guarantees about the validity of the options are made if this interface is used, therefore invoking Validate is strongly recommended.
using ncbi::blast; try { CBlastProteinOptionsHandle opts_handle; opts_handle.SetMatrixName("PAM30"); opts_handle.SetGapOpeningCost(9); opts_handle.SetGapExtensionCost(1); opts_handle.SetOptions().SetCompositionBasedStats(eCompositionBasedStats); opts_handle.Validate(); CBl2Seq bl2seq(query, subject, opts_handle); TSeqAlignVector results = bl2seq.Run(); } catch (const CBlastException& e) { // Handle exception ... }
1.4.6
Modified on Mon Dec 07 16:24:35 2009 by modify_doxy.py rev. 173732