Skip to content

Commit

Permalink
Add explicit menu item for htsget URLs -- avoids attempts to guess
Browse files Browse the repository at this point in the history
  • Loading branch information
jrobinso committed Oct 2, 2023
1 parent b8e4abe commit bba1101
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 51 deletions.
9 changes: 4 additions & 5 deletions src/main/java/org/broad/igv/ui/IGVMenuBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,12 @@ JMenu createFileMenu() {
menuAction.setToolTipText(UIConstants.LOAD_TRACKS_TOOLTIP);
menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));

menuAction = new LoadFromURLMenuAction(LoadFromURLMenuAction.LOAD_FROM_HTSGET, 0, igv);
menuAction.setToolTipText(UIConstants.LOAD_HTSGET_TOOLTOP);
menuAction = new LoadFromServerAction("Load IGV Hosted Tracks...", KeyEvent.VK_S, igv);
menuAction.setToolTipText(UIConstants.LOAD_SERVER_DATA_TOOLTIP);
menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));


menuAction = new LoadFromServerAction("Load from IGV Server...", KeyEvent.VK_S, igv);
menuAction.setToolTipText(UIConstants.LOAD_SERVER_DATA_TOOLTIP);
menuAction = new LoadFromURLMenuAction(LoadFromURLMenuAction.LOAD_FROM_HTSGET, 0, igv);
menuAction.setToolTipText(UIConstants.LOAD_HTSGET_TOOLTOP);
menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));

if (PreferencesManager.getPreferences().getAsBoolean(DB_ENABLED)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ public static LinkedHashSet<String> getNodeURLs(String genomeURL) {
nodeURLs = getResourceUrls(bufferedReader);
} catch (IOException e) {
//This is pretty common, if there is no data registry file for the genome the file won't exist
log.error("Error loading genome registry file", e);
//log.error("Error loading genome registry file", e);
log.warn("No data found for current genome.");
} finally {
if (is != null) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ public class LoadFromURLMenuAction extends MenuAction {
static Logger log = LogManager.getLogger(LoadFilesMenuAction.class);
public static final String LOAD_FROM_URL = "Load from URL...";
public static final String LOAD_GENOME_FROM_URL = "Load Genome from URL...";

public static final String LOAD_FROM_HTSGET = "Load from htsget server...";
public static final String LOAD_FROM_HTSGET = "Load from htsget Server...";
private IGV igv;

public LoadFromURLMenuAction(String label, int mnemonic, IGV igv) {
Expand All @@ -76,7 +75,7 @@ public void actionPerformed(ActionEvent e) {
boolean isHtsGet = e.getActionCommand().equalsIgnoreCase(LOAD_FROM_HTSGET);
if (e.getActionCommand().equalsIgnoreCase(LOAD_FROM_URL) || isHtsGet) {

LoadFromURLDialog dlg = new LoadFromURLDialog(IGV.getInstance().getMainFrame());
LoadFromURLDialog dlg = new LoadFromURLDialog(IGV.getInstance().getMainFrame(), isHtsGet);
dlg.setVisible(true);

if (!dlg.isCanceled()) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/broad/igv/ui/action/MenuAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class MenuAction extends AbstractAction {
public MenuAction(String name, Icon icon, int mnemonic) {
super(name, icon);
if(mnemonic >= 0) {
putValue(MNEMONIC_KEY, new Integer(mnemonic));
putValue(MNEMONIC_KEY, mnemonic);
}
}

Expand Down
88 changes: 47 additions & 41 deletions src/main/java/org/broad/igv/ui/util/LoadFromURLDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@
/**
* @author James Robinson
*/
public class LoadFromURLDialog extends org.broad.igv.ui.IGVDialog {
public class LoadFromURLDialog extends org.broad.igv.ui.IGVDialog {

boolean canceled = false;
String fileURL;
String indexURL;

public LoadFromURLDialog(Frame owner) {
super(owner, "Load from URL");
initComponents();
public LoadFromURLDialog(Frame owner, boolean isHtsget) {
super(owner, isHtsget ? "htsget URL": "Load from URL");
initComponents(isHtsget);
}


Expand Down Expand Up @@ -82,7 +82,7 @@ public String getIndexURL() {
return indexURL;
}

private void initComponents() {
private void initComponents(boolean isHtsget) {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
// Generated using JFormDesigner non-commercial license
dialogPane = new JPanel();
Expand Down Expand Up @@ -112,69 +112,75 @@ private void initComponents() {
{
contentPanel.setBorder(new EmptyBorder(10, 10, 5, 5));
contentPanel.setLayout(new GridBagLayout());
((GridBagLayout)contentPanel.getLayout()).columnWidths = new int[] {0, 0, 0};
((GridBagLayout)contentPanel.getLayout()).rowHeights = new int[] {0, 0, 0, 0, 0, 0, 0};
((GridBagLayout)contentPanel.getLayout()).columnWeights = new double[] {0.0, 0.0, 1.0E-4};
((GridBagLayout)contentPanel.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};
((GridBagLayout) contentPanel.getLayout()).columnWidths = new int[]{0, 0, 0};
((GridBagLayout) contentPanel.getLayout()).rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0};
((GridBagLayout) contentPanel.getLayout()).columnWeights = new double[]{0.0, 0.0, 1.0E-4};
((GridBagLayout) contentPanel.getLayout()).rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};
contentPanel.add(vSpacer2, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 10, 0), 0, 0));
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 10, 0), 0, 0));

//---- label1 ----
label1.setText("File URL:");
contentPanel.add(label1, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 10, 5), 0, 0));

GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 10, 5), 0, 0));
fileField.setPreferredSize(new Dimension(720, 28));
fileField.setMinimumSize(new Dimension(720, 28));
//---- label2 ----
label2.setText("Index URL:");
contentPanel.add(label2, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 0, 5), 0, 0));

