本文整理汇总了C++中CConstRef::AsFastaString方法的典型用法代码示例。如果您正苦于以下问题:C++ CConstRef::AsFastaString方法的具体用法?C++ CConstRef::AsFastaString怎么用?C++ CConstRef::AsFastaString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CConstRef
的用法示例。
在下文中一共展示了CConstRef::AsFastaString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateBioseqFromId
CRef<CBioseq> CBlastBioseqMaker::
CreateBioseqFromId(CConstRef<CSeq_id> id, bool retrieve_seq_data)
{
_ASSERT(m_scope.NotEmpty());
// N.B.: this call fetches the Bioseq into the scope from its
// data sources (should be BLAST DB first, then Genbank)
TSeqPos len = sequence::GetLength(*id, m_scope);
if (len == numeric_limits<TSeqPos>::max()) {
NCBI_THROW(CInputException, eSeqIdNotFound,
"Sequence ID not found: '" +
id->AsFastaString() + "'");
}
CBioseq_Handle bh = m_scope->GetBioseqHandle(*id);
CRef<CBioseq> retval;
if (retrieve_seq_data) {
retval.Reset(const_cast<CBioseq*>(&*bh.GetCompleteBioseq()));
} else {
retval.Reset(new CBioseq());
CRef<CSeq_id> idToStore(new CSeq_id);
idToStore->Assign(*id);
retval->SetId().push_back(idToStore);
retval->SetInst().SetRepr(CSeq_inst::eRepr_raw);
retval->SetInst().SetMol(bh.IsProtein()
? CSeq_inst::eMol_aa
: CSeq_inst::eMol_dna);
retval->SetInst().SetLength(len);
}
return retval;
}
示例2: x_ValidateMoleculeType
/// Performs sanity checks to make sure that the sequence requested is of
/// the expected type. If the tests fail, an exception is thrown.
/// @param id Sequence id for this sequence [in]
void x_ValidateMoleculeType(CConstRef<CSeq_id> id)
{
_ASSERT(m_BioseqMaker.NotEmpty());
if (id.Empty())
{
NCBI_THROW(CInputException, eInvalidInput,
"Empty SeqID passed to the molecule type validation");
}
bool isProtein = m_BioseqMaker->IsProtein(id);
if (!isProtein && m_ReadProteins)
{
NCBI_THROW(CInputException, eSequenceMismatch,
"GI/accession/sequence mismatch: protein input required but nucleotide provided");
}
if (isProtein && !m_ReadProteins)
{
NCBI_THROW(CInputException, eSequenceMismatch,
"GI/accession/sequence mismatch: nucleotide input required but protein provided");
}
if (!isProtein) // Never seen a virtual protein sequence.
{
if (m_BioseqMaker->HasSequence(id) == false)
{
string message = "No sequence available for " + id->AsFastaString();
NCBI_THROW(CInputException, eInvalidInput, message);
}
}
}
示例3: IsProtein
bool CBlastBioseqMaker::IsProtein(CConstRef<CSeq_id> id)
{
_ASSERT(m_scope.NotEmpty());
CBioseq_Handle bh = m_scope->GetBioseqHandle(*id);
if (!bh)
{
NCBI_THROW(CInputException, eSeqIdNotFound,
"Sequence ID not found: '" +
id->AsFastaString() + "'");
}
return bh.IsProtein();
}