//------------------------------------------------------------ static void writeLCF(BookCaseDB& db, info_lib *mmdb, const char *bcname, hashTable<CC_String,BTCollectable> &hd) { DBTable *out = db.DB::table(DATABASE_STDIO, LOCATOR_CODE, BT_NUM_LOCATOR_FIELDS, DB::CREATE); hashTableIterator<CC_String,BTCollectable> loc_it( hd ); while ( ++loc_it ) { CC_String *locator_str = ( CC_String *)loc_it.key(); const char *locator = (const char *)*locator_str; BTCollectable *loc_val = ( BTCollectable *)loc_it.value(); const char *opaque, *nodeloc; char* reflabel; nodeloc = opaque = (const char *)loc_val->get_value(); reflabel = strchr(opaque, '\t'); *reflabel++ = 0; const char *nodeOID = to_oid(mmdb, bcname, nodeloc); #ifdef FISH_DEBUG DBUG_PRINT("LCF", ("LCF entry: L:%s->O:%s\n", locator, nodeOID)); #endif out->insert(STRING_CODE, locator, OID_CODE, nodeOID, STRING_CODE, reflabel, NULL); } delete out; }
void CFeatTrim::x_TrimLocation(const TSeqPos from, const TSeqPos to, const bool set_partial, CRef<CSeq_loc>& loc) { if (loc.IsNull()) { return; } bool partial_start = false; bool partial_stop = false; const auto strand = loc->GetStrand(); for(CSeq_loc_CI loc_it(*loc); loc_it; ++loc_it) { const auto& current_range = loc_it.GetRange(); const auto current_from = current_range.GetFrom(); const auto current_to = current_range.GetTo(); CRef<CSeq_id> current_seqid = Ref(new CSeq_id()); current_seqid->Assign(loc_it.GetSeq_id()); // May be able to do this more succinctly and efficiently using CSeq_loc::Intersect if ((current_to < from) || (current_from > to)) { CRef<CSeq_loc> trim(new CSeq_loc(*current_seqid, current_from, current_to, strand)); loc = loc->Subtract(*trim, 0, NULL, NULL); if (current_to < from) { partial_start = true; } if (current_from > to) { partial_stop = true; } continue; } if (current_from < from) { CRef<CSeq_loc> trim(new CSeq_loc(*current_seqid, current_from, from-1, strand)); loc = loc->Subtract(*trim, 0, NULL, NULL); partial_start = true; } if (current_to > to) { CRef<CSeq_loc> trim(new CSeq_loc(*current_seqid, to+1, current_to, strand)); loc = loc->Subtract(*trim, 0, NULL, NULL); partial_stop = true; } } if (loc->IsNull() || !set_partial) { return; } if (strand == eNa_strand_minus) { swap(partial_start, partial_stop); } if (partial_start) { loc->SetPartialStart(true, eExtreme_Biological); } if (partial_stop) { loc->SetPartialStop(true, eExtreme_Biological); } }