/*
 The Broad Institute
 SOFTWARE COPYRIGHT NOTICE AGREEMENT
 This software and its documentation are copyright (2006) by the
 Broad Institute/Massachusetts Institute of Technology. All rights are
 reserved.

 This software is supplied without any warranty or guaranteed support
 whatsoever. Neither the Broad Institute nor MIT can be responsible for its
 use, misuse, or functionality.
 */

package calhoun.gebo.internal.db;

import java.sql.ResultSet;
import java.sql.SQLException;

import calhoun.gebo.internal.db.ArgoTranscriptService;
import calhoun.gebo.model.FeatureTrack;
import calhoun.gebo.model.Sequence;
import calhoun.gebo.model.Strand;
import calhoun.gebo.util.Informer;

/**
 * 
 * @author <a href="mailto:reinhard@genome.wi.mit.edu">Reinhard Engels </a>
 */
public class AnnotatedTranscript extends CalhounAnnotatedTranscript {

    private static Informer I = new Informer(AnnotatedTranscript.class);

    // /////////////////////////////////////////////////////////////////////////
    // Constructors.
    // /////////////////////////////////////////////////////////////////////////

    public AnnotatedTranscript(Sequence sequence, FeatureTrack track,
            ResultSet resultSet, int editFlag) throws SQLException {
        super(sequence, track, resultSet, editFlag);
        getTranscriptType();
        setOrfVisible(true);
    }

    public AnnotatedTranscript(Sequence sequence, String label, String id,
            int start, int stop, FeatureTrack track, Strand strand, int editFlag) {
        super(sequence, label, id, start, stop, track, strand, editFlag);
        if (stop > sequence.getLength() || start < 1) {
            I.error("Transcript coordinates are out of sequence bounds!");
        }
        setOrfVisible(true);
    }

    public static void promote(CalhounFeature cf) throws Exception {
        ArgoTranscriptService service = new ArgoTranscriptService(
                CalhounConnectionManager.getInstance().getConnection());
        service.promoteTranscript(cf.getId(), 1, CalhounConnectionManager
                .getInstance().getUsername(), CalhounConnectionManager
                .getInstance().getUsername());
    }

    public String getCellType() {
        return "E";
    }

}