*/
package jalview.gui;
+import jalview.api.FeatureSettingsModelI;
+import jalview.bin.Cache;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
-import jalview.io.FormatAdapter;
-import jalview.io.IdentifyFile;
+import jalview.io.gff.SequenceOntologyI;
import jalview.util.DBRefUtils;
import jalview.util.MessageManager;
import jalview.ws.dbsources.das.api.DasSourceRegistryI;
}
}
if (sfetch == null
- || dasRegistry != jalview.bin.Cache.getDasSourceRegistry()
- || lastDasSourceRegistry != (jalview.bin.Cache
- .getDasSourceRegistry().getDasRegistryURL() + jalview.bin.Cache
+ || dasRegistry != Cache.getDasSourceRegistry()
+ || lastDasSourceRegistry != (Cache.getDasSourceRegistry()
+ .getDasRegistryURL() + Cache
.getDasSourceRegistry().getLocalSourceString())
.hashCode())
{
.getString("status.init_sequence_database_fetchers"),
Thread.currentThread().hashCode());
}
- dasRegistry = jalview.bin.Cache.getDasSourceRegistry();
+ dasRegistry = Cache.getDasSourceRegistry();
dasRegistry.refreshSources();
jalview.ws.SequenceFetcher sf = new jalview.ws.SequenceFetcher();
.split(";"));
Iterator<String> en = Arrays.asList(new String[0]).iterator();
int nqueries = qries.length;
+
+ FeatureSettingsModelI preferredFeatureColours = null;
while (proxies.hasNext() && (en.hasNext() || nextfetch.size() > 0))
{
if (!en.hasNext() && nextfetch.size() > 0)
proxy.getDbName() }), Thread.currentThread()
.hashCode());
isAliSource = proxy.isAlignmentSource();
- if (proxy.getAccessionSeparator() == null)
+ if (proxy.getMaximumQueryCount() == 1)
{
while (en.hasNext())
{
}
} catch (Exception e)
{
- jalview.bin.Cache.log.info("Error retrieving " + item
+ Cache.log.info(
+ "Error retrieving " + item
+ " from " + proxy.getDbName(), e);
nextfetch.add(item);
}
boolean rfound = false;
for (int r = 0; r < rs.length; r++)
{
- if (rs[r] != null
- && (found = DBRefUtils.searchRefs(
- rs[r].getDBRefs(), dbr)) != null
- && found.length > 0)
+ if (rs[r] != null)
{
- rfound = true;
- rs[r] = null;
+ found = DBRefUtils.searchRefs(rs[r].getDBRefs(), accId);
+ if (found != null && found.length > 0)
+ {
+ rfound = true;
+ rs[r] = null;
+ }
}
}
if (!rfound)
// Stack results ready for opening in alignment windows
if (aresult != null && aresult.size() > 0)
{
+ FeatureSettingsModelI proxyColourScheme = proxy
+ .getFeatureColourScheme();
+ if (proxyColourScheme != null)
+ {
+ preferredFeatureColours = proxyColourScheme;
+ }
+
AlignmentI ar = null;
if (isAliSource)
{
// process results
while (presult.size() > 0)
{
- parseResult(presult.remove(0), presultTitle.remove(0), null);
+ parseResult(presult.remove(0), presultTitle.remove(0), null,
+ preferredFeatureColours);
}
// only remove visual delay after we finished parsing.
guiWindow.setProgressBar(null, Thread.currentThread().hashCode());
resetDialog();
}
- AlignmentI parseResult(String result, String title)
- {
- String format = new IdentifyFile().identify(result, "Paste");
- AlignmentI sequences = null;
- if (FormatAdapter.isValidFormat(format))
- {
- sequences = null;
- try
- {
- sequences = new FormatAdapter().readFile(result.toString(),
- "Paste", format);
- } catch (Exception ex)
- {
- }
-
- if (sequences != null)
- {
- return parseResult(sequences, title, format);
- }
- }
- else
- {
- showErrorMessage("Error retrieving " + textArea.getText() + " from "
- + database.getSelectedItem());
- }
-
- return null;
- }
-
/**
*
* @return a standard title for any results retrieved using the currently
}
AlignmentI parseResult(AlignmentI al, String title,
- String currentFileFormat)
+ String currentFileFormat,
+ FeatureSettingsModelI preferredFeatureColours)
{
if (al != null && al.getHeight() > 0)
}
}
+
+ if (preferredFeatureColours != null)
+ {
+ af.getViewport().applyFeaturesStyle(preferredFeatureColours);
+ }
+ if (Cache.getDefault("HIDE_INTRONS", true))
+ {
+ hideIntronsIfPresent(af);
+ }
+
Desktop.addInternalFrame(af, title, AlignFrame.DEFAULT_WIDTH,
AlignFrame.DEFAULT_HEIGHT);
try
{
- af.setMaximum(jalview.bin.Cache.getDefault("SHOW_FULLSCREEN",
+ af.setMaximum(Cache.getDefault("SHOW_FULLSCREEN",
false));
} catch (Exception ex)
{
return al;
}
+ /**
+ * Hide columns not containing 'exon' features, provided there are exon
+ * features on the alignment
+ *
+ * @param af
+ */
+ public void hideIntronsIfPresent(AlignFrame af)
+ {
+ boolean hasExons = af.avc.markColumnsContainingFeatures(false, false,
+ false,
+ SequenceOntologyI.EXON);
+ if (hasExons)
+ {
+ af.avc.markColumnsContainingFeatures(true, false, true,
+ SequenceOntologyI.EXON);
+ af.getViewport().hideSelectedColumns();
+ }
+ }
+
void showErrorMessage(final String error)
{
resetDialog();