import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
+import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
List<SequenceI> seqsWithoutSourceDBRef = null;
+ private boolean noChooserGUI = false;
+
private static StructureViewer lastTargetedView = null;
public StructureChooser(SequenceI[] selectedSeqs, SequenceI selectedSeq,
AlignmentPanel ap)
{
+ this(selectedSeqs, selectedSeq, ap, false);
+ }
+
+ public StructureChooser(SequenceI[] selectedSeqs, SequenceI selectedSeq,
+ AlignmentPanel ap, boolean noChooserGUI)
+ {
// which FTS engine to use
data = StructureChooserQuerySource.getQuerySourceFor(selectedSeqs);
initDialog();
this.selectedSequence = selectedSeq;
this.selectedSequences = selectedSeqs;
this.progressIndicator = (ap == null) ? null : ap.alignFrame;
+ this.noChooserGUI = noChooserGUI;
init();
}
populateFilterComboBox(isStructuresDiscovered(), cachedPDBExists);
discoverStructureViews();
updateProgressIndicator(null, startTime);
- mainFrame.setVisible(true);
+ mainFrame.setVisible(noChooserGUI);
updateCurrentView();
}
@Override
public void run()
{
+ btn_queryTDB.setEnabled(false);
populateSeqsWithoutSourceDBRef();
final int y = seqsWithoutSourceDBRef.size();
{ new jalview.ws.dbsources.Uniprot() }, null, false);
dbRefFetcher.addListener(afterDbRefFetch);
// ideally this would also gracefully run with callbacks
+
dbRefFetcher.fetchDBRefs(true);
}
else
}
};
};
- int threshold = Cache.getDefault("THRESHOLD_WARN_UNIPROT_FETCH",
+ int threshold = Cache.getDefault("UNIPROT_AUTOFETCH_THRESHOLD",
THRESHOLD_WARN_UNIPROT_FETCH_NEEDED);
Console.debug("Using Uniprot fetch threshold of " + threshold);
if (ignoreGui || seqsWithoutSourceDBRef.size() < threshold)
}
// need cancel and no to result in the discoverPDB action - mocked is
// 'cancel' TODO: mock should be OK
- JvOptionPane.newOptionDialog(this)
+
+ StructureChooser thisSC = this;
+ JvOptionPane.newOptionDialog(thisSC.getFrame())
.setResponseHandler(JvOptionPane.OK_OPTION,
discoverCanonicalDBrefs)
.setResponseHandler(JvOptionPane.CANCEL_OPTION, revertview)
null, new Object[]
{ MessageManager.getString("action.ok"),
MessageManager.getString("action.cancel") },
- MessageManager.getString("action.ok"));
+ MessageManager.getString("action.ok"), false);
}
/**
{
if (selectedSequences != null)
{
+ lbl_loading.setVisible(true);
Thread refreshThread = new Thread(new Runnable()
{
@Override
filterResultSet(
((FilterOption) cmb_filterOption.getSelectedItem())
.getValue());
+ lbl_loading.setVisible(false);
}
});
refreshThread.start();
{
return notQueriedTDBYet;
}
+
+ /**
+ * Open a single structure file for a given sequence
+ */
+ public static void openStructureFileForSequence(AlignmentPanel ap,
+ SequenceI seq, File sFile)
+ {
+ StructureChooser sc = new StructureChooser(new SequenceI[] { seq }, seq,
+ ap, true);
+ StructureSelectionManager ssm = ap.getStructureSelectionManager();
+ PDBEntry fileEntry = null;
+ try
+ {
+ fileEntry = new AssociatePdbFileWithSeq().associatePdbWithSeq(
+ sFile.getAbsolutePath(), DataSourceType.FILE, seq, true,
+ Desktop.instance);
+ } catch (Exception e)
+ {
+ Console.error("Could not open structure file '"
+ + sFile.getAbsolutePath() + "'");
+ return;
+ }
+
+ StructureViewer sViewer = sc.launchStructureViewer(ssm,
+ new PDBEntry[]
+ { fileEntry }, ap, new SequenceI[] { seq });
+
+ sc.mainFrame.dispose();
+ sc.noChooserGUI = false;
+ }
}