SSeqLoc* CTestObjMgr::CreateEmptySSeqLoc(CSeq_id& id) { CRef<CSeq_loc> seqloc(new CSeq_loc()); CRef<CScope> scope(new CScope(GetObjMgr())); scope->AddDefaults(); seqloc->SetEmpty(id); return new SSeqLoc(seqloc, scope); }
SSeqLoc* CTestObjMgr::CreateSSeqLoc(CSeq_id& id, ENa_strand strand) { CRef<CSeq_loc> seqloc(new CSeq_loc()); CRef<CScope> scope(new CScope(GetObjMgr())); scope->AddDefaults(); seqloc->SetInt().SetFrom(0); seqloc->SetInt().SetTo(sequence::GetLength(id, scope)-1); seqloc->SetInt().SetStrand(strand); seqloc->SetInt().SetId().Assign(id); return new SSeqLoc(seqloc, scope); }
SSeqLoc* CTestObjMgr::CreateSSeqLoc(CSeq_id& id, pair<TSeqPos, TSeqPos> range, ENa_strand strand) { CRef<CSeq_loc> seqloc(new CSeq_loc()); CRef<CScope> scope(new CScope(GetObjMgr())); scope->AddDefaults(); seqloc->SetInt().SetFrom(range.first); seqloc->SetInt().SetTo(range.second); seqloc->SetInt().SetStrand(strand); seqloc->SetInt().SetId().Assign(id); return new SSeqLoc(seqloc, scope); }
CRef<ncbi::blast::CBlastSearchQuery> CTestObjMgr::CreateBlastSearchQuery(CSeq_id& id, ENa_strand strand) { CRef<CSeq_loc> seqloc(new CSeq_loc()); CRef<CScope> scope(new CScope(GetObjMgr())); scope->AddDefaults(); seqloc->SetInt().SetFrom(0); seqloc->SetInt().SetTo(sequence::GetLength(id, scope)-1); seqloc->SetInt().SetStrand(strand); seqloc->SetInt().SetId().Assign(id); TMaskedQueryRegions mqr; CRef<CBlastSearchQuery> bsq(new CBlastSearchQuery(*seqloc, *scope, mqr)); return bsq; }
int ReadFastaQueries(const string& filename, vector< CRef<objects::CSeq_loc> >& seqs, CRef<objects::CScope>& scope, bool parse_deflines /* = false*/, objects::CSeqIdGenerator* id_generator /* = NULL*/) { seqs.clear(); CNcbiIfstream instream(filename.c_str()); if (!instream) { return -1; } CStreamLineReader line_reader(instream); CFastaReader::TFlags flags = CFastaReader::fAssumeProt | CFastaReader::fForceType; if (!parse_deflines) { flags |= CFastaReader::fNoParseID; } CFastaReader fasta_reader(line_reader, flags); if (id_generator) { fasta_reader.SetIDGenerator(*id_generator); } scope->AddDefaults(); while (!line_reader.AtEOF()) { CRef<CSeq_entry> entry = fasta_reader.ReadOneSeq(); if (entry == 0) { return -1; } scope->AddTopLevelSeqEntry(*entry); CTypeConstIterator<CBioseq> itr(ConstBegin(*entry)); CRef<CSeq_loc> seqloc(new CSeq_loc()); seqloc->SetWhole().Assign(*itr->GetId().front()); seqs.push_back(seqloc); } return 0; }