* @return
*/
public static MainFrame[] createInstancesFromDb(int databaseIndex,
- AlignmentViewport viewport)
+ AlignmentViewport viewport, String defaultIdentifier)
{
URL url = null;
Desktop.desktop,
client.getInstructions() + "\n(Reference: "
+ client.getReference() + ")",
- client.getDescription(), JvOptionPane.QUESTION_MESSAGE);
+ client.getDescription(), JvOptionPane.QUESTION_MESSAGE, null,
+ null, defaultIdentifier).toString();
if ((identifier != null) && (identifier.trim().length() > 0))
{
import jalview.datamodel.AlignmentOrder;
import jalview.datamodel.AlignmentView;
import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.DBRefEntry;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.HiddenSequences;
import jalview.datamodel.PDBEntry;
import jalview.schemes.ColourSchemes;
import jalview.schemes.ResidueColourScheme;
import jalview.schemes.TCoffeeColourScheme;
+import jalview.util.DBRefUtils;
import jalview.util.MessageManager;
import jalview.viewmodel.AlignmentViewport;
import jalview.viewmodel.ViewportRanges;
@Override
protected void loadTreeBaseStudy_actionPerformed(ActionEvent e)
{
- chooseTreeDb(0);
+ chooseTreeDb(0, null);
}
@Override
protected void loadTreeBase_actionPerformed(ActionEvent e)
{
- chooseTreeDb(1);
+ chooseTreeDb(1, null);
}
@Override
protected void loadTreePfam_actionPerformed(ActionEvent e)
{
- chooseTreeDb(2);
+
+ // only DBRefs of first sequence are checked for matching DB for now
+ SequenceI seq = viewport.getAlignment().getSequenceAt(0);
+ String dbId = null;
+ for (DBRefEntry pfamRef : DBRefUtils
+ .searchRefsForSource(seq.getDBRefs(), "pfam"))
+ {
+ if (pfamRef.getAccessionId().startsWith("PF"))
+ {
+ dbId = pfamRef.getAccessionId().replaceAll("[A-Za-z]", "");
+ }
+
+ }
+ chooseTreeDb(2, dbId);
}
@Override
protected void loadTreeFam_actionPerformed(ActionEvent e)
{
- chooseTreeDb(3);
+ chooseTreeDb(3, null);
}
@Override
protected void loadTreeOfLife_actionPerformed(ActionEvent e)
{
- chooseTreeDb(4);
+ chooseTreeDb(4, null);
}
*
* @param databaseIndex
*/
- public void chooseTreeDb(int databaseIndex)
+ public void chooseTreeDb(int databaseIndex, String defaultIdentifier)
{
- AptxInit.createInstancesFromDb(databaseIndex, viewport);
+ AptxInit.createInstancesFromDb(databaseIndex, viewport,
+ defaultIdentifier);
}
public TreePanel showNewickTree(NewickFile nf, String treeTitle)