flat_feature.cpp

来自「ncbi源码」· C++ 代码 · 共 822 行 · 第 1/2 页

CPP
822
字号
    DO_NOTE(gene_syn);    DO_NOTE(trna_codons);    DO_NOTE(prot_desc);    DO_NOTE(prot_note);    DO_NOTE(prot_comment);    DO_NOTE(prot_method);    DO_NOTE(figure);    DO_NOTE(maploc);    DO_NOTE(prot_conflict);    DO_NOTE(prot_missing);    DO_NOTE(seqfeat_note);    DO_NOTE(exception_note);    DO_NOTE(region);    // DO_NOTE(selenocysteine);    DO_NOTE(prot_names);    DO_NOTE(bond);    DO_NOTE(site);    DO_NOTE(rrna_its);    x_FormatNoteQual(eFQ_xtra_prod_quals, "xtra_products");    x_FormatNoteQual(eFQ_modelev,         "model_evidence");    DO_NOTE(go_component);    DO_NOTE(go_function);    DO_NOTE(go_process);#undef DO_NOTE            DO_QUAL(citation);    DO_QUAL(number);    DO_QUAL(pseudo);    DO_QUAL(codon_start);    DO_QUAL(anticodon);    DO_QUAL(bound_moiety);    DO_QUAL(clone);    DO_QUAL(cons_splice);    DO_QUAL(direction);    DO_QUAL(function);    DO_QUAL(evidence);    DO_QUAL(exception);    DO_QUAL(frequency);    DO_QUAL(EC_number);    x_FormatQual(eFQ_gene_map,    "map");    x_FormatQual(eFQ_gene_allele, "allele");    DO_QUAL(allele);    DO_QUAL(map);    DO_QUAL(mod_base);    DO_QUAL(PCR_conditions);    DO_QUAL(phenotype);    DO_QUAL(rpt_family);    DO_QUAL(rpt_type);    DO_QUAL(rpt_unit);    DO_QUAL(insertion_seq);    DO_QUAL(transposon);    DO_QUAL(usedin);    // extra imports, actually...    x_FormatQual(eFQ_illegal_qual, "illegal");    DO_QUAL(replace);    DO_QUAL(transl_except);    DO_QUAL(transl_table);    DO_QUAL(codon);    DO_QUAL(organism);    DO_QUAL(label);    x_FormatQual(eFQ_cds_product, "product");    DO_QUAL(protein_id);    DO_QUAL(transcript_id);    DO_QUAL(db_xref);    x_FormatQual(eFQ_gene_xref, "db_xref");    DO_QUAL(translation);    DO_QUAL(transcription);    DO_QUAL(peptide);#undef DO_QUAL}void CFlattishSourceFeature::x_AddQuals(void) const{    const CSeqFeatData& data = m_Feat->GetData();    _ASSERT(data.IsOrg()  ||  data.IsBiosrc());    // add various generic qualifiers...    x_AddQual(eSQ_mol_type,              new CFlatMolTypeQV(m_Context->GetBiomol(), m_Context->GetMol()));    if (m_Feat->IsSetComment()) {        x_AddQual(eSQ_seqfeat_note, new CFlatStringQV(m_Feat->GetComment()));    }    if (m_Feat->IsSetTitle()) {        x_AddQual(eSQ_label, new CFlatLabelQV(m_Feat->GetTitle()));    }    if (m_Feat->IsSetCit()) {        x_AddQual(eSQ_citation, new CFlatPubSetQV(m_Feat->GetCit()));    }    if (m_Feat->IsSetDbxref()) {        x_AddQual(eSQ_org_xref, new CFlatXrefQV(m_Feat->GetDbxref()));    }    switch (data.Which()) {    case CSeqFeatData::e_Org:     x_AddQuals(data.GetOrg());     break;    case CSeqFeatData::e_Biosrc:  x_AddQuals(data.GetBiosrc());  break;    default: break; // can't happen, but some compilers warn anyway    }}static ESourceQualifier s_OrgModToSlot(const COrgMod& om){    switch (om.GetSubtype()) {#define DO_ORGMOD(x) case COrgMod::eSubtype_##x:  return eSQ_##x;        DO_ORGMOD(strain);        DO_ORGMOD(substrain);        DO_ORGMOD(type);        DO_ORGMOD(subtype);        DO_ORGMOD(variety);        DO_ORGMOD(serotype);        DO_ORGMOD(serogroup);        DO_ORGMOD(serovar);        DO_ORGMOD(cultivar);        DO_ORGMOD(pathovar);        DO_ORGMOD(chemovar);        DO_ORGMOD(biovar);        DO_ORGMOD(biotype);        DO_ORGMOD(group);        DO_ORGMOD(subgroup);        DO_ORGMOD(isolate);        DO_ORGMOD(common);        DO_ORGMOD(acronym);        DO_ORGMOD(dosage);    case COrgMod::eSubtype_nat_host:  return eSQ_spec_or_nat_host;        DO_ORGMOD(sub_species);        DO_ORGMOD(specimen_voucher);        DO_ORGMOD(authority);        DO_ORGMOD(forma);        DO_ORGMOD(forma_specialis);        DO_ORGMOD(ecotype);        DO_ORGMOD(synonym);        DO_ORGMOD(anamorph);        DO_ORGMOD(teleomorph);        DO_ORGMOD(breed);        DO_ORGMOD(gb_acronym);        DO_ORGMOD(gb_anamorph);        DO_ORGMOD(gb_synonym);        DO_ORGMOD(old_lineage);        DO_ORGMOD(old_name);#undef DO_ORGMOD    case COrgMod::eSubtype_other:  return eSQ_orgmod_note;    default:                       return eSQ_none;    }}void CFlattishSourceFeature::x_AddQuals(const COrg_ref& org) const{    {{        string name;        if (org.IsSetTaxname()) {            name = org.GetTaxname();        }        if (name.empty()  &&  org.IsSetOrgname()) {            org.GetOrgname().GetFlatName(name);        }        if (org.IsSetCommon()) {            if (name.empty()) {                name = org.GetCommon();            }            x_AddQual(eSQ_common_name, new CFlatStringQV(org.GetCommon()));        }        if ( !name.empty() ) {            x_AddQual(eSQ_organism, new CFlatStringQV(name));        }    }}    if (org.IsSetDb()) {        x_AddQual(eSQ_db_xref, new CFlatXrefQV(org.GetDb()));    }    for (CTypeConstIterator<COrgMod> it(org);  it;  ++it) {        ESourceQualifier slot = s_OrgModToSlot(*it);        if (slot != eSQ_none) {            x_AddQual(slot, new CFlatOrgModQV(*it));        }    }}static ESourceQualifier s_SubSourceToSlot(const CSubSource& ss){    switch (ss.GetSubtype()) {#define DO_SS(x) case CSubSource::eSubtype_##x:  return eSQ_##x;        DO_SS(chromosome);        DO_SS(map);        DO_SS(clone);        DO_SS(subclone);        DO_SS(haplotype);        DO_SS(genotype);        DO_SS(sex);        DO_SS(cell_line);        DO_SS(cell_type);        DO_SS(tissue_type);        DO_SS(clone_lib);        DO_SS(dev_stage);        DO_SS(frequency);        DO_SS(germline);        DO_SS(rearranged);        DO_SS(lab_host);        DO_SS(pop_variant);        DO_SS(tissue_lib);        DO_SS(plasmid_name);        DO_SS(transposon_name);        DO_SS(insertion_seq_name);        DO_SS(plastid_name);        DO_SS(country);        DO_SS(segment);        DO_SS(endogenous_virus_name);        DO_SS(transgenic);        DO_SS(environmental_sample);        DO_SS(isolation_source);#undef DO_SS    case CSubSource::eSubtype_other:  return eSQ_subsource_note;    default:                          return eSQ_none;    }}void CFlattishSourceFeature::x_AddQuals(const CBioSource& src) const{    x_AddQual(eSQ_organelle, new CFlatOrganelleQV(src.GetGenome()));    x_AddQuals(src.GetOrg());    ITERATE (CBioSource::TSubtype, it, src.GetSubtype()) {        ESourceQualifier slot = s_SubSourceToSlot(**it);        if (slot != eSQ_none) {            x_AddQual(slot, new CFlatSubSourceQV(**it));        }    }    x_AddQual(eSQ_focus, new CFlatBoolQV(src.IsSetIs_focus()));}void CFlattishSourceFeature::x_FormatQuals(void) const{    m_FF->SetQuals().reserve(m_Quals.size());#define DO_QUAL(x) x_FormatQual(eSQ_##x, #x)    DO_QUAL(organism);    DO_QUAL(organelle);    DO_QUAL(mol_type);    DO_QUAL(strain);    x_FormatQual(eSQ_substrain, "sub_strain");    DO_QUAL(variety);    DO_QUAL(serotype);    DO_QUAL(serovar);    DO_QUAL(cultivar);    DO_QUAL(isolate);    DO_QUAL(isolation_source);    x_FormatQual(eSQ_spec_or_nat_host, "specific_host");    DO_QUAL(sub_species);    DO_QUAL(specimen_voucher);    DO_QUAL(db_xref);    x_FormatQual(eSQ_org_xref, "db_xref");    DO_QUAL(chromosome);    DO_QUAL(segment);    DO_QUAL(map);    DO_QUAL(clone);    x_FormatQual(eSQ_subclone, "sub_clone");    DO_QUAL(haplotype);    DO_QUAL(sex);    DO_QUAL(cell_line);    DO_QUAL(cell_type);    DO_QUAL(tissue_type);    DO_QUAL(clone_lib);    DO_QUAL(dev_stage);    DO_QUAL(frequency);    DO_QUAL(germline);    DO_QUAL(rearranged);    DO_QUAL(transgenic);    DO_QUAL(environmental_sample);    DO_QUAL(lab_host);    DO_QUAL(pop_variant);    DO_QUAL(tissue_lib);    x_FormatQual(eSQ_plasmid_name,       "plasmid");    x_FormatQual(eSQ_transposon_name,    "transposon");    x_FormatQual(eSQ_insertion_seq_name, "insertion_seq");    DO_QUAL(country);    DO_QUAL(focus);#define DO_NOTE(x) x_FormatNoteQual(eSQ_##x, #x)    if (m_WasDesc) {        DO_NOTE(seqfeat_note);        DO_NOTE(orgmod_note);        DO_NOTE(subsource_note);    } else {        DO_NOTE(unstructured);    }    DO_NOTE(type);    DO_NOTE(subtype);    DO_NOTE(serogroup);    DO_NOTE(pathovar);    DO_NOTE(chemovar);    DO_NOTE(biovar);    DO_NOTE(biotype);    DO_NOTE(group);    DO_NOTE(subgroup);    DO_NOTE(common);    DO_NOTE(acronym);    DO_NOTE(dosage);    DO_NOTE(authority);    DO_NOTE(forma);    DO_NOTE(forma_specialis);    DO_NOTE(ecotype);    DO_NOTE(synonym);    DO_NOTE(anamorph);    DO_NOTE(teleomorph);    DO_NOTE(breed);    DO_NOTE(genotype);    x_FormatNoteQual(eSQ_plastid_name, "plastid");    x_FormatNoteQual(eSQ_endogenous_virus_name, "endogenous_virus");    if ( !m_WasDesc ) {        DO_NOTE(seqfeat_note);        DO_NOTE(orgmod_note);        DO_NOTE(subsource_note);    }    x_FormatNoteQual(eSQ_common_name, "common");    x_FormatNoteQual(eSQ_zero_orgmod, "?");    x_FormatNoteQual(eSQ_one_orgmod,  "?");    x_FormatNoteQual(eSQ_zero_subsrc, "?");#undef DO_NOTE    DO_QUAL(sequenced_mol);    DO_QUAL(label);    DO_QUAL(usedin);    DO_QUAL(citation);#undef DO_QUAL}END_SCOPE(objects)END_NCBI_SCOPE/** ===========================================================================** $Log: flat_feature.cpp,v $* Revision 1000.1  2004/06/01 19:43:05  gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.11** Revision 1.11  2004/05/21 21:42:53  gorelenk* Added PCH ncbi_pch.hpp** Revision 1.10  2003/10/17 20:58:41  ucko* Don't assume coding-region features have their "product" fields set.** Revision 1.9  2003/10/16 20:21:53  ucko* Fix a copy-and-paste error in CFlattishFeature::x_AddQuals** Revision 1.8  2003/10/08 21:11:12  ucko* Add a couple of accessors to IFlattishFeature for the GFF/GTF formatter.** Revision 1.7  2003/07/22 18:04:13  dicuccio* Fixed access of unset optional variables** Revision 1.6  2003/06/02 16:06:42  dicuccio* Rearranged src/objects/ subtree.  This includes the following shifts:*     - src/objects/asn2asn --> arc/app/asn2asn*     - src/objects/testmedline --> src/objects/ncbimime/test*     - src/objects/objmgr --> src/objmgr*     - src/objects/util --> src/objmgr/util*     - src/objects/alnmgr --> src/objtools/alnmgr*     - src/objects/flat --> src/objtools/flat*     - src/objects/validator --> src/objtools/validator*     - src/objects/cddalignview --> src/objtools/cddalignview* In addition, libseq now includes six of the objects/seq... libs, and libmmdb* replaces the three libmmdb? libs.** Revision 1.5  2003/04/24 16:15:58  vasilche* Added missing includes and forward class declarations.** Revision 1.4  2003/03/21 18:49:17  ucko* Turn most structs into (accessor-requiring) classes; replace some* formerly copied fields with pointers to the original data.** Revision 1.3  2003/03/11 15:37:51  kuznets* iterate -> ITERATE** Revision 1.2  2003/03/10 22:01:36  ucko* Change SLegalImport::m_Name from string to const char* (needed by MSVC).** Revision 1.1  2003/03/10 16:39:09  ucko* Initial check-in of new flat-file generator*** ===========================================================================*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?