diff --git a/build.gradle b/build.gradle index 7ffee9fb6d..7aa7d191df 100644 --- a/build.gradle +++ b/build.gradle @@ -38,6 +38,7 @@ buildscript { repositories { mavenCentral() + mavenLocal() } java { @@ -112,7 +113,7 @@ dependencies { [group: 'org.apache.commons', name: 'commons-lang3', version: '3.9'], [group: 'com.github.samtools', name: 'htsjdk', version: '4.0.2'], [group: 'org.swinglabs', name: 'swing-layout', version: '1.0.3'], - //[group: 'org.bidib.com.jidesoft', name: 'jide-common', version: '3.7.3'], // no longer in Maven Central + [group: 'com.formdev', name: 'jide-oss', version: '3.7.12'], [group: 'com.google.guava', name: 'guava', version: '27.0.1-jre'], [group: 'org.apache.xmlgraphics', name: 'batik-dom', version: '1.11'], [group: 'org.apache.xmlgraphics', name: 'batik-svggen', version: '1.11'], diff --git a/lib/jide-common-3.7.3.jar b/lib/jide-common-3.7.3.jar deleted file mode 100644 index caca761ba4..0000000000 Binary files a/lib/jide-common-3.7.3.jar and /dev/null differ diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 15bb2a73f2..6754cec47a 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -20,7 +20,6 @@ requires java.xml; requires jdk.xml.dom; requires swing.layout; - requires jide.common; requires org.apache.commons.io; requires org.apache.commons.lang3; requires batik.codec; diff --git a/src/main/java/org/broad/igv/feature/genome/ColorSpaceSequence.java b/src/main/java/org/broad/igv/feature/genome/ColorSpaceSequence.java deleted file mode 100644 index 3e1754ba76..0000000000 --- a/src/main/java/org/broad/igv/feature/genome/ColorSpaceSequence.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2007-2015 Broad Institute - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package org.broad.igv.feature.genome; - -/** - * Created with IntelliJ IDEA. - * User: jrobinso - * Date: 6/25/12 - * Time: 11:00 AM - * To change this template use File | Settings | File Templates. - */ -public class ColorSpaceSequence { - - Sequence sequence; - - public ColorSpaceSequence(Sequence sequence) { - this.sequence = sequence; - } - - /** - * Return the sequence in Color Space (SOLID alignment encoding) - * - * @param chr - * @param start - * @param end - * @return - */ - public byte[] getSequence(String chr, int start, int end) { - // We need to know the base just to the left of the start - int csStart = (start == 0 ? 0 : start - 1); - byte[] baseSequence = sequence.getSequence(chr, csStart, end); - if (baseSequence == null || baseSequence.length == 0) { - return baseSequence; - } - - byte[] csSequence = new byte[end - start]; - int i = 0; - int c1 = start == 0 ? 0 : baseToCS(baseSequence[i++]); - for (; i < baseSequence.length; i++) { - int c2 = baseToCS(baseSequence[i]); - csSequence[i] = (byte) (c1 ^ c2); - } - return csSequence; - - } - - private static int baseToCS(byte base) { - switch (base) { - case 'A': - case 'a': - return 0; - case 'C': - case 'c': - return 1; - case 'T': - case 't': - return 2; - case 'G': - case 'g': - return 3; - } - return -1; - } - - - public byte getBase(String chr, int position) { - return 0; //To change body of implemented methods use File | Settings | File Templates. - } -} diff --git a/src/main/java/org/broad/igv/feature/genome/GenomeBuilderDialog.java b/src/main/java/org/broad/igv/feature/genome/GenomeBuilderDialog.java deleted file mode 100644 index fbc4b4b12e..0000000000 --- a/src/main/java/org/broad/igv/feature/genome/GenomeBuilderDialog.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2007-2015 Broad Institute - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -/* - * Created by JFormDesigner on Wed Apr 11 16:44:25 EDT 2012 - */ - -package org.broad.igv.feature.genome; - -import org.broad.igv.prefs.PreferencesManager; -import org.broad.igv.ui.IGV; -import org.broad.igv.ui.util.FileDialogUtils; -import org.broad.igv.ui.util.MessageUtils; - -import javax.swing.*; -import javax.swing.border.EmptyBorder; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; - -/** - * @author Stan Diamond - */ -public class GenomeBuilderDialog extends org.broad.igv.ui.IGVDialog { - - boolean canceled; - File archiveFile; - - public GenomeBuilderDialog(Frame owner, IGV igv) { - super(owner, "Create .genome file"); - setModal(true); - initComponents(); - this.panel1.setIgv(igv); - } - - public boolean isCanceled() { - return canceled; - } - - public File getArchiveFile() { - return archiveFile; - } - - private void okButtonActionPerformed(ActionEvent e) { - boolean valid = validateFields(); - if (valid) { - archiveFile = chooseArchiveFile(); - canceled = (archiveFile == null); - setVisible(false); - dispose(); - } - } - - private void cancelButtonActionPerformed(ActionEvent e) { - canceled = true; - setVisible(false); - dispose(); - } - - private File chooseArchiveFile() { - File dir = PreferencesManager.getPreferences().getLastGenomeImportDirectory(); - File initFile = new File(getGenomeId() + ".genome"); - return FileDialogUtils.chooseFile("Save .genome file", dir, initFile, FileDialog.SAVE); - } - - private boolean validateFields() { - StringBuffer errors = new StringBuffer(); - String id = getGenomeId(); - String name = getGenomeDisplayName(); - String fastaFile = getFastaFileName(); - if (id == null || id.length() == 0) { - errors.append(errors.length() == 0 ? "" : "
"); - errors.append("Unique ID is required"); - } - if (name == null || name.length() == 0) { - errors.append(errors.length() == 0 ? "" : "
"); - errors.append("Descriptive name is required"); - } - if (fastaFile == null || fastaFile.length() == 0) { - errors.append(errors.length() == 0 ? "" : "
"); - errors.append("FASTA file is required"); - } - if (errors.length() == 0) { - return true; - } else { - MessageUtils.showMessage(errors.toString()); - return false; - } - } - - private void initComponents() { - // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents - // Generated using JFormDesigner non-commercial license - dialogPane = new JPanel(); - contentPanel = new JPanel(); - panel1 = new GenomeBuilderPane(); - buttonBar = new JPanel(); - okButton = new JButton(); - cancelButton = new JButton(); - - //======== this ======== - Container contentPane = getContentPane(); - contentPane.setLayout(new BorderLayout()); - - //======== dialogPane ======== - { - dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12)); - dialogPane.setLayout(new BorderLayout()); - - //======== contentPanel ======== - { - contentPanel.setLayout(new BorderLayout()); - contentPanel.add(panel1, BorderLayout.CENTER); - } - dialogPane.add(contentPanel, BorderLayout.CENTER); - - //======== buttonBar ======== - { - buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0)); - 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}; - - //---- okButton ---- - okButton.setText("OK"); - okButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent 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)); - - //---- cancelButton ---- - cancelButton.setText("Cancel"); - cancelButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent 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)); - } - dialogPane.add(buttonBar, BorderLayout.SOUTH); - } - contentPane.add(dialogPane, BorderLayout.CENTER); - setSize(870, 430); - setLocationRelativeTo(getOwner()); - // JFormDesigner - End of component initialization //GEN-END:initComponents - } - - // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables - // Generated using JFormDesigner non-commercial license - private JPanel dialogPane; - private JPanel contentPanel; - private GenomeBuilderPane panel1; - private JPanel buttonBar; - private JButton okButton; - private JButton cancelButton; - // JFormDesigner - End of variables declaration //GEN-END:variables - - public String getCytobandFileName() { - return panel1.getCytobandFileName(); - } - - public String getGeneAnnotFileName() { - return panel1.getGeneAnnotFileName(); - } - - public String getFastaFileName() { - return panel1.getFastaFileName(); - } - - public String getChrAliasFileName() { - return panel1.getChrAliasFileName(); - } - - - public String getGenomeDisplayName() { - return panel1.getGenomeDisplayName(); - } - - public String getGenomeId() { - return panel1.getGenomeId(); - } - - public String getArchiveFileName() { - return panel1.getArchiveFileName(); - } -} diff --git a/src/main/java/org/broad/igv/feature/genome/GenomeBuilderPane.java b/src/main/java/org/broad/igv/feature/genome/GenomeBuilderPane.java deleted file mode 100644 index 6ef33da281..0000000000 --- a/src/main/java/org/broad/igv/feature/genome/GenomeBuilderPane.java +++ /dev/null @@ -1,475 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2007-2015 Broad Institute - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package org.broad.igv.feature.genome; - -import org.broad.igv.logging.*; -import org.broad.igv.Globals; -import org.broad.igv.prefs.PreferencesManager; -import org.broad.igv.ui.IGV; -import org.broad.igv.ui.commandbar.GenomeListManager; -import org.broad.igv.ui.util.FileDialogUtils; - -import javax.swing.*; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; -import java.io.Serializable; -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; - -/** - * @author eflakes - */ -public class GenomeBuilderPane extends javax.swing.JPanel implements Serializable { - - private static Logger logger = LogManager.getLogger(GenomeBuilderPane.class); - private String genomeArchiveLocation; - private String genomeFilename; - GenomeImporter importer; - IGV igv; - - - public GenomeBuilderPane() { - initComponents(); - importer = new GenomeImporter(); - } - - public void setIgv(IGV igv) { - this.igv = igv; - } - - public String getCytobandFileName() { - String cytobandFile = cytobandFileTextField.getText(); - if (cytobandFile != null && cytobandFile.trim().equals("")) { - cytobandFile = null; - } - return cytobandFile; - } - - public String getGeneAnnotFileName() { - String refFlatFile = geneAnnotFileTextField.getText(); - if (refFlatFile != null && refFlatFile.trim().equals("")) { - refFlatFile = null; - } - return refFlatFile; - } - - public String getFastaFileName() { - String fastaFile = fastaFileTextField.getText(); - if (fastaFile != null && fastaFile.trim().equals("")) { - fastaFile = null; - } - return fastaFile; - } - - public String getChrAliasFileName() { - String chrAliasFile = chrAliasField.getText(); - if (chrAliasFile != null && chrAliasFile.trim().equals("")) { - chrAliasFile = null; - } - return chrAliasFile; - } - - - public String getGenomeId() { - return idField.getText(); - } - -// public String getSequenceURL() { -// return sequenceURLField.getText(); -// } - - - public String getGenomeDisplayName() { - String name = genomeDisplayNameTextField.getText(); - if (name != null && name.trim().equals("")) { - name = null; - } else { - name = name.trim(); - } - return name; - } - - public String getGenomeArchiveLocation() { - if (genomeArchiveLocation != null && genomeArchiveLocation.trim().equals("")) { - genomeArchiveLocation = null; - } - return genomeArchiveLocation; - } - - public String getArchiveFileName() { - - if (genomeFilename == null) { - genomeFilename = getGenomeId() + Globals.GENOME_FILE_EXTENSION; - } - return genomeFilename; - } - - - protected File showGenomeArchiveDirectoryChooser() { - - File directory = PreferencesManager.getPreferences().getLastGenomeImportDirectory(); - File archiveName = new File(getGenomeId() + Globals.GENOME_FILE_EXTENSION); - File file = FileDialogUtils.chooseFile("Save Genome File", directory, archiveName, FileDialogUtils.SAVE); - - if (file != null) { - - genomeFilename = file.getName(); - if (genomeFilename != null) { - if (!genomeFilename.endsWith(Globals.GENOME_FILE_EXTENSION)) { - genomeFilename += Globals.GENOME_FILE_EXTENSION; - file = new File(file.getParentFile(), genomeFilename); - } - genomeArchiveLocation = file.getParentFile().getAbsolutePath(); - } - } - return file; - } - - public boolean validateSelection() { - - try { - - if (!isIdValid()) { - return false; - } - - if (!isGenomeDisplayNameValid()) { - genomeDisplayNameTextField.setText(null); - return false; - } - - if (!isFASTAFileValid()) { - JOptionPane.showMessageDialog(this, "A fasta file is required!"); - return false; - } - - } catch (Exception e) { - logger.error("Error during Genome Builder validation!", e); - return false; - } - return true; - } - - private boolean isFASTAFileValid() { - - String file = fastaFileTextField.getText(); - return file != null && file.trim().length() > 0; - } - - private Boolean isIdValid() { - - String id = getGenomeId(); - if (id == null || id.trim().length() == 0) { - JOptionPane.showMessageDialog(this, "Genome ID is required"); - return false; - } - - Collection inUseIds = GenomeListManager.getInstance().getSelectableGenomeIDs(); - if (inUseIds.contains(id)) { - JOptionPane.showMessageDialog(this, - "The genome ID '" + id + "' is already in use - please select another!"); - return false; - } - return true; - } - - private boolean isGenomeDisplayNameValid() { - - String displayName = getGenomeDisplayName(); - if (displayName == null || displayName.trim().length() == 0) { - JOptionPane.showMessageDialog(this, "Genome name is required"); - return false; - } - - Collection inUseDisplayNames = getGenomeDisplayNames(); - - if (inUseDisplayNames.contains(displayName)) { - JOptionPane.showMessageDialog(this, - "The genome name '" + displayName + "' is already in use - please enter another!"); - return false; - } - return true; - } - - - public Collection getGenomeDisplayNames() { - - Set displayNames = new HashSet(); - Collection listItems = GenomeListManager.getInstance().getGenomeListItems(); - for (GenomeListItem genomeListItem : listItems) { - displayNames.add(genomeListItem.getDisplayableName()); - } - return displayNames; - } - - - /** - * This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents - // Generated using JFormDesigner non-commercial license - private void initComponents() { - panel3 = new JPanel(); - panel2 = new JPanel(); - genomeDisplayNameLabel2 = new JLabel(); - idField = new JTextField(); - genomeDisplayNameLabel = new JLabel(); - genomeDisplayNameTextField = new JTextField(); - fastaFileLabel = new JLabel(); - fastaFileTextField = new JTextField(); - fastaFileButton = new JButton(); - panel1 = new JPanel(); - cytobandFileLabel = new JLabel(); - cytobandFileTextField = new JTextField(); - cytobandFileButton = new JButton(); - geneAnnotFileLabel = new JLabel(); - geneAnnotFileTextField = new JTextField(); - geneAnnotFileButton = new JButton(); - aliasFileLabel = new JLabel(); - chrAliasField = new JTextField(); - chrAliasButton = new JButton(); - vSpacer2 = new JPanel(null); - - //======== this ======== - setFont(new Font("Tahoma", Font.ITALIC, 12)); - setMaximumSize(new Dimension(900, 500)); - setMinimumSize(new Dimension(400, 200)); - setPreferredSize(new Dimension(700, 200)); - setLayout(new BorderLayout()); - - //======== panel3 ======== - { - panel3.setBorder(new EmptyBorder(20, 20, 20, 20)); - panel3.setLayout(new BoxLayout(panel3, BoxLayout.Y_AXIS)); - - //======== panel2 ======== - { - panel2.setBorder(new EmptyBorder(0, 0, 30, 0)); - panel2.setLayout(null); - - //---- genomeDisplayNameLabel2 ---- - genomeDisplayNameLabel2.setText("Unique identifier"); - genomeDisplayNameLabel2.setToolTipText("Unique identifier (e.g. hg18)"); - genomeDisplayNameLabel2.setMaximumSize(new Dimension(84, 16)); - genomeDisplayNameLabel2.setMinimumSize(new Dimension(84, 16)); - genomeDisplayNameLabel2.setPreferredSize(new Dimension(14, 16)); - panel2.add(genomeDisplayNameLabel2); - genomeDisplayNameLabel2.setBounds(15, 22, 125, 28); - - //---- idField ---- - idField.setToolTipText("A uniqe identifier for the genome"); - panel2.add(idField); - idField.setBounds(145, 22, 548, 29); - - //---- genomeDisplayNameLabel ---- - genomeDisplayNameLabel.setText("Descriptive name"); - panel2.add(genomeDisplayNameLabel); - genomeDisplayNameLabel.setBounds(15, 56, 175, 28); - - //---- genomeDisplayNameTextField ---- - genomeDisplayNameTextField.setToolTipText("The user-readable name of the genome"); - genomeDisplayNameTextField.setPreferredSize(new Dimension(400, 28)); - genomeDisplayNameTextField.setMinimumSize(new Dimension(25, 28)); - panel2.add(genomeDisplayNameTextField); - genomeDisplayNameTextField.setBounds(145, 56, 548, 29); - - //---- fastaFileLabel ---- - fastaFileLabel.setText("FASTA file"); - panel2.add(fastaFileLabel); - fastaFileLabel.setBounds(15, 88, 175, 29); - - //---- fastaFileTextField ---- - fastaFileTextField.setToolTipText("A FASTA data file"); - fastaFileTextField.setPreferredSize(new Dimension(400, 28)); - fastaFileTextField.setMinimumSize(new Dimension(25, 28)); - panel2.add(fastaFileTextField); - fastaFileTextField.setBounds(145, 88, 548, 29); - - //---- fastaFileButton ---- - fastaFileButton.setText("Browse"); - fastaFileButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - fastaFileButtonActionPerformed(e); - } - }); - panel2.add(fastaFileButton); - fastaFileButton.setBounds(698, 88, 83, fastaFileButton.getPreferredSize().height); - } - panel3.add(panel2); - - //======== panel1 ======== - { - panel1.setBorder(new TitledBorder(null, "Optional", TitledBorder.LEADING, TitledBorder.DEFAULT_POSITION, - new Font("Lucida Grande", Font.BOLD, 13))); - panel1.setLayout(null); - - //---- cytobandFileLabel ---- - cytobandFileLabel.setText("Cytoband file"); - panel1.add(cytobandFileLabel); - cytobandFileLabel.setBounds(15, 25, 105, 29); - - //---- cytobandFileTextField ---- - cytobandFileTextField.setToolTipText("A cytoband data file"); - cytobandFileTextField.setPreferredSize(new Dimension(400, 28)); - cytobandFileTextField.setMinimumSize(new Dimension(25, 28)); - panel1.add(cytobandFileTextField); - cytobandFileTextField.setBounds(145, 22, 548, 29); - - //---- cytobandFileButton ---- - cytobandFileButton.setText("Browse"); - cytobandFileButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - cytobandFileButtonActionPerformed(e); - } - }); - panel1.add(cytobandFileButton); - cytobandFileButton.setBounds(698, 22, 83, cytobandFileButton.getPreferredSize().height); - - //---- geneAnnotFileLabel ---- - geneAnnotFileLabel.setText("Gene file"); - panel1.add(geneAnnotFileLabel); - geneAnnotFileLabel.setBounds(15, 56, 84, 29); - - //---- geneAnnotFileTextField ---- - geneAnnotFileTextField.setToolTipText("An annotation file"); - geneAnnotFileTextField.setPreferredSize(new Dimension(400, 28)); - geneAnnotFileTextField.setMinimumSize(new Dimension(25, 28)); - panel1.add(geneAnnotFileTextField); - geneAnnotFileTextField.setBounds(145, 56, 548, 29); - - //---- geneAnnotFileButton ---- - geneAnnotFileButton.setText("Browse"); - geneAnnotFileButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - refFlatFileButtonActionPerformed(e); - } - }); - panel1.add(geneAnnotFileButton); - geneAnnotFileButton.setBounds(698, 56, 83, geneAnnotFileButton.getPreferredSize().height); - - //---- aliasFileLabel ---- - aliasFileLabel.setText("Alias file"); - panel1.add(aliasFileLabel); - aliasFileLabel.setBounds(15, 90, 84, 29); - - //---- chrAliasField ---- - chrAliasField.setPreferredSize(new Dimension(400, 28)); - chrAliasField.setMinimumSize(new Dimension(25, 28)); - panel1.add(chrAliasField); - chrAliasField.setBounds(145, 90, 548, 29); - - //---- chrAliasButton ---- - chrAliasButton.setText("Browse"); - chrAliasButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - chrAliasButtonActionPerformed(e); - } - }); - panel1.add(chrAliasButton); - chrAliasButton.setBounds(698, 90, 83, chrAliasButton.getPreferredSize().height); - panel1.add(vSpacer2); - vSpacer2.setBounds(6, 124, 84, 20); - } - panel3.add(panel1); - } - add(panel3, BorderLayout.CENTER); - }// //GEN-END:initComponents - - private void chrAliasButtonActionPerformed(ActionEvent e) { - File directory = PreferencesManager.getPreferences().getDefineGenomeInputDirectory(); - File file = FileDialogUtils.chooseFile("Select Chromosome Alias File", directory, FileDialogUtils.LOAD); - if (file != null) { - chrAliasField.setText(file.getAbsolutePath()); - PreferencesManager.getPreferences().setDefineGenomeInputDirectory(file.getParentFile()); - } - } - - - private void cytobandFileButtonActionPerformed(java.awt.event.ActionEvent evt) { - File directory = PreferencesManager.getPreferences().getDefineGenomeInputDirectory(); - File file = FileDialogUtils.chooseFile("Select Cytoband File", directory, FileDialogUtils.LOAD); - if (file != null) { - cytobandFileTextField.setText(file.getAbsolutePath()); - PreferencesManager.getPreferences().setDefineGenomeInputDirectory(file.getParentFile()); - } - } - - private void refFlatFileButtonActionPerformed(java.awt.event.ActionEvent evt) { - File directory = PreferencesManager.getPreferences().getDefineGenomeInputDirectory(); - File file = FileDialogUtils.chooseFile("Select Annotation File", directory, FileDialogUtils.LOAD); - if (file != null) { - geneAnnotFileTextField.setText(file.getAbsolutePath()); - PreferencesManager.getPreferences().setDefineGenomeInputDirectory(file.getParentFile()); - } - } - - private void fastaFileButtonActionPerformed(java.awt.event.ActionEvent evt) { - File directory = PreferencesManager.getPreferences().getDefineGenomeInputDirectory(); - File file = FileDialogUtils.chooseFile("Select Fasta File", directory, null, FileDialogUtils.LOAD); - if (file != null) { - fastaFileTextField.setText(file.getAbsolutePath()); - PreferencesManager.getPreferences().setDefineGenomeInputDirectory(file.getParentFile()); - } - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - // Generated using JFormDesigner non-commercial license - private JPanel panel3; - private JPanel panel2; - private JLabel genomeDisplayNameLabel2; - private JTextField idField; - private JLabel genomeDisplayNameLabel; - private JTextField genomeDisplayNameTextField; - private JLabel fastaFileLabel; - private JTextField fastaFileTextField; - private JButton fastaFileButton; - private JPanel panel1; - private JLabel cytobandFileLabel; - private JTextField cytobandFileTextField; - private JButton cytobandFileButton; - private JLabel geneAnnotFileLabel; - private JTextField geneAnnotFileTextField; - private JButton geneAnnotFileButton; - private JLabel aliasFileLabel; - private JTextField chrAliasField; - private JButton chrAliasButton; - private JPanel vSpacer2; - // End of variables declaration//GEN-END:variables - -} diff --git a/src/main/java/org/broad/igv/track/TribbleFeatureSource.java b/src/main/java/org/broad/igv/track/TribbleFeatureSource.java index 904aaff93e..50639e32d1 100644 --- a/src/main/java/org/broad/igv/track/TribbleFeatureSource.java +++ b/src/main/java/org/broad/igv/track/TribbleFeatureSource.java @@ -344,6 +344,7 @@ private NonIndexedFeatureSource(AbstractFeatureReader basicReader, FeatureCodec List featureList = featureMap.computeIfAbsent(igvChr, k -> new ArrayList<>()); featureList.add(f); + if (f instanceof IGVNamedFeature named) FeatureDB.addFeature(named, genome); if (this.isVCF && f instanceof Variant v) { diff --git a/src/main/java/org/broad/igv/ui/IGV.java b/src/main/java/org/broad/igv/ui/IGV.java index f9a9ac31f6..193bdcfe52 100644 --- a/src/main/java/org/broad/igv/ui/IGV.java +++ b/src/main/java/org/broad/igv/ui/IGV.java @@ -333,71 +333,6 @@ public void selectGenomeFromList(String genomeId) { contentPane.getCommandBar().selectGenome(genomeId); } - - public void defineGenome(javax.swing.ProgressMonitor monitor) { - - ProgressBar.ProgressDialog progressDialog = null; - File archiveFile = null; - - try { - GenomeBuilderDialog genomeBuilderDialog = new GenomeBuilderDialog(mainFrame, this); - genomeBuilderDialog.setVisible(true); - - File genomeZipFile = genomeBuilderDialog.getArchiveFile(); - if (genomeBuilderDialog.isCanceled() || genomeZipFile == null) { - return; - } - - - String cytobandFileName = genomeBuilderDialog.getCytobandFileName(); - String geneAnnotFileName = genomeBuilderDialog.getGeneAnnotFileName(); - String fastaFileName = genomeBuilderDialog.getFastaFileName(); - String chrAliasFile = genomeBuilderDialog.getChrAliasFileName(); - String genomeDisplayName = genomeBuilderDialog.getGenomeDisplayName(); - String genomeId = genomeBuilderDialog.getGenomeId(); - - GenomeListItem genomeListItem = GenomeManager.getInstance().defineGenome( - genomeZipFile, cytobandFileName, geneAnnotFileName, - fastaFileName, chrAliasFile, genomeDisplayName, - genomeId, monitor); - - if (genomeListItem != null) { - contentPane.getCommandBar().refreshGenomeListComboBox(); - contentPane.getCommandBar().selectGenome(genomeListItem.getId()); - } - if (monitor != null) { - monitor.setProgress(100); - } - - } catch (MaximumContigGenomeException e) { - - String genomePath = ""; - if (archiveFile != null) { - genomePath = archiveFile.getAbsolutePath(); - } - - log.error("Failed to define genome: " + genomePath, e); - - JOptionPane.showMessageDialog(mainFrame, "Failed to define genome " + - genomePath + "\n" + e.getMessage()); - } catch (GenomeException e) { - log.error("Failed to define genome.", e); - MessageUtils.showMessage(e.getMessage()); - } catch (Exception e) { - String genomePath = ""; - if (archiveFile != null) { - genomePath = archiveFile.getAbsolutePath(); - } - - log.error("Failed to define genome: " + genomePath, e); - MessageUtils.showMessage("Unexpected error while importing a genome: " + e.getMessage()); - } finally { - if (progressDialog != null) { - progressDialog.setVisible(false); - } - } - } - public void enableExtrasMenu() { menuBar.enableExtrasMenu(); diff --git a/src/main/java/org/broad/igv/ui/Main.java b/src/main/java/org/broad/igv/ui/Main.java index 6343275589..0f5db3c7d9 100644 --- a/src/main/java/org/broad/igv/ui/Main.java +++ b/src/main/java/org/broad/igv/ui/Main.java @@ -210,6 +210,7 @@ private static void initApplication(Main.IGVArgs igvArgs) { log.info("IGV Directory: " + DirectoryManager.getIgvDirectory().getAbsolutePath()); System.setProperty("http.agent", Globals.applicationString()); + System.setProperty("samjdk.optimistic_vcf_4_4", "true"); Runtime.getRuntime().addShutdownHook(new ShutdownThread()); diff --git a/src/main/resources/org/broad/igv/feature/genome/GenomeBuilderDialog.jfd b/src/main/resources/org/broad/igv/feature/genome/GenomeBuilderDialog.jfd deleted file mode 100644 index 88f08b9be3..0000000000 --- a/src/main/resources/org/broad/igv/feature/genome/GenomeBuilderDialog.jfd +++ /dev/null @@ -1,209 +0,0 @@ - - - - - form/swing - - - - - - javax.swing.JDialog - - java.awt.BorderLayout - - - $sizePolicy - 1 - - - - javax.swing.JPanel - - java.awt.BorderLayout - - - border - - 12 - 12 - 12 - 12 - - - - dialogPane - - - - javax.swing.JPanel - - java.awt.BorderLayout - - - contentPanel - - - - org.broad.igv.feature.genome.GenomeBuilderPane - - panel1 - - - - java.lang.String - - value - Center - - - - - - java.lang.String - - value - Center - - - - - - javax.swing.JPanel - - java.awt.GridBagLayout - - $columnSpecs - 0:1.0, 80, 80 - - - $rowSpecs - 0 - - - $hGap - 5 - - - $vGap - 5 - - - - border - - 12 - 0 - 0 - 0 - - - - buttonBar - - - - javax.swing.JButton - - text - OK - - - okButton - - - - java.awt.event.ActionListener - actionPerformed - okButtonActionPerformed - true - - - - - com.jformdesigner.runtime.GridBagConstraintsEx - - gridx - 1 - - - gridy - 0 - - - - - - javax.swing.JButton - - text - Cancel - - - cancelButton - - - - java.awt.event.ActionListener - actionPerformed - cancelButtonActionPerformed - true - - - - - com.jformdesigner.runtime.GridBagConstraintsEx - - gridx - 2 - - - gridy - 0 - - - - - - java.lang.String - - value - South - - - - - - java.lang.String - - value - Center - - - - - this - - - - - - location - - 0 - 0 - - - - size - - 870 - 430 - - - - - - - - diff --git a/src/main/resources/org/broad/igv/feature/genome/GenomeBuilderPane.jfd b/src/main/resources/org/broad/igv/feature/genome/GenomeBuilderPane.jfd deleted file mode 100644 index c16b0c7eef..0000000000 --- a/src/main/resources/org/broad/igv/feature/genome/GenomeBuilderPane.jfd +++ /dev/null @@ -1,784 +0,0 @@ - - - - - form/swing - - - - - - javax.swing.JPanel - - java.awt.BorderLayout - - - font - - Tahoma - 2 - 12 - - - - maximumSize - - 900 - 500 - - - - minimumSize - - 400 - 200 - - - - preferredSize - - 700 - 200 - - - - this - - - - javax.swing.JPanel - - javax.swing.BoxLayout - - axis - 1 - - - - border - - 20 - 20 - 20 - 20 - - - - panel3 - - - - javax.swing.JPanel - - com.jformdesigner.runtime.NullLayout - - autoSize - false - - - - border - - 0 - 0 - 30 - 0 - - - - panel2 - - - - javax.swing.JLabel - - text - Unique identifier - - - toolTipText - Unique identifier (e.g. hg18) - - - maximumSize - - 84 - 16 - - - - minimumSize - - 84 - 16 - - - - preferredSize - - 14 - 16 - - - - genomeDisplayNameLabel2 - - - - com.jformdesigner.runtime.NullConstraints - - x - 15 - - - y - 22 - - - width - 125 - - - height - 28 - - - - - - javax.swing.JTextField - - toolTipText - A uniqe identifier for the genome - - - idField - - - - com.jformdesigner.runtime.NullConstraints - - x - 145 - - - y - 22 - - - width - 548 - - - height - 29 - - - - - - javax.swing.JLabel - - text - Descriptive name - - - genomeDisplayNameLabel - - - - com.jformdesigner.runtime.NullConstraints - - x - 15 - - - y - 56 - - - width - 175 - - - height - 28 - - - - - - javax.swing.JTextField - - toolTipText - The user-readable name of the genome - - - preferredSize - - 400 - 28 - - - - minimumSize - - 25 - 28 - - - - genomeDisplayNameTextField - - - - com.jformdesigner.runtime.NullConstraints - - x - 145 - - - y - 56 - - - width - 548 - - - height - 29 - - - - - - javax.swing.JLabel - - text - FASTA file - - - fastaFileLabel - - - - com.jformdesigner.runtime.NullConstraints - - x - 15 - - - y - 88 - - - width - 175 - - - height - 29 - - - - - - javax.swing.JTextField - - toolTipText - A FASTA data file - - - preferredSize - - 400 - 28 - - - - minimumSize - - 25 - 28 - - - - fastaFileTextField - - - - com.jformdesigner.runtime.NullConstraints - - x - 145 - - - y - 88 - - - width - 548 - - - height - 29 - - - - - - javax.swing.JButton - - text - Browse - - - fastaFileButton - - - - java.awt.event.ActionListener - actionPerformed - fastaFileButtonActionPerformed - true - - - - - com.jformdesigner.runtime.NullConstraints - - x - 698 - - - y - 88 - - - width - 83 - - - - - - - - javax.swing.JPanel - - com.jformdesigner.runtime.NullLayout - - autoSize - false - - - - border - - - Optional - 4 - 0 - - Lucida Grande - 1 - 13 - - - - - - panel1 - - - - javax.swing.JLabel - - text - Cytoband file - - - cytobandFileLabel - - - - com.jformdesigner.runtime.NullConstraints - - x - 15 - - - y - 25 - - - height - 29 - - - width - 105 - - - - - - javax.swing.JTextField - - toolTipText - A cytoband data file - - - preferredSize - - 400 - 28 - - - - minimumSize - - 25 - 28 - - - - cytobandFileTextField - - - - com.jformdesigner.runtime.NullConstraints - - x - 145 - - - y - 22 - - - width - 548 - - - height - 29 - - - - - - javax.swing.JButton - - text - Browse - - - cytobandFileButton - - - - java.awt.event.ActionListener - actionPerformed - cytobandFileButtonActionPerformed - true - - - - - com.jformdesigner.runtime.NullConstraints - - x - 698 - - - y - 22 - - - width - 83 - - - - - - javax.swing.JLabel - - text - Gene file - - - geneAnnotFileLabel - - - - com.jformdesigner.runtime.NullConstraints - - x - 15 - - - y - 56 - - - width - 84 - - - height - 29 - - - - - - javax.swing.JTextField - - toolTipText - An annotation file - - - preferredSize - - 400 - 28 - - - - minimumSize - - 25 - 28 - - - - geneAnnotFileTextField - - - - com.jformdesigner.runtime.NullConstraints - - x - 145 - - - y - 56 - - - width - 548 - - - height - 29 - - - - - - javax.swing.JButton - - text - Browse - - - geneAnnotFileButton - - - - java.awt.event.ActionListener - actionPerformed - refFlatFileButtonActionPerformed - true - - - - - com.jformdesigner.runtime.NullConstraints - - x - 698 - - - y - 56 - - - width - 83 - - - - - - javax.swing.JLabel - - text - Alias file - - - aliasFileLabel - - - - com.jformdesigner.runtime.NullConstraints - - x - 15 - - - y - 90 - - - width - 84 - - - height - 29 - - - - - - javax.swing.JTextField - - preferredSize - - 400 - 28 - - - - minimumSize - - 25 - 28 - - - - chrAliasField - - - - com.jformdesigner.runtime.NullConstraints - - x - 145 - - - y - 90 - - - width - 548 - - - height - 29 - - - - - - javax.swing.JButton - - text - Browse - - - chrAliasButton - - - - java.awt.event.ActionListener - actionPerformed - chrAliasButtonActionPerformed - true - - - - - com.jformdesigner.runtime.NullConstraints - - x - 698 - - - y - 90 - - - width - 83 - - - - - - com.jformdesigner.designer.wrapper.VSpacer - - vSpacer2 - - - - com.jformdesigner.runtime.NullConstraints - - x - 6 - - - y - 124 - - - width - 84 - - - height - 20 - - - - - - - - java.lang.String - - value - Center - - - - - - - - size - - 845 - 425 - - - - location - - 25 - 5 - - - - - - - - diff --git a/src/main/resources/org/broad/igv/feature/genome/RemoveGenomesDialog.jfd b/src/main/resources/org/broad/igv/feature/genome/RemoveGenomesDialog.jfd deleted file mode 100644 index 92cdfa27fa..0000000000 --- a/src/main/resources/org/broad/igv/feature/genome/RemoveGenomesDialog.jfd +++ /dev/null @@ -1,115 +0,0 @@ -JFDML JFormDesigner: "5.2.4.0.321" Java: "1.8.0_76-release" encoding: "UTF-8" - -new FormModel { - contentType: "form/swing" - root: new FormRoot { - add( new FormWindow( "javax.swing.JDialog", new FormLayoutManager( class java.awt.BorderLayout ) ) { - name: "this" - "$sizePolicy": 0 - "defaultCloseOperation": 2 - "modalityType": enum java.awt.Dialog$ModalityType DOCUMENT_MODAL - "title": "Remove Genomes" - add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) { - name: "dialogPane" - "border": new javax.swing.border.EmptyBorder( 12, 12, 12, 12 ) - "preferredSize": new java.awt.Dimension( 270, 400 ) - add( new FormComponent( "javax.swing.JTextArea" ) { - name: "label1" - "rows": 2 - "editable": false - "background": new com.jformdesigner.model.SwingColor( "Button.background" ) - "wrapStyleWord": true - "lineWrap": true - }, new FormLayoutConstraints( class java.lang.String ) { - "value": "North" - } ) - add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class javax.swing.BoxLayout ) { - "axis": 1 - } ) { - name: "contentPanel" - add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { - name: "scrollPane1" - add( new FormComponent( "javax.swing.JList" ) { - name: "genomeList" - "maximumSize": new java.awt.Dimension( 39, 5000 ) - "dropMode": enum javax.swing.DropMode INSERT - "dragEnabled": true - auxiliary() { - "JavaCodeGenerator.typeParameters": "GenomeListItem" - } - addEvent( new FormEvent( "java.awt.event.KeyListener", "keyReleased", "genomeListKeyReleased", true ) ) - } ) - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "label2" - "text": "Sequence on local machine" - "labelFor": new FormReference( "genomeList" ) - "alignmentX": 1.0f - "componentOrientation": sfield java.awt.ComponentOrientation LEFT_TO_RIGHT - "preferredSize": new java.awt.Dimension( 400, 16 ) - "maximumSize": new java.awt.Dimension( 400, 16 ) - "minimumSize": new java.awt.Dimension( 100, 16 ) - auxiliary() { - "JavaCodeGenerator.postInitCode": "${field}.setText(LOCAL_SEQUENCE_CHAR + ${field}.getText());" - } - } ) - }, new FormLayoutConstraints( class java.lang.String ) { - "value": "Center" - } ) - add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class javax.swing.BoxLayout ) { - "axis": 1 - } ) { - name: "panel1" - add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.FlowLayout ) { - "alignment": 4 - "hgap": 1 - } ) { - name: "addRemBar" - "border": &EmptyBorder0 new javax.swing.border.EmptyBorder( 12, 0, 0, 0 ) - "preferredSize": new java.awt.Dimension( 196, 51 ) - "minimumSize": new java.awt.Dimension( 201, 51 ) - add( new FormComponent( "javax.swing.JButton" ) { - name: "removeButton" - "text": "Remove" - "toolTipText": "Remove selected genomes from list" - addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "removeButtonActionPerformed", true ) ) - } ) - } ) - add( new FormComponent( "javax.swing.JSeparator" ) { - name: "separator1" - } ) - add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.FlowLayout ) { - "alignment": 4 - } ) { - name: "buttonBar" - "border": #EmptyBorder0 - "preferredSize": new java.awt.Dimension( 196, 51 ) - add( new FormComponent( "javax.swing.JButton" ) { - name: "okButton" - "text": "Save" - "maximumSize": new java.awt.Dimension( 93, 29 ) - "minimumSize": new java.awt.Dimension( 93, 29 ) - "preferredSize": new java.awt.Dimension( 93, 29 ) - addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "saveButtonActionPerformed", true ) ) - } ) - add( new FormComponent( "javax.swing.JButton" ) { - name: "cancelButton" - "text": "Cancel" - "minimumSize": new java.awt.Dimension( 93, 29 ) - "preferredSize": new java.awt.Dimension( 93, 29 ) - "maximumSize": new java.awt.Dimension( 93, 29 ) - addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "cancelButtonActionPerformed", true ) ) - } ) - } ) - }, new FormLayoutConstraints( class java.lang.String ) { - "value": "South" - } ) - }, new FormLayoutConstraints( class java.lang.String ) { - "value": "Center" - } ) - }, new FormLayoutConstraints( null ) { - "location": new java.awt.Point( 0, 0 ) - "size": new java.awt.Dimension( 400, 300 ) - } ) - } -}