Ejemplo n.º 1
0
//  ----------------------------------------------------------------------------
bool CGtfRecord::MakeChildRecord(
    const CGtfRecord& parent,
    const CSeq_interval& location,
    unsigned int uExonNumber )
//  ----------------------------------------------------------------------------
{
    if ( ! location.CanGetFrom() || ! location.CanGetTo() ) {
        return false;
    }
    m_strId = parent.m_strId;
    m_strSource = parent.m_strSource;
    m_strType = parent.m_strType;
    m_strGeneId = parent.GeneId();
    m_strTranscriptId = parent.TranscriptId();

    m_uSeqStart = location.GetFrom();
    m_uSeqStop = location.GetTo();
    if ( parent.m_pdScore ) {
        m_pdScore = new double( *(parent.m_pdScore) );
    }
    if ( parent.m_peStrand ) {
        m_peStrand = new ENa_strand( *(parent.m_peStrand) );
    }

    m_Attributes.insert( parent.m_Attributes.begin(), parent.m_Attributes.end() );
    if ( 0 != uExonNumber ) {
        SetAttribute("exon_number", NStr::UIntToString(uExonNumber));
    }
    return true;
};
Ejemplo n.º 2
0
//  ----------------------------------------------------------------------------
void CGffFeatureRecord::SetLocation(
    const CSeq_interval& interval) 
//  ----------------------------------------------------------------------------
{
    m_pLoc.Reset(new CSeq_loc());
    m_pLoc->SetInt().Assign(interval);
    if ( interval.CanGetFrom() ) {
        mSeqStart = interval.GetFrom();
    }
    if ( interval.CanGetTo() ) {
        mSeqStop = interval.GetTo();
    }
    unsigned int seqStart = Location().GetStart(eExtreme_Positional);
    unsigned int seqStop = Location().GetStop(eExtreme_Positional);
    string min = NStr::IntToString(seqStart + 1);
    string max = NStr::IntToString(seqStop + 1);
    if (Location().IsPartialStart(eExtreme_Biological)) {
        if (Location().GetStrand() == eNa_strand_minus) {
            SetAttribute("end_range", max + string(",."));
        }
        else {
            SetAttribute("start_range", string(".,") + min);
        }
    }
    if (Location().IsPartialStop(eExtreme_Biological)) {
        if (Location().GetStrand() == eNa_strand_minus) {
            SetAttribute("start_range", string(".,") + min);
        }
        else {
            SetAttribute("end_range", max + string(",."));
        }
    }

    if ( interval.IsSetStrand() ) {
        SetStrand(interval.GetStrand());
    }
}