Пример #1
0
//  ----------------------------------------------------------------------------
bool CSoMap::xMapMiscRecomb(
    const CSeq_feat& feature,
    string& so_type)
//  ----------------------------------------------------------------------------
{
    map<string, string> mapRecombClassToSoType = {
        {"meiotic", "meiotic_recombination_region"},
        {"mitotic", "mitotic_recombination_region"},
        {"non_allelic_homologous", "non_allelic_homologous_recombination_region"},
        {"meiotic_recombination", "meiotic_recombination_region"},
        {"mitotic_recombination", "mitotic_recombination_region"},
        {"non_allelic_homologous_recombination", "non_allelic_homologous_recombination_region"},
        {"other", "recombination_region"},
    };
    string recomb_class = feature.GetNamedQual("recombination_class");
    if (recomb_class.empty()) {
        return false;
    }
    auto cit = mapRecombClassToSoType.find(recomb_class);
    if (cit == mapRecombClassToSoType.end()) {
        so_type = recomb_class;
        return true;
    }
    so_type = cit->second;
    return true;
}
Пример #2
0
//  ----------------------------------------------------------------------------
bool CSoMap::xMapNcRna(
    const CSeq_feat& feature,
    string& so_type)
//  ----------------------------------------------------------------------------
{
    map<string, string> mapNcRnaClassToSoType = {
        {"lncRNA", "lnc_RNA"},
        {"other", "ncRNA"},
    };
    string ncrna_class = feature.GetNamedQual("ncRNA_class");
    if (ncrna_class.empty()) {
        if (feature.IsSetData()  &&
                feature.GetData().IsRna()  &&
                feature.GetData().GetRna().IsSetExt()  &&
                feature.GetData().GetRna().GetExt().IsGen()  &&
                feature.GetData().GetRna().GetExt().GetGen().IsSetClass()) {
            ncrna_class = feature.GetData().GetRna().GetExt().GetGen().GetClass();
            if (ncrna_class == "classRNA") {
                ncrna_class = "ncRNA";
            }
        }
    }
    if (ncrna_class.empty()) {
        return false;
    }
    auto cit = mapNcRnaClassToSoType.find(ncrna_class);
    if (cit == mapNcRnaClassToSoType.end()) {
        so_type = ncrna_class;
        return true;
    }
    so_type = cit->second;
    return true;
}
Пример #3
0
//  ----------------------------------------------------------------------------
bool CSoMap::xMapRegulatory(
    const CSeq_feat& feature,
    string& so_type)
//  ----------------------------------------------------------------------------
{
    map<string, string> mapRegulatoryClassToSoType = {
        {"DNase_I_hypersensitive_site", "DNaseI_hypersensitive_site"},
        {"GC_signal", "GC_rich_promoter_region"},
        {"enhancer_blocking_element", "regulatory_region"},
        {"imprinting_control_region", "regulatory_region"},
        {"matrix_attachment_region", "matrix_attachment_site"},
        {"other", "regulatory_region"},
        {"response_element", "regulatory_region"},
        {"ribosome_binding_site", "ribosome_entry_site"},
    };
    string regulatory_class = feature.GetNamedQual("regulatory_class");
    if (regulatory_class.empty()) {
        return false;
    }
    auto cit = mapRegulatoryClassToSoType.find(regulatory_class);
    if (cit == mapRegulatoryClassToSoType.end()) {
        so_type = regulatory_class;
        return true;
    }
    so_type = cit->second;
    return true;
}
Пример #4
0
//  ----------------------------------------------------------------------------
bool CSoMap::xMapRepeatRegion(
    const CSeq_feat& feature,
    string& so_type)
//  ----------------------------------------------------------------------------
{
    map<string, string> mapSatelliteToSoType = {
        {"satellite", "satellite_DNA"},
        {"microsatellite", "microsatellite"},
        {"minisatellite", "minisatellite"},
    };
    string satellite = feature.GetNamedQual("satellite");
    if (!satellite.empty()) {
        auto cit = mapSatelliteToSoType.find(satellite);
        if (cit == mapSatelliteToSoType.end()) {
            return false;
        }
        so_type = cit->second;
        return true;
    }

    map<string, string> mapRptTypeToSoType = {
        {"tandem", "tandem_repeat"},
        {"inverted", "inverted_repeat"},
        {"flanking", "repeat_region"},
        {"terminal", "repeat_region"},
        {"direct", "direct_repeat"},
        {"dispersed", "dispersed_repeat"},
        {"nested", "nested_repeat"},
        {"non_ltr_retrotransposon_polymeric_tract", "non_LTR_retrotransposon_polymeric_tract"},
        {"x_element_combinatorical_repeat", "X_element_combinatorical_repeat"},
        {"y_prime_element", "Y_prime_element"},
        {"other", "repeat_region"},
    };
    string rpt_type = feature.GetNamedQual("rpt_type");
    if (rpt_type.empty()) {
        so_type = "repeat_region";
    }
    auto cit = mapRptTypeToSoType.find(rpt_type);
    if (cit == mapRptTypeToSoType.end()) {
        so_type = rpt_type;
        return true;
    }
    so_type = cit->second;
    return true;
}
Пример #5
0
//  ----------------------------------------------------------------------------
bool CBedGraphWriter::xWriteSingleFeature(
    const CBedTrackRecord& trackdata,
    const CSeq_feat& feature)
//  ----------------------------------------------------------------------------
{
    CBedGraphRecord bedRecord;

    const CSeq_loc& location = feature.GetLocation();
    if (!location.IsInt()) {
        NCBI_THROW(
            CObjWriterException,
            eInterrupted,
            "BedGraph writer does not support feature locations that are not intervals.");
    }
    const CSeq_interval& interval = location.GetInt();

    const string& scoreStr = feature.GetNamedQual("score");
    if (scoreStr.empty()) {
        NCBI_THROW(
            CObjWriterException,
            eInterrupted,
            "BedGraph writer only supports features with a \"score\" qualifier.");
    }
    double score = 0;
    try {
        score = NStr::StringToDouble(scoreStr);
    }
    catch(CException&) {
        NCBI_THROW(
            CObjWriterException,
            eInterrupted,
            "BedGraph writer encountered feature with bad \"score\" qualifier.");
    }

    const CSeq_id& id = interval.GetId();
    string recordId;
    id.GetLabel(&recordId);
    bedRecord.SetChromId(recordId);

    bedRecord.SetChromStart(interval.GetFrom());
    bedRecord.SetChromEnd(interval.GetTo()-1);
    bedRecord.SetChromValue(score);
    bedRecord.Write(m_Os);
    return true;
}
Пример #6
0
//  ----------------------------------------------------------------------------
bool CSoMap::xMapBond(
    const CSeq_feat& feature,
    string& so_type)
//  ----------------------------------------------------------------------------
{
    map<string, string> mapBondTypeToSoType = {
        {"disulfide", "disulfide_bond"},
        {"xlink", "cross_link"},
    };
    string bond_type = feature.GetNamedQual("bond_type");
    if (bond_type.empty()) {
        return false;
    }
    auto cit = mapBondTypeToSoType.find(bond_type);
    if (cit == mapBondTypeToSoType.end()) {
        so_type = bond_type;
        return true;
    }
    so_type = cit->second;
    return true;
}
Пример #7
0
//  ----------------------------------------------------------------------------
bool CSoMap::xMapMiscFeature(
    const CSeq_feat& feature,
    string& so_type)
//  ----------------------------------------------------------------------------
{
    map<string, string> mapFeatClassToSoType = {
        {"transcription_start_site", "TSS"},
        {"other", "sequence_feature"},
    };
    string feat_class = feature.GetNamedQual("feat_class");
    if (feat_class.empty()) {
        so_type = "sequence_feature";
        return true;
    }
    auto cit = mapFeatClassToSoType.find(feat_class);
    if (cit == mapFeatClassToSoType.end()) {
        so_type = feat_class;
        return true;
    }
    so_type = cit->second;
    return true;
}