Exemplo n.º 1
0
  protected String getIdForURL(SeqFeatureI f) {
    /* 02/06/2004: If user selected a whole result (a FeatureSet),
     * neither the id nor the name is what we want.
     * So just look at the first child of the FeatureSet
     * (which is probably a FeaturePair).  Is this bad?  --NH */
    if (f instanceof FeatureSet) {
      f = ((FeatureSet) f).getFeatureAt(0);
    }
    String id;
    if (f instanceof FeaturePair) {
      FeaturePair fp = (FeaturePair) f;
      SeqFeatureI sbjct = (SeqFeatureI) fp.getHitFeature();
      id = sbjct.getName();
      if (id.equals("") || id.equals("no_name")) id = f.getName();
      //      System.out.println("getIdForURL: for feature pair " + f.getName() + ", subject name =
      // " + id); // DEL
    } else {
      id = getDisplayName(f);
      //      System.out.println("getIdForURL: for feature " + f.getName() + ", display name = " +
      // id); // DEL
    }
    // Special case:  BDGP EST IDs look like "LD18592.5prime" rather than "LD18592",
    // which isn't what we want.  Need to leave out the .[53]prime part.
    // (Sima says there aren't any cases where we'd want to preserve that part.)
    if (id.endsWith(".3prime") || id.endsWith(".5prime")) {
      //      System.out.println("Truncating EST/cDNA ID " + id + " to remove .[35]prime");
      id = id.substring(0, id.lastIndexOf("."));
    }
    // Some ESTs IDs have :contig1 at the end
    if (id.indexOf(":contig") > 0) {
      id = id.substring(0, id.indexOf(":contig"));
      // In r4.1, I see EST IDs like UNKNOWN_RE01983:contig1 and INVERTED_GH07123:contig1
      if (id.indexOf("_") > 0) id = id.substring(id.indexOf("_") + 1);
    }
    // Some ESTs have _revcomp at the end, e.g. BE975849_revcomp
    if (id.indexOf("_revcomp") > 0) id = id.substring(0, id.indexOf("_revcomp"));

    return id;
  }