*/
public abstract class StructureChooserQuerySource
{
- protected FTSRestRequest lastPdbRequest;
-
- protected FTSRestClientI pdbRestClient;
protected FTSDataColumnPreferences docFieldPrefs;
*
* @param seq
* - seq to generate a query for
+ * @param discoveredStructuresSet - existing set of entries - allows client side selection
* @param wantedFields
* - fields to retrieve
* @param selectedFilterOpt
* @throws Exception
*/
public abstract FTSRestResponse selectFirstRankedQuery(SequenceI seq,
- Collection<FTSDataColumnI> wantedFields, String fieldToFilterBy,
+ Collection<FTSData> discoveredStructuresSet, Collection<FTSDataColumnI> wantedFields, String fieldToFilterBy,
boolean b) throws Exception;
/**
public TableModel getTableModel(
Collection<FTSData> discoveredStructuresSet)
{
- return FTSRestResponse.getTableModel(lastPdbRequest,
+ return FTSRestResponse.getTableModel(getLastFTSRequest(),
discoveredStructuresSet);
}
+ protected abstract FTSRestRequest getLastFTSRequest();
+
public abstract PDBEntry[] collectSelectedRows(JTable restable,
int[] selectedRows, List<SequenceI> selectedSeqsToView);
* will be constructed with 'addSeparator==true'
*/
public abstract List<FilterOption> getAvailableFilterOptions(String VIEWS_FILTER);
-}
\ No newline at end of file
+
+ /**
+ * construct a structure chooser query source for the given set of sequences
+ * @param selectedSeqs
+ * @return PDBe or 3DB query source
+ */
+ public static StructureChooserQuerySource getQuerySourceFor(
+ SequenceI[] selectedSeqs)
+ {
+ ThreeDBStructureChooserQuerySource tdbSource = new ThreeDBStructureChooserQuerySource();
+ boolean hasUniprot=false,hasCanonical=false;
+ boolean hasNA=false,hasProtein=false;
+ int protWithoutUni=0;
+ for (SequenceI seq : selectedSeqs)
+ {
+ hasNA |= !seq.isProtein();
+ hasProtein |= seq.isProtein();
+ if (seq.isProtein())
+ {
+ int refsAvailable = ThreeDBStructureChooserQuerySource.checkUniprotRefs(seq.getDBRefs());
+ if (refsAvailable > -2)
+ {
+ if (refsAvailable > -1)
+ hasCanonical = true;
+ }
+ hasUniprot = true;
+ }
+ else
+ {
+ protWithoutUni++;
+ }
+ }
+ //
+ // logic: all canonicals - no fetchdb
+ // some uniprot no canonicals: prompt do fetchDb for remaining
+ // no uniprot but protein: offer 3d-beacons search
+ //
+ if (hasProtein && hasCanonical && !hasNA)
+ {
+ return tdbSource;
+ }
+ return new PDBStructureChooserQuerySource();
+ }
+
+ /**
+ * some filter options may mean the original query needs to be executed again.
+ * @param selectedFilterOpt
+ * @return true if the fetchStructuresMetadata method needs to be called again
+ */
+ public abstract boolean needsRefetch(FilterOption selectedFilterOpt);
+
+
+
+ public void updateAvailableFilterOptions(String VIEWS_FILTER,
+ List<FilterOption> xtantOptions, Collection<FTSData> lastFTSData)
+ {
+ // TODO Auto-generated method stub
+
+ }}
\ No newline at end of file