コード例 #1
0
  private String getDisplayName(SeqFeatureI sf) {
    String display_name = "";

    // Annot
    if (sf instanceof AnnotatedFeatureI) {
      display_name = sf.getName();
    }

    // Not Annot
    else {
      // FeatPair
      FeatureSetI fset =
          (sf.canHaveChildren() ? (FeatureSetI) sf : (FeatureSetI) sf.getRefFeature());
      // cant do as seqfeature as getHitSequence() is in FeatureSet and not
      // SeqFeature and furthermore cant do a getHitFeature().getRefSequence()
      // as FeatureSet has no hit feature yet it has hit sequence
      // SeqFeatureI fset = sf.canHaveChildren() ? sf : sf.getRefFeature();
      SequenceI seq = (fset != null ? fset.getHitSequence() : null);
      SeqFeatureI featPair = null; // FeaturePairI fp;

      if (fset != null && fset.size() > 0 && (fset.getFeatureAt(0).hasHitFeature())) {
        featPair = fset.getFeatureAt(0);
      } else if (sf.hasHitFeature()) {
        featPair = sf; // fp = (FeaturePairI) sf;
      } // else {//fp = null; } // not necasary - already null

      if (seq == null && featPair != null) seq = featPair.getHitFeature().getRefSequence();
      if (seq == null) seq = sf.getFeatureSequence();

      if (seq != null) {
        display_name = seq.getName() != null ? seq.getName() : "";
      } else if (featPair != null) {
        SeqFeatureI hit = featPair.getHitFeature();
        display_name = hit.getName() != null ? hit.getName() : "";
      }
      /* NOT FeaturePair
         this will only be reached if not an annot, not a FS w fps
         and not a FeaturePair (or if fp hit name is "")
         in otherwords a seqfeature result
         added getName in for chado gene predics which are leaf seq feats
      */
      // shouldnt we check getName != null before using biotype??
      else display_name = getBioTypeForDisplay(sf);
    }
    return display_name;
  }
コード例 #2
0
  public CurationSet getCurationSet() throws apollo.dataadapter.ApolloAdapterException {
    GbrowseAdapterGUI gui = (GbrowseAdapterGUI) getUI(ApolloDataAdapterI.OP_READ_DATA);

    String chr = gui.getSelectedChr();
    int chrstart = Integer.parseInt(gui.getSelectedStart());
    int chrend = Integer.parseInt(gui.getSelectedEnd());

    mysql = new MySQLInstance(host, user, pass, port);
    db = mysql.fetchDatabaseByName(dbname);
    dba = new DBAdaptor(db);

    FeatureAdaptor fa = dba.getFeatureAdaptor();
    FeatureSetI f = fa.fetchByReferenceStartEnd(chr, chrstart, chrend);

    super.clearOldData();

    CurationSet curationSet = new CurationSet();

    curationSet.setChromosome(chr);
    curationSet.setLow(chrstart);
    curationSet.setHigh(chrend);
    curationSet.setStrand(0);

    StrandedFeatureSet sfset = new StrandedFeatureSet(new FeatureSet(), new FeatureSet());

    for (int i = 0; i < f.size(); i++) {
      SeqFeatureI sf = f.getFeatureAt(i);

      sfset.addFeature(sf);
    }

    curationSet.setResults(sfset);
    curationSet.setAnnots(new StrandedFeatureSet(new FeatureSet(), new FeatureSet()));
    curationSet.setName(chr + "." + chrstart + "-" + chrend);

    // super.notifyLoadingDone();

    return curationSet;
  }