/* Need to special-case some URLs. It's yucky to do this, * but that's the only way this will work for some of the Drosophila * result types. The assumption in the code is that there is one URL * per type, but for us it depends on which database the hit is on. */ protected String getURLPrefix(FeatureProperty prop, SeqFeatureI f, String id) { String defaultURL = prop.getURLString(); if (!(f instanceof FeaturePair)) return (defaultURL); FeaturePair fp = (FeaturePair) f; SeqFeatureI fs = (SeqFeatureI) fp.getRefFeature(); String database = fs.getDatabase(); String url = defaultURL; /* Here we go--a bunch of special cases. * It sucks that these are in the code-- * these should be in the style file or something! */ String nucleotide = "nucleotide"; String protein = "protein"; String ENTREZ_N = "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=search&db=" + nucleotide + "&doptcmdl=GenBank&term="; String ENTREZ_P = "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=search&db=" + protein + "&doptcmdl=GenBank&term="; // In most cases, the IDs for BLASTX Similarity to Fly seem to work better // with the default SWALL URL; however, the AA ones seem not to be in SWALL // and we have to look in Entrez. Yuck. // if (prop.typeEquals("BLASTX Similarity to Fly") && id.startsWith("AA")) { if (prop.getDisplayType().startsWith("BLASTX") && id.startsWith("AA")) { url = ENTREZ_P; } else if (prop.typeEquals("Rodent") && (database.indexOf("unigene") >= 0)) { url = ENTREZ_N; } else if (prop.typeEquals("Insect") && (database.indexOf("dbEST") >= 0)) { url = ENTREZ_N; } // This isn't working right yet. The tRNA ids look like: // gb|AE002593|AE002593.trna5-ArgTCG // and we want just the part between the first two ||s. else { String acc; if (prop.typeEquals("tRNA-result") && (database.indexOf("na_tRNA.dros") >= 0)) { acc = id.substring(id.indexOf("|") + 1); acc = acc.substring(0, acc.indexOf("|")); } else if (prop.typeEquals("New Fly Sequence")) { // These accs look like gi||gb|AY135216|AY135216 acc = id; if (acc.indexOf("|") >= 0) acc = acc.substring(acc.lastIndexOf("|") + 1); /* We've already appended the correct acc, * but the URL constructor will automatically * slap the uncorrected one at the end. * The last # is so that when the whole ID is appended at the end, it * won't have any effect. */ url = ENTREZ_N + acc + "#"; } } return url; }