Пример #1
0
  private String generateAnalysisURL(SeqFeatureI f) {
    // Figure out URL for getting more information about this feature.
    // If more than one feature was selected, use the LAST one.
    String id = getIdForURL(f);
    FeatureProperty prop = Config.getPropertyScheme().getFeatureProperty(f.getFeatureType());

    String urlPrefix = getURLPrefix(prop, f, id);

    if (urlPrefix == null) {
      String m =
          "Sorry, no URL registered for type "
              + f.getFeatureType()
              + "\nin tiers file "
              + Config.getStyle().getTiersFile();
      JOptionPane.showMessageDialog(null, m);
      return null;
    }
    return URLQueryGenerator.getURL(urlPrefix, id);
  }
Пример #2
0
 /**
  * This just returns sf.getBioType() (capitalized) unless its a transcript. For transcript it only
  * returns "Transcript" if its part of a Gene. Otherwise it returns its parent's bio type +
  * transcript. (should it not tack on the transcript?) Thus a tRNA's transcript would display
  * "tRNA transcript", where a gene's transcript would display just "Transcript". Should it
  * actually display "Gene transcript"? rename getTypeForDisplay?
  */
 public String getBioTypeForDisplay(SeqFeatureI sf) {
   String typeDisplay;
   if (sf instanceof AnnotatedFeatureI) {
     typeDisplay = sf.getTopLevelType();
     typeDisplay = capitalize(typeDisplay);
     if (!sf.getTopLevelType().equalsIgnoreCase(sf.getFeatureType()))
       typeDisplay += " " + capitalize(sf.getFeatureType());
   } else {
     String db = sf.getDatabase();
     // Don't bother showing db name if it is "dummy"
     if (db != null && !db.equals("") && !db.equals("dummy"))
       typeDisplay = sf.getProgramName() + ":" + sf.getDatabase();
     // yet again, the users have requested a change
     // Now instead of an enumeration it is the range of the feature
     else {
       typeDisplay = (sf.getProgramName() + ":" + sf.getStart() + "-" + sf.getEnd());
     }
   }
   return typeDisplay;
 }
  /**
   * Display AnnotatedFeatureI feature. Exon, Transcript, and Gene are all GenericAnnotationI. No
   * selection event is fired. (selectAnnot fires and displays)
   */
  private void displayAnnot(AnnotatedFeatureI annot) {
    currentAnnot = annot;
    if (currentAnnot == null) {
      transcriptComboBox.removeAllItems();
      transcriptComboBox.addItem("<no feature selected>");
      lengthLabel.setText("Translation length: <no feature selected>");
      upstream_button.setLabel("");
      downstream_button.setLabel("");
      translationViewer.setTranscript(null, editorPanel.getSelectedTier()); // ??
      return;
    }

    // else {
    setupTranscriptComboBox(currentAnnot);

    SeqFeatureI topAnnot = currentAnnot;
    if (topAnnot.isTranscript()) topAnnot = currentAnnot.getRefFeature();
    if (topAnnot.isProteinCodingGene()) {
      String translation = currentAnnot.translate();
      if (translation == null) {
        lengthLabel.setText("Translation length: <no start selected>");
      } else {
        lengthLabel.setText("Translation length: " + currentAnnot.translate().length());
      }
    } else {
      lengthLabel.setText(topAnnot.getFeatureType() + " annotation");
    }
    FeatureSetI holder = (FeatureSetI) topAnnot.getRefFeature();
    neighbor_up = null;
    neighbor_down = null;
    if (holder != null) {

      int index = holder.getFeatureIndex(topAnnot);
      // get next neighbor up that has whole sequence
      for (int i = index - 1; i >= 0 && neighbor_up == null; i--) {
        FeatureSetI gene_sib = (FeatureSetI) holder.getFeatureAt(i);
        if (gene_sib.getFeatureAt(0) instanceof Transcript) {
          Transcript trans = (Transcript) gene_sib.getFeatureAt(0);
          if (trans.haveWholeSequence()) // szap.getCurationSet()))
          neighbor_up = trans;
        }
      }

      // get next neighbor down that has whole sequence
      for (int i = index + 1; i < holder.size() && neighbor_down == null; i++) {
        FeatureSetI gene_sib = (FeatureSetI) holder.getFeatureAt(i);
        if (gene_sib.getFeatureAt(0) instanceof Transcript) {
          Transcript trans = (Transcript) gene_sib.getFeatureAt(0);
          if (trans.haveWholeSequence()) // szap.getCurationSet()))
          neighbor_down = trans;
        }
      }
    }
    upstream_button.setLabel(
        neighbor_up == null
            ? ""
            : "Go to next 5' annotation (" + neighbor_up.getParent().getName() + ")");
    upstream_button.setVisible(neighbor_up != null);
    downstream_button.setLabel(
        neighbor_down == null
            ? ""
            : "Go to next 3' annotation (" + neighbor_down.getParent().getName() + ")");
    downstream_button.setVisible(neighbor_down != null);
    // }
    // todo - translationViewer take in 1 level annot
    if (currentAnnot.isTranscript())
      translationViewer.setTranscript((Transcript) currentAnnot, editorPanel.getSelectedTier());
  }