contentPanel.add(fileField, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 10, 0), 0, 0));
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 10, 0), 0, 0));
contentPanel.add(vSpacer1, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 10, 5), 0, 0));
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 10, 5), 0, 0));
contentPanel.add(vSpacer3, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 10, 5), 0, 0));
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 10, 5), 0, 0));

//---- indexField ----
indexField.setPreferredSize(new Dimension(720, 28));
indexField.setMinimumSize(new Dimension(720, 28));
contentPanel.add(indexField, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 0, 0), 0, 0));

//---- label3 ----
label3.setText("<html><i>Specify url to an index file. <b>Required for BAM and indexed files</b></i>");
contentPanel.add(label3, new GridBagConstraints(0, 4, 2, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 10, 0), 0, 0));
if (!isHtsget) {
label2.setText("Index URL:");
contentPanel.add(label2, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 0, 5), 0, 0));

indexField.setPreferredSize(new Dimension(720, 28));
indexField.setMinimumSize(new Dimension(720, 28));
contentPanel.add(indexField, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 0, 0), 0, 0));


//---- label3 ----
label3.setText("<html><i>Specify url to an index file. <b>Required for BAM and indexed files</b></i>");
contentPanel.add(label3, new GridBagConstraints(0, 4, 2, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 10, 0), 0, 0));
}
}
dialogPane.add(contentPanel, BorderLayout.CENTER);

//======== buttonBar ========
{
buttonBar.setLayout(new GridBagLayout());
((GridBagLayout)buttonBar.getLayout()).columnWidths = new int[] {0, 85, 80};
((GridBagLayout)buttonBar.getLayout()).columnWeights = new double[] {1.0, 0.0, 0.0};
((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[]{0, 85, 80};
((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[]{1.0, 0.0, 0.0};

//---- okButton ----
okButton.setText("OK");
okButton.addActionListener(e -> okButtonActionPerformed(e));
buttonBar.add(okButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 0, 5), 0, 0));
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 0, 5), 0, 0));

//---- cancelButton ----
cancelButton.setText("Cancel");
cancelButton.addActionListener(e -> cancelButtonActionPerformed(e));
buttonBar.add(cancelButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 0, 0), 0, 0));
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 0, 0), 0, 0));
}
dialogPane.add(buttonBar, BorderLayout.SOUTH);
}
Expand Down

0 comments on commit bba1101

Please sign in to comment.