コード例 #1
0
 /**
  * If the given feature can be added directly to this Entry, then return it, otherwise create and
  * return a new feature of the appropriate type.
  *
  * @param copy if true then always new a new copy of the Feature.
  */
 protected Object makeNativeFeature(final Feature feature, final boolean copy) {
   if (!copy
       && (feature instanceof EmblStreamFeature && this instanceof EmblDocumentEntry
           || feature instanceof GenbankStreamFeature && this instanceof GenbankDocumentEntry)) {
     return (PublicDBStreamFeature) feature;
   } else {
     try {
       if (feature instanceof GFFStreamFeature) return mapGffToNativeFeature(feature);
       else if (this instanceof EmblDocumentEntry) return new EmblStreamFeature(feature);
       else return new GenbankStreamFeature(feature);
     } catch (NullPointerException npe) {
       System.err.println(((uk.ac.sanger.artemis.Feature) feature.getUserData()).getIDString());
       throw npe;
     }
   }
 }
コード例 #2
0
  /**
   * Change the stop_codon_redefined_as_selenocysteine SO qualifier to the transl_except EMBL
   * qualifier.
   *
   * @param qualifiers
   * @param feature
   */
  private void handleSelenocysteine(QualifierVector qualifiers, Feature feature) {
    if (!feature.getKey().getKeyString().equals(DatabaseDocument.EXONMODEL)) return;
    qualifiers.removeQualifierByName("stop_codon_redefined_as_selenocysteine");

    uk.ac.sanger.artemis.Feature f = ((uk.ac.sanger.artemis.Feature) feature.getUserData());

    int translatedBasePosion = 0;
    String aa = f.getTranslation().toString();
    for (int i = 0; i < aa.length(); i++) {
      if (AminoAcidSequence.isStopCodon(aa.charAt(i))) {
        translatedBasePosion = i * 3;
        break;
      }
    }

    FeatureSegmentVector segments = f.getSegments();
    int nbases = 0;
    int sequenceloc = 0;
    for (int i = 0; i < segments.size(); i++) {
      int seglen = segments.elementAt(i).getBases().length();
      if (nbases + seglen > translatedBasePosion) {
        Bases bases = f.getStrand().getBases();
        sequenceloc =
            segments.elementAt(i).getStart().getPosition() + (translatedBasePosion - nbases);

        if (!f.isForwardFeature()) sequenceloc = bases.getComplementPosition(sequenceloc);
      }
      nbases += seglen;
    }

    String pos = "";
    if (f.isForwardFeature()) pos = sequenceloc + ".." + (sequenceloc + 2);
    else pos = "complement(" + (sequenceloc - 2) + ".." + sequenceloc + ")";

    qualifiers.add(new Qualifier("transl_except", "(pos:" + pos + ",aa:Sec)"));
  }