Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package crygetter.gui; import crygetter.model.AminoAcid; import crygetter.model.CryToxin; import crygetter.model.CryToxinDomain; import crygetter.model.CryToxinSet; import crygetter.model.SequenceInterval; import crygetter.ncbi.prot.GBAuthor; import crygetter.ncbi.prot.GBFeature; import crygetter.ncbi.prot.GBKeyword; import crygetter.ncbi.prot.GBQualifier; import crygetter.ncbi.prot.GBReference; import crygetter.ncbi.prot.GBSeq; import crygetter.ncbi.prot.GBSet; import crygetter.utils.Utils; import java.awt.Color; import java.awt.Cursor; import java.awt.Desktop; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Properties; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.swing.DefaultListModel; import javax.swing.ImageIcon; import javax.swing.JColorChooser; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.filechooser.FileFilter; import javax.swing.filechooser.FileNameExtensionFilter; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.WorkbookFactory; import org.simpleframework.xml.Serializer; import org.simpleframework.xml.core.Persister; /** * Main window. * * @author David Buzatto */ public class MainWindow extends javax.swing.JFrame { private List<CryToxin> ctList; private List<GBSeq> gbSeqList; private Map<CryToxin, GBSeq> correspondenceTable; private String day = ""; private String month = ""; private String year = ""; private String hour = ""; private String minute = ""; private String second = ""; private String size = ""; private DefaultListModel<CryToxin> proteinListModel; private DefaultListModel<GBReference> referencesListModel; private CryToxin selectedCt; private GBSeq selectedSeq; // n-terminus -> blue private Color cD1 = new Color(172, 204, 234); private Color cD2 = new Color(175, 234, 170); private Color cD3 = new Color(247, 195, 159); // protein list private Color baseProteinColor = new Color(172, 187, 234); // Cry order data private Map<String, List<String>> cryOrderData; // AA data private Map<String, AminoAcid> aaData; // application configurations private Properties configs; private Properties defaultConfigs; // flag to define 3 domain constraint private boolean loadNon3Domain; // models private DefaultListModel<String> model3dListModel; private String selectedPDBModel; /** * Creates new form JanelaPrincipal */ public MainWindow() { initComponents(); proteinListModel = new DefaultListModel<>(); referencesListModel = new DefaultListModel<>(); model3dListModel = new DefaultListModel<>(); listProteins.setModel(proteinListModel); listProteins.setCellRenderer(new CryToxinListCellRenderer()); listRef.setModel(referencesListModel); list3DModels.setModel(model3dListModel); checkD1.setBackground(cD1); checkD1.setOpaque(true); checkD2.setBackground(cD2); checkD2.setOpaque(true); checkD3.setBackground(cD3); checkD3.setOpaque(true); prepareConfiguration(); loadCryData(); loadAAData(); } /** * 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") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { btnExtract = new javax.swing.JButton(); btnLoad = new javax.swing.JButton(); btnAligment = new javax.swing.JButton(); panelProteins = new javax.swing.JPanel(); scrollProteins = new javax.swing.JScrollPane(); listProteins = new javax.swing.JList<>(); check3Domains = new javax.swing.JCheckBox(); check3DModels = new javax.swing.JCheckBox(); lblProteinsFiltered = new javax.swing.JLabel(); panelDetails = new javax.swing.JPanel(); tabsDetails = new javax.swing.JTabbedPane(); panelBtData = new javax.swing.JPanel(); lblName = new javax.swing.JLabel(); lblAccNo = new javax.swing.JLabel(); lblIdProt = new javax.swing.JLabel(); lblIdNuc = new javax.swing.JLabel(); lblAut = new javax.swing.JLabel(); lblYear = new javax.swing.JLabel(); lblStrain = new javax.swing.JLabel(); lblMainURL = new javax.swing.JLabel(); lblCom = new javax.swing.JLabel(); fieldName = new javax.swing.JTextField(); fieldAccNo = new javax.swing.JTextField(); fieldIdProt = new javax.swing.JTextField(); fieldIdNuc = new javax.swing.JTextField(); fieldAut = new javax.swing.JTextField(); fieldYear = new javax.swing.JTextField(); fieldStrain = new javax.swing.JTextField(); linkMainURL = new javax.swing.JLabel(); spCom = new javax.swing.JScrollPane(); areaCom = new javax.swing.JTextArea(); painelNCBI = new javax.swing.JPanel(); tabsNCBIDetails = new javax.swing.JTabbedPane(); panelMainNCBI = new javax.swing.JPanel(); panelMain01 = new javax.swing.JPanel(); lblLocus = new javax.swing.JLabel(); lblLength = new javax.swing.JLabel(); lblType = new javax.swing.JLabel(); lblTopo = new javax.swing.JLabel(); lblDivi = new javax.swing.JLabel(); lblCre = new javax.swing.JLabel(); lblDef = new javax.swing.JLabel(); lblPriAccess = new javax.swing.JLabel(); lblAccessVersion = new javax.swing.JLabel(); fieldLocus = new javax.swing.JTextField(); fieldLength = new javax.swing.JTextField(); fieldType = new javax.swing.JTextField(); fieldTopo = new javax.swing.JTextField(); fieldDivi = new javax.swing.JTextField(); fieldCre = new javax.swing.JTextField(); fieldDef = new javax.swing.JTextField(); fieldPriAccess = new javax.swing.JTextField(); fieldAccessVersion = new javax.swing.JTextField(); panelMain02 = new javax.swing.JPanel(); lblSource = new javax.swing.JLabel(); lblOrg = new javax.swing.JLabel(); lblTaxo = new javax.swing.JLabel(); lblSDB = new javax.swing.JLabel(); lblKey = new javax.swing.JLabel(); lblComment = new javax.swing.JLabel(); fieldSource = new javax.swing.JTextField(); fieldOrg = new javax.swing.JTextField(); fieldTaxo = new javax.swing.JTextField(); fieldSDB = new javax.swing.JTextField(); fieldKey = new javax.swing.JTextField(); spComment = new javax.swing.JScrollPane(); areaComment = new javax.swing.JTextArea(); panelNCBIRef = new javax.swing.JPanel(); panelRefList = new javax.swing.JPanel(); spRefList = new javax.swing.JScrollPane(); listRef = new javax.swing.JList(); panelRefDetails = new javax.swing.JPanel(); lblAutRef = new javax.swing.JLabel(); lblTitRef = new javax.swing.JLabel(); lblJournalRef = new javax.swing.JLabel(); lblURLPubmedRef = new javax.swing.JLabel(); fieldAutRef = new javax.swing.JTextField(); fieldTitRef = new javax.swing.JTextField(); fieldJournalRef = new javax.swing.JTextField(); linkURLPubmedRef = new javax.swing.JLabel(); panelNCBISeq = new javax.swing.JPanel(); tabsNCBISequences = new javax.swing.JTabbedPane(); panelCompleteSequence = new javax.swing.JPanel(); spCompSeq = new javax.swing.JScrollPane(); areaCompSeq = new javax.swing.JTextPane(); lblIntCompSeq = new javax.swing.JLabel(); lblNameCompSeq = new javax.swing.JLabel(); lblScheme = new javax.swing.JLabel(); fieldIntCompSeq = new javax.swing.JTextField(); fieldNameCompSeq = new javax.swing.JTextField(); checkD1 = new javax.swing.JCheckBox(); checkD2 = new javax.swing.JCheckBox(); checkD3 = new javax.swing.JCheckBox(); panelD1 = new javax.swing.JPanel(); spD1 = new javax.swing.JScrollPane(); areaD1 = new javax.swing.JTextArea(); lblIntD1 = new javax.swing.JLabel(); lblNameD1 = new javax.swing.JLabel(); lblComD1 = new javax.swing.JLabel(); lblXrefD1 = new javax.swing.JLabel(); fieldIntD1 = new javax.swing.JTextField(); fieldNameD1 = new javax.swing.JTextField(); fieldComD1 = new javax.swing.JTextField(); linkXrefD1 = new javax.swing.JLabel(); panelD2 = new javax.swing.JPanel(); spD2 = new javax.swing.JScrollPane(); areaD2 = new javax.swing.JTextArea(); lblIntD2 = new javax.swing.JLabel(); lblNameD2 = new javax.swing.JLabel(); lblComD2 = new javax.swing.JLabel(); lblXrefD2 = new javax.swing.JLabel(); fieldIntD2 = new javax.swing.JTextField(); fieldNameD2 = new javax.swing.JTextField(); fieldComD2 = new javax.swing.JTextField(); linkXrefD2 = new javax.swing.JLabel(); panelD3 = new javax.swing.JPanel(); spD3 = new javax.swing.JScrollPane(); areaD3 = new javax.swing.JTextArea(); lblIntD3 = new javax.swing.JLabel(); ldlNameD3 = new javax.swing.JLabel(); lblComD3 = new javax.swing.JLabel(); lblXrefD3 = new javax.swing.JLabel(); fieldIntD3 = new javax.swing.JTextField(); fieldNameD3 = new javax.swing.JTextField(); fieldComD3 = new javax.swing.JTextField(); linkXrefD3 = new javax.swing.JLabel(); painel3D = new javax.swing.JPanel(); painelAvailable3DModels = new javax.swing.JPanel(); scrollList3DModels = new javax.swing.JScrollPane(); list3DModels = new javax.swing.JList(); lblPDBId = new javax.swing.JLabel(); fieldPDBId = new javax.swing.JTextField(); btnSavePDB = new javax.swing.JButton(); linkRCSBEntry = new javax.swing.JLabel(); lblPMDBId = new javax.swing.JLabel(); fieldPMDBId = new javax.swing.JTextField(); panelExtractionDetails = new javax.swing.JPanel(); labelDateExtr = new javax.swing.JLabel(); labelGrossAmount = new javax.swing.JLabel(); labelProcessAmount = new javax.swing.JLabel(); fieldDateExtr = new javax.swing.JTextField(); fieldGrossAmount = new javax.swing.JTextField(); fieldProcessAmount = new javax.swing.JTextField(); btnAboutProc = new javax.swing.JButton(); painelMisc = new javax.swing.JPanel(); btnColor = new javax.swing.JButton(); btnFASTA = new javax.swing.JButton(); btnAbout = new javax.swing.JButton(); lblWait = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("CryGetter"); setResizable(false); btnExtract .setIcon(new javax.swing.ImageIcon(getClass().getResource("/crygetter/gui/icons/world_link.png"))); // NOI18N btnExtract.setText("Extract"); btnExtract.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnExtractActionPerformed(evt); } }); btnLoad.setIcon(new javax.swing.ImageIcon(getClass().getResource("/crygetter/gui/icons/folder.png"))); // NOI18N btnLoad.setText("Load"); btnLoad.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnLoadActionPerformed(evt); } }); btnAligment.setIcon( new javax.swing.ImageIcon(getClass().getResource("/crygetter/gui/icons/shape_align_center.png"))); // NOI18N btnAligment.setText("Alignment"); btnAligment.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnAligmentActionPerformed(evt); } }); panelProteins.setBorder(javax.swing.BorderFactory.createTitledBorder("Proteins")); listProteins.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); listProteins.addListSelectionListener(new javax.swing.event.ListSelectionListener() { public void valueChanged(javax.swing.event.ListSelectionEvent evt) { listProteinsValueChanged(evt); } }); scrollProteins.setViewportView(listProteins); check3Domains.setText("With 3 Domains"); check3Domains.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { check3DomainsActionPerformed(evt); } }); check3DModels.setText("With 3D Model(s)"); check3DModels.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { check3DModelsActionPerformed(evt); } }); lblProteinsFiltered.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N lblProteinsFiltered.setForeground(new java.awt.Color(0, 102, 255)); lblProteinsFiltered.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); lblProteinsFiltered.setText("Proteins Filtered: 0"); javax.swing.GroupLayout panelProteinsLayout = new javax.swing.GroupLayout(panelProteins); panelProteins.setLayout(panelProteinsLayout); panelProteinsLayout.setHorizontalGroup(panelProteinsLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelProteinsLayout.createSequentialGroup().addContainerGap().addGroup(panelProteinsLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(scrollProteins, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addComponent(lblProteinsFiltered, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(panelProteinsLayout.createSequentialGroup() .addGroup(panelProteinsLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(check3DModels).addComponent(check3Domains)) .addGap(0, 29, Short.MAX_VALUE))) .addContainerGap())); panelProteinsLayout.setVerticalGroup(panelProteinsLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelProteinsLayout.createSequentialGroup().addContainerGap().addComponent(scrollProteins) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(check3Domains) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(check3DModels) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblProteinsFiltered).addContainerGap())); panelDetails.setBorder(javax.swing.BorderFactory.createTitledBorder("Details")); lblName.setText("Name:"); lblAccNo.setText("Accession Number:"); lblIdProt.setText("NCBI Protein Id:"); lblIdNuc.setText("NCBI Nucleotides Id:"); lblAut.setText("Authors:"); lblYear.setText("Year:"); lblStrain.setText("Source Strain:"); lblMainURL.setText("Main URL:"); lblCom.setText("Comments:"); linkMainURL.setForeground(new java.awt.Color(0, 0, 255)); linkMainURL.setText(" "); linkMainURL.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); linkMainURL.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { linkMainURLMouseClicked(evt); } }); areaCom.setColumns(20); areaCom.setRows(5); spCom.setViewportView(areaCom); javax.swing.GroupLayout panelBtDataLayout = new javax.swing.GroupLayout(panelBtData); panelBtData.setLayout(panelBtDataLayout); panelBtDataLayout.setHorizontalGroup(panelBtDataLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelBtDataLayout.createSequentialGroup().addContainerGap().addGroup(panelBtDataLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelBtDataLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblMainURL, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblStrain, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblAut, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblYear, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblIdNuc, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblIdProt, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblAccNo, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblName, javax.swing.GroupLayout.Alignment.TRAILING)) .addComponent(lblCom, javax.swing.GroupLayout.Alignment.TRAILING)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelBtDataLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(fieldName, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldAccNo, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(spCom, javax.swing.GroupLayout.PREFERRED_SIZE, 321, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldYear, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldStrain, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(linkMainURL, javax.swing.GroupLayout.PREFERRED_SIZE, 603, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldIdProt, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldIdNuc, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldAut, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(231, Short.MAX_VALUE))); panelBtDataLayout.setVerticalGroup(panelBtDataLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelBtDataLayout.createSequentialGroup().addContainerGap().addGroup(panelBtDataLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(lblName) .addComponent(fieldName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelBtDataLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblAccNo).addComponent(fieldAccNo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelBtDataLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblIdProt).addComponent(fieldIdProt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelBtDataLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblIdNuc).addComponent(fieldIdNuc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelBtDataLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblAut).addComponent(fieldAut, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelBtDataLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblYear).addComponent(fieldYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelBtDataLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblStrain).addComponent(fieldStrain, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelBtDataLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblMainURL).addComponent(linkMainURL)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelBtDataLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelBtDataLayout.createSequentialGroup().addComponent(lblCom).addGap(0, 0, Short.MAX_VALUE)) .addComponent(spCom, javax.swing.GroupLayout.DEFAULT_SIZE, 182, Short.MAX_VALUE)) .addGap(31, 31, 31))); tabsDetails.addTab("BtNomenclature", panelBtData); lblLocus.setText("Locus:"); lblLength.setText("Length:"); lblType.setText("Molecule Type:"); lblTopo.setText("Topology:"); lblDivi.setText("Division:"); lblCre.setText("Creation Date:"); lblDef.setText("Definition:"); lblPriAccess.setText("Primary Access:"); lblAccessVersion.setText("Acess Version:"); javax.swing.GroupLayout panelMain01Layout = new javax.swing.GroupLayout(panelMain01); panelMain01.setLayout(panelMain01Layout); panelMain01Layout.setHorizontalGroup(panelMain01Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelMain01Layout.createSequentialGroup() .addGroup( panelMain01Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblLocus, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblLength, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblType, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblTopo, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblDivi, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblCre, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblDef, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblPriAccess, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblAccessVersion, javax.swing.GroupLayout.Alignment.TRAILING)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelMain01Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(fieldLocus, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldDivi, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldCre, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldDef, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldPriAccess, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldAccessVersion, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(panelMain01Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(fieldType, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldTopo, javax.swing.GroupLayout.Alignment.LEADING)) .addComponent(fieldLength, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panelMain01Layout.setVerticalGroup(panelMain01Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelMain01Layout.createSequentialGroup().addGroup(panelMain01Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(lblLocus) .addComponent(fieldLocus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelMain01Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblLength).addComponent(fieldLength, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelMain01Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblType).addComponent(fieldType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelMain01Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblTopo).addComponent(fieldTopo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelMain01Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblDivi).addComponent(fieldDivi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelMain01Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblCre).addComponent(fieldCre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelMain01Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblDef).addComponent(fieldDef, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelMain01Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblPriAccess).addComponent(fieldPriAccess, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelMain01Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblAccessVersion).addComponent(fieldAccessVersion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))); lblSource.setText("Source:"); lblOrg.setText("Organism:"); lblTaxo.setText("Taxonomy:"); lblSDB.setText("Source Database:"); lblKey.setText("Keywords:"); lblComment.setText("Comments:"); areaComment.setColumns(20); areaComment.setLineWrap(true); areaComment.setRows(5); spComment.setViewportView(areaComment); javax.swing.GroupLayout panelMain02Layout = new javax.swing.GroupLayout(panelMain02); panelMain02.setLayout(panelMain02Layout); panelMain02Layout.setHorizontalGroup(panelMain02Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelMain02Layout.createSequentialGroup() .addGroup(panelMain02Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblComment).addComponent(lblSource).addComponent(lblOrg) .addComponent(lblTaxo).addComponent(lblSDB).addComponent(lblKey)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelMain02Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelMain02Layout.createSequentialGroup().addGroup(panelMain02Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(spComment, javax.swing.GroupLayout.PREFERRED_SIZE, 281, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldSource, javax.swing.GroupLayout.PREFERRED_SIZE, 305, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldOrg, javax.swing.GroupLayout.PREFERRED_SIZE, 305, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(panelMain02Layout.createSequentialGroup().addGroup(panelMain02Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(fieldSDB, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 458, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldTaxo, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 458, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldKey, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 458, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap())))); panelMain02Layout.setVerticalGroup(panelMain02Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelMain02Layout.createSequentialGroup() .addGroup(panelMain02Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(fieldSource, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblSource)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelMain02Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblOrg).addComponent(fieldOrg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelMain02Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblTaxo).addComponent(fieldTaxo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelMain02Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblSDB).addComponent(fieldSDB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelMain02Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblKey).addComponent(fieldKey, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelMain02Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelMain02Layout.createSequentialGroup().addComponent(lblComment) .addContainerGap()) .addComponent(spComment, javax.swing.GroupLayout.DEFAULT_SIZE, 145, Short.MAX_VALUE)))); javax.swing.GroupLayout panelMainNCBILayout = new javax.swing.GroupLayout(panelMainNCBI); panelMainNCBI.setLayout(panelMainNCBILayout); panelMainNCBILayout.setHorizontalGroup(panelMainNCBILayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelMainNCBILayout.createSequentialGroup().addContainerGap() .addComponent(panelMain01, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(panelMain02, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(89, 89, 89))); panelMainNCBILayout.setVerticalGroup(panelMainNCBILayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelMainNCBILayout.createSequentialGroup().addContainerGap().addGroup(panelMainNCBILayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(panelMain01, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(panelMain02, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(90, Short.MAX_VALUE))); tabsNCBIDetails.addTab("Main", panelMainNCBI); panelRefList.setBorder(javax.swing.BorderFactory.createTitledBorder("Reference List")); listRef.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); listRef.addListSelectionListener(new javax.swing.event.ListSelectionListener() { public void valueChanged(javax.swing.event.ListSelectionEvent evt) { listRefValueChanged(evt); } }); spRefList.setViewportView(listRef); javax.swing.GroupLayout panelRefListLayout = new javax.swing.GroupLayout(panelRefList); panelRefList.setLayout(panelRefListLayout); panelRefListLayout.setHorizontalGroup( panelRefListLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelRefListLayout.createSequentialGroup().addContainerGap() .addComponent(spRefList, javax.swing.GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE) .addContainerGap())); panelRefListLayout.setVerticalGroup(panelRefListLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelRefListLayout.createSequentialGroup() .addComponent(spRefList, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 9, Short.MAX_VALUE))); panelRefDetails.setBorder(javax.swing.BorderFactory.createTitledBorder("Details")); lblAutRef.setText("Authors:"); lblTitRef.setText("Title:"); lblJournalRef.setText("Journal:"); lblURLPubmedRef.setText("PubMed:"); linkURLPubmedRef.setForeground(new java.awt.Color(0, 0, 255)); linkURLPubmedRef.setText(" "); linkURLPubmedRef.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); linkURLPubmedRef.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { linkURLPubmedRefMouseClicked(evt); } }); javax.swing.GroupLayout panelRefDetailsLayout = new javax.swing.GroupLayout(panelRefDetails); panelRefDetails.setLayout(panelRefDetailsLayout); panelRefDetailsLayout.setHorizontalGroup( panelRefDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelRefDetailsLayout.createSequentialGroup().addContainerGap() .addGroup(panelRefDetailsLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblAutRef, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblTitRef, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblJournalRef, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblURLPubmedRef, javax.swing.GroupLayout.Alignment.TRAILING)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelRefDetailsLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(fieldAutRef, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldTitRef, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldJournalRef, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(linkURLPubmedRef, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panelRefDetailsLayout.setVerticalGroup( panelRefDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelRefDetailsLayout.createSequentialGroup().addContainerGap() .addGroup(panelRefDetailsLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblAutRef).addComponent(fieldAutRef, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelRefDetailsLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblTitRef).addComponent(fieldTitRef, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelRefDetailsLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblJournalRef) .addComponent(fieldJournalRef, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelRefDetailsLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblURLPubmedRef).addComponent(linkURLPubmedRef)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); javax.swing.GroupLayout panelNCBIRefLayout = new javax.swing.GroupLayout(panelNCBIRef); panelNCBIRef.setLayout(panelNCBIRefLayout); panelNCBIRefLayout.setHorizontalGroup(panelNCBIRefLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelNCBIRefLayout.createSequentialGroup().addContainerGap() .addComponent(panelRefList, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(panelRefDetails, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(222, Short.MAX_VALUE))); panelNCBIRefLayout .setVerticalGroup(panelNCBIRefLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelNCBIRefLayout.createSequentialGroup().addContainerGap() .addGroup(panelNCBIRefLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(panelRefList, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(panelRefDetails, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap(203, Short.MAX_VALUE))); tabsNCBIDetails.addTab("References", panelNCBIRef); areaCompSeq.setFont(new java.awt.Font("Courier New", 0, 13)); // NOI18N spCompSeq.setViewportView(areaCompSeq); lblIntCompSeq.setText("Interval:"); lblNameCompSeq.setText("Name:"); checkD1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N checkD1.setText("Domain 1"); checkD1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { checkD1ActionPerformed(evt); } }); checkD2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N checkD2.setText("Domain 2"); checkD2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { checkD2ActionPerformed(evt); } }); checkD3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N checkD3.setText("Domain 3"); checkD3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { checkD3ActionPerformed(evt); } }); javax.swing.GroupLayout panelCompleteSequenceLayout = new javax.swing.GroupLayout(panelCompleteSequence); panelCompleteSequence.setLayout(panelCompleteSequenceLayout); panelCompleteSequenceLayout.setHorizontalGroup(panelCompleteSequenceLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelCompleteSequenceLayout.createSequentialGroup().addContainerGap() .addComponent(spCompSeq, javax.swing.GroupLayout.PREFERRED_SIZE, 575, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelCompleteSequenceLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblNameCompSeq).addComponent(lblIntCompSeq)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelCompleteSequenceLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(fieldIntCompSeq, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldNameCompSeq, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(checkD1) .addComponent(lblScheme, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(panelCompleteSequenceLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(checkD3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(checkD2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addContainerGap(12, Short.MAX_VALUE))); panelCompleteSequenceLayout.setVerticalGroup(panelCompleteSequenceLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelCompleteSequenceLayout.createSequentialGroup().addContainerGap() .addGroup(panelCompleteSequenceLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelCompleteSequenceLayout.createSequentialGroup() .addGroup(panelCompleteSequenceLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(fieldIntCompSeq, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblIntCompSeq)) .addGap(8, 8, 8) .addGroup(panelCompleteSequenceLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblNameCompSeq).addComponent(fieldNameCompSeq, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(checkD1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(checkD2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(checkD3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblScheme, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) .addComponent(spCompSeq, javax.swing.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE)) .addContainerGap())); tabsNCBISequences.addTab("Complete Protein", panelCompleteSequence); areaD1.setColumns(20); areaD1.setFont(new java.awt.Font("Courier New", 0, 13)); // NOI18N areaD1.setRows(5); spD1.setViewportView(areaD1); lblIntD1.setText("Interval:"); lblNameD1.setText("Name:"); lblComD1.setText("Comment:"); lblXrefD1.setText("X-Ref:"); linkXrefD1.setForeground(new java.awt.Color(0, 0, 255)); linkXrefD1.setText(" "); linkXrefD1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); linkXrefD1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { linkXrefD1MouseClicked(evt); } }); javax.swing.GroupLayout panelD1Layout = new javax.swing.GroupLayout(panelD1); panelD1.setLayout(panelD1Layout); panelD1Layout.setHorizontalGroup(panelD1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelD1Layout.createSequentialGroup().addContainerGap() .addComponent(spD1, javax.swing.GroupLayout.PREFERRED_SIZE, 575, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelD1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblIntD1).addComponent(lblNameD1).addComponent(lblComD1) .addComponent(lblXrefD1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelD1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(fieldIntD1, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldNameD1, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldComD1, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(linkXrefD1, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(110, Short.MAX_VALUE))); panelD1Layout.setVerticalGroup(panelD1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelD1Layout.createSequentialGroup().addContainerGap().addGroup(panelD1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelD1Layout.createSequentialGroup() .addGroup(panelD1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(fieldIntD1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblIntD1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelD1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblNameD1) .addComponent(fieldNameD1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelD1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblComD1).addComponent(fieldComD1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelD1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblXrefD1).addComponent(linkXrefD1)) .addGap(0, 0, Short.MAX_VALUE)) .addComponent(spD1, javax.swing.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE)) .addContainerGap())); tabsNCBISequences.addTab("Domain 1", panelD1); areaD2.setColumns(20); areaD2.setFont(new java.awt.Font("Courier New", 0, 13)); // NOI18N areaD2.setRows(5); spD2.setViewportView(areaD2); lblIntD2.setText("Interval:"); lblNameD2.setText("Name:"); lblComD2.setText("Comment:"); lblXrefD2.setText("X-Ref:"); linkXrefD2.setForeground(new java.awt.Color(0, 0, 255)); linkXrefD2.setText(" "); linkXrefD2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); linkXrefD2.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { linkXrefD2MouseClicked(evt); } }); javax.swing.GroupLayout panelD2Layout = new javax.swing.GroupLayout(panelD2); panelD2.setLayout(panelD2Layout); panelD2Layout.setHorizontalGroup(panelD2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelD2Layout.createSequentialGroup().addContainerGap() .addComponent(spD2, javax.swing.GroupLayout.PREFERRED_SIZE, 575, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelD2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblIntD2, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblNameD2, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblComD2, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblXrefD2, javax.swing.GroupLayout.Alignment.TRAILING)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelD2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(fieldIntD2, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldNameD2, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldComD2, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(linkXrefD2, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(110, Short.MAX_VALUE))); panelD2Layout.setVerticalGroup(panelD2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelD2Layout.createSequentialGroup().addContainerGap().addGroup(panelD2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelD2Layout.createSequentialGroup() .addGroup(panelD2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(fieldIntD2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblIntD2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelD2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblNameD2) .addComponent(fieldNameD2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelD2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblComD2).addComponent(fieldComD2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelD2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblXrefD2).addComponent(linkXrefD2)) .addGap(0, 0, Short.MAX_VALUE)) .addComponent(spD2, javax.swing.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE)) .addContainerGap())); tabsNCBISequences.addTab("Domain 2", panelD2); areaD3.setColumns(20); areaD3.setFont(new java.awt.Font("Courier New", 0, 13)); // NOI18N areaD3.setRows(5); spD3.setViewportView(areaD3); lblIntD3.setText("Interval:"); ldlNameD3.setText("Name:"); lblComD3.setText("Comment:"); lblXrefD3.setText("X-Ref:"); linkXrefD3.setForeground(new java.awt.Color(0, 0, 255)); linkXrefD3.setText(" "); linkXrefD3.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); linkXrefD3.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { linkXrefD3MouseClicked(evt); } }); javax.swing.GroupLayout panelD3Layout = new javax.swing.GroupLayout(panelD3); panelD3.setLayout(panelD3Layout); panelD3Layout.setHorizontalGroup(panelD3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelD3Layout.createSequentialGroup().addContainerGap() .addComponent(spD3, javax.swing.GroupLayout.PREFERRED_SIZE, 575, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelD3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblIntD3, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(ldlNameD3, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblComD3, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblXrefD3, javax.swing.GroupLayout.Alignment.TRAILING)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelD3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(fieldIntD3, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldNameD3, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fieldComD3, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(linkXrefD3, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(110, Short.MAX_VALUE))); panelD3Layout.setVerticalGroup(panelD3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelD3Layout.createSequentialGroup().addContainerGap().addGroup(panelD3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelD3Layout.createSequentialGroup() .addGroup(panelD3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(fieldIntD3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblIntD3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelD3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(ldlNameD3) .addComponent(fieldNameD3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelD3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblComD3).addComponent(fieldComD3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelD3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblXrefD3).addComponent(linkXrefD3)) .addGap(0, 0, Short.MAX_VALUE)) .addComponent(spD3, javax.swing.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE)) .addContainerGap())); tabsNCBISequences.addTab("Domain 3", panelD3); javax.swing.GroupLayout panelNCBISeqLayout = new javax.swing.GroupLayout(panelNCBISeq); panelNCBISeq.setLayout(panelNCBISeqLayout); panelNCBISeqLayout.setHorizontalGroup( panelNCBISeqLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelNCBISeqLayout.createSequentialGroup().addContainerGap() .addComponent(tabsNCBISequences).addContainerGap())); panelNCBISeqLayout .setVerticalGroup(panelNCBISeqLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelNCBISeqLayout.createSequentialGroup().addContainerGap() .addComponent(tabsNCBISequences).addContainerGap())); tabsNCBIDetails.addTab("Sequence", panelNCBISeq); javax.swing.GroupLayout painelNCBILayout = new javax.swing.GroupLayout(painelNCBI); painelNCBI.setLayout(painelNCBILayout); painelNCBILayout .setHorizontalGroup(painelNCBILayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(painelNCBILayout.createSequentialGroup().addContainerGap() .addComponent(tabsNCBIDetails).addContainerGap())); painelNCBILayout .setVerticalGroup(painelNCBILayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(painelNCBILayout.createSequentialGroup().addContainerGap() .addComponent(tabsNCBIDetails).addContainerGap())); tabsDetails.addTab("NCBI", painelNCBI); painelAvailable3DModels.setBorder(javax.swing.BorderFactory.createTitledBorder("Available Model(s)")); list3DModels.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { list3DModelsMouseClicked(evt); } }); scrollList3DModels.setViewportView(list3DModels); lblPDBId.setText("PDB Id:"); btnSavePDB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/crygetter/gui/icons/disk.png"))); // NOI18N btnSavePDB.setText("Save Model"); btnSavePDB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSavePDBActionPerformed(evt); } }); linkRCSBEntry.setText("RCSB Protein Data Bank Entry"); lblPMDBId.setText("PMDB Id:"); javax.swing.GroupLayout painelAvailable3DModelsLayout = new javax.swing.GroupLayout( painelAvailable3DModels); painelAvailable3DModels.setLayout(painelAvailable3DModelsLayout); painelAvailable3DModelsLayout.setHorizontalGroup(painelAvailable3DModelsLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(painelAvailable3DModelsLayout.createSequentialGroup().addContainerGap() .addGroup(painelAvailable3DModelsLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(linkRCSBEntry, javax.swing.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE) .addComponent(scrollList3DModels, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addGroup( painelAvailable3DModelsLayout.createSequentialGroup().addComponent(lblPDBId) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(fieldPDBId)) .addGroup(painelAvailable3DModelsLayout.createSequentialGroup() .addComponent(lblPMDBId) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(fieldPMDBId)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, painelAvailable3DModelsLayout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE).addComponent(btnSavePDB))) .addContainerGap())); painelAvailable3DModelsLayout.setVerticalGroup( painelAvailable3DModelsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(painelAvailable3DModelsLayout.createSequentialGroup().addContainerGap() .addComponent(scrollList3DModels, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(painelAvailable3DModelsLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblPDBId).addComponent(fieldPDBId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(linkRCSBEntry) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(painelAvailable3DModelsLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblPMDBId).addComponent(fieldPMDBId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnSavePDB).addContainerGap())); javax.swing.GroupLayout painel3DLayout = new javax.swing.GroupLayout(painel3D); painel3D.setLayout(painel3DLayout); painel3DLayout.setHorizontalGroup(painel3DLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(painel3DLayout.createSequentialGroup().addContainerGap() .addComponent(painelAvailable3DModels, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(703, Short.MAX_VALUE))); painel3DLayout .setVerticalGroup( painel3DLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(painel3DLayout.createSequentialGroup().addContainerGap() .addComponent(painelAvailable3DModels, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); tabsDetails.addTab("3D Model(s)", painel3D); javax.swing.GroupLayout panelDetailsLayout = new javax.swing.GroupLayout(panelDetails); panelDetails.setLayout(panelDetailsLayout); panelDetailsLayout.setHorizontalGroup( panelDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelDetailsLayout.createSequentialGroup().addContainerGap() .addComponent(tabsDetails, javax.swing.GroupLayout.PREFERRED_SIZE, 954, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panelDetailsLayout.setVerticalGroup(panelDetailsLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(panelDetailsLayout .createSequentialGroup().addContainerGap().addComponent(tabsDetails).addContainerGap())); tabsDetails.getAccessibleContext().setAccessibleName("BtNomenclature"); panelExtractionDetails.setBorder(javax.swing.BorderFactory.createTitledBorder("Extraction Details")); labelDateExtr.setText("Date:"); labelGrossAmount.setText("Gross Amount:"); labelProcessAmount.setText("Processed Amount:"); fieldDateExtr.setEditable(false); fieldGrossAmount.setEditable(false); fieldProcessAmount.setEditable(false); btnAboutProc.setIcon(new javax.swing.ImageIcon(getClass().getResource("/crygetter/gui/icons/help.png"))); // NOI18N btnAboutProc.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnAboutProcActionPerformed(evt); } }); javax.swing.GroupLayout panelExtractionDetailsLayout = new javax.swing.GroupLayout(panelExtractionDetails); panelExtractionDetails.setLayout(panelExtractionDetailsLayout); panelExtractionDetailsLayout.setHorizontalGroup( panelExtractionDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelExtractionDetailsLayout.createSequentialGroup().addContainerGap() .addComponent(labelDateExtr) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(fieldDateExtr, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(labelGrossAmount) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(fieldGrossAmount, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(labelProcessAmount) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(fieldProcessAmount, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnAboutProc) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panelExtractionDetailsLayout.setVerticalGroup( panelExtractionDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelExtractionDetailsLayout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(panelExtractionDetailsLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(labelDateExtr) .addComponent(fieldDateExtr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(labelGrossAmount) .addComponent(fieldGrossAmount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(labelProcessAmount) .addComponent(fieldProcessAmount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btnAboutProc)))); painelMisc.setBorder(javax.swing.BorderFactory.createTitledBorder("Miscellaneous")); btnColor.setIcon(new javax.swing.ImageIcon(getClass().getResource("/crygetter/gui/icons/color_wheel.png"))); // NOI18N btnColor.setText("Color"); btnColor.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnColorActionPerformed(evt); } }); btnFASTA.setIcon(new javax.swing.ImageIcon(getClass().getResource("/crygetter/gui/icons/report.png"))); // NOI18N btnFASTA.setText("FASTA Gen."); btnFASTA.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFASTAActionPerformed(evt); } }); btnAbout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/crygetter/gui/icons/help.png"))); // NOI18N btnAbout.setText("About"); btnAbout.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnAboutActionPerformed(evt); } }); javax.swing.GroupLayout painelMiscLayout = new javax.swing.GroupLayout(painelMisc); painelMisc.setLayout(painelMiscLayout); painelMiscLayout.setHorizontalGroup(painelMiscLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(painelMiscLayout.createSequentialGroup().addContainerGap().addComponent(btnColor) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(btnFASTA) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(btnAbout) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); painelMiscLayout.setVerticalGroup( painelMiscLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, painelMiscLayout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE) .addGroup(painelMiscLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnColor).addComponent(btnFASTA).addComponent(btnAbout)))); lblWait.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N lblWait.setForeground(new java.awt.Color(0, 102, 255)); lblWait.setText(" "); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup().addComponent(btnAligment) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblWait, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(panelProteins, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup().addComponent(btnExtract) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnLoad))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addComponent(panelExtractionDetails, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(painelMisc, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(panelDetails, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(24, Short.MAX_VALUE))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(panelExtractionDetails, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnExtract).addComponent(btnLoad)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnAligment).addComponent(lblWait))) .addComponent(painelMisc, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(panelDetails, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(panelProteins, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); setSize(new java.awt.Dimension(1210, 624)); setLocationRelativeTo(null); }// </editor-fold>//GEN-END:initComponents private void btnExtractActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExtractActionPerformed new Thread(new ExtractionTask(this)).start(); }//GEN-LAST:event_btnExtractActionPerformed private void btnLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoadActionPerformed JFileChooser jfc = new JFileChooser(); FileNameExtensionFilter fnef = new FileNameExtensionFilter("CryGetter Extraction (*.cgext)", "cgext"); for (FileFilter f : jfc.getChoosableFileFilters()) { jfc.removeChoosableFileFilter(f); } jfc.setFileFilter(fnef); jfc.setDialogTitle("Load Extracted Data"); jfc.setFileSelectionMode(JFileChooser.FILES_ONLY); jfc.setMultiSelectionEnabled(false); if (jfc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { new Thread(new LoadTask(this, jfc.getSelectedFile())).start(); } }//GEN-LAST:event_btnLoadActionPerformed private void linkMainURLMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_linkMainURLMouseClicked if (selectedCt != null) { if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop().browse(new URI(selectedCt.ncbiURL)); } catch (IOException | URISyntaxException exc) { Utils.showExceptionMessage(this, exc); } } } }//GEN-LAST:event_linkMainURLMouseClicked private void listProteinsValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_listProteinsValueChanged if (listProteins != null) { CryToxin selectedNow = (CryToxin) listProteins.getSelectedValue(); if (selectedNow != null) { selectedCt = selectedNow; updateDetails(); /*BufferedImage img = Utils.generateProteinSchemeImage( selectedCt, true ); JLabel label = new JLabel(); label.setIcon( new ImageIcon( img ) ); JOptionPane.showMessageDialog( this, label );*/ } } }//GEN-LAST:event_listProteinsValueChanged private void listRefValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_listRefValueChanged if (listRef != null) { GBReference ref = (GBReference) listRef.getSelectedValue(); if (ref != null) { StringBuilder sbAut = new StringBuilder(); if (ref.getGBReferenceAuthors() != null) { for (GBAuthor a : ref.getGBReferenceAuthors().getGBAuthor()) { sbAut.append(a.getvalue()).append("; "); } } fieldAutRef.setText(sbAut.toString()); fieldTitRef.setText(ref.getGBReferenceTitle()); fieldJournalRef.setText(ref.getGBReferenceJournal()); if (ref.getGBReferencePubmed() != null) { linkURLPubmedRef.setText(ref.getGBReferencePubmed()); } } } }//GEN-LAST:event_listRefValueChanged private void linkURLPubmedRefMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_linkURLPubmedRefMouseClicked if (!linkURLPubmedRef.getText().equals(" ")) { if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop() .browse(new URI("http://www.ncbi.nlm.nih.gov/pubmed/" + linkURLPubmedRef.getText())); } catch (IOException | URISyntaxException exc) { Utils.showExceptionMessage(this, exc); } } } }//GEN-LAST:event_linkURLPubmedRefMouseClicked private void btnAboutProcActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAboutProcActionPerformed JOptionPane.showMessageDialog(this, "The listed proteins were processed to show only the ones with the\n" + "following characteristics:\n\n" + "- BtNomenclature identification is equals of NCBI identification, i.e.,\n" + " they have the same accession number in BtNomenclature and NCBI;\n\n" + "- Protein name has the current identification pattern:\n" + " Cry{1}{2}{3}{4}, where:\n" + " 1: A required integer number;\n" + " 2: A required uppercase letter;\n" + " 3: A required lowercase letter;\n" + " 4: An optional integer number.", "Processing Details", JOptionPane.INFORMATION_MESSAGE); }//GEN-LAST:event_btnAboutProcActionPerformed private void linkXrefD1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_linkXrefD1MouseClicked openDomainXRefLink(linkXrefD1); }//GEN-LAST:event_linkXrefD1MouseClicked private void linkXrefD2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_linkXrefD2MouseClicked openDomainXRefLink(linkXrefD2); }//GEN-LAST:event_linkXrefD2MouseClicked private void linkXrefD3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_linkXrefD3MouseClicked openDomainXRefLink(linkXrefD3); }//GEN-LAST:event_linkXrefD3MouseClicked private void checkD1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkD1ActionPerformed fillCompleteSequenceTextPane(); }//GEN-LAST:event_checkD1ActionPerformed private void checkD2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkD2ActionPerformed fillCompleteSequenceTextPane(); }//GEN-LAST:event_checkD2ActionPerformed private void checkD3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkD3ActionPerformed fillCompleteSequenceTextPane(); }//GEN-LAST:event_checkD3ActionPerformed private void btnAligmentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAligmentActionPerformed if (ctList != null) { AlignmentDialog ad = new AlignmentDialog(this, true, ctList, defaultConfigs, configs); ad.setVisible(true); } else { JOptionPane.showMessageDialog(this, "First you need to load an extraction file!", "Warning", JOptionPane.WARNING_MESSAGE); } }//GEN-LAST:event_btnAligmentActionPerformed private void btnColorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnColorActionPerformed JColorChooser jcc = new JColorChooser(); Color c = JColorChooser.showDialog(this, "Base Color", baseProteinColor); if (c != null) { baseProteinColor = c; configs.setProperty("bpcR", String.valueOf(baseProteinColor.getRed())); configs.setProperty("bpcG", String.valueOf(baseProteinColor.getGreen())); configs.setProperty("bpcB", String.valueOf(baseProteinColor.getBlue())); try { configs.store(new FileOutputStream("conf/conf.properties"), "CryGetter Configuration File - Must not be changed!!!"); } catch (IOException ex) { Utils.showExceptionMessage(this, ex); System.exit(1); } if (ctList != null) { updateProteinColors(); listProteins.updateUI(); } } }//GEN-LAST:event_btnColorActionPerformed private void btnFASTAActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFASTAActionPerformed if (ctList != null) { JFileChooser jfc = new JFileChooser(); jfc.setDialogTitle("Generate FASTA files"); jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); jfc.setMultiSelectionEnabled(false); if (jfc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { File f = jfc.getSelectedFile(); File fastaDir = new File(f.getPath() + "/CryGetterFastaOutput"); new Thread(new GenerateFASTATask(this, fastaDir)).start(); } } else { JOptionPane.showMessageDialog(this, "First you need to load an extraction file!", "Warning", JOptionPane.WARNING_MESSAGE); } }//GEN-LAST:event_btnFASTAActionPerformed private void btnAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAboutActionPerformed JOptionPane.showMessageDialog(this, "CryGetter is an application that aims to support\n" + "Cry proteins data retrieval, study and analisys.\n\n" + "It was developed as a part of the Ph.D.\n" + "project of David Buzatto under the advisement\n" + "of Professor Snia Marli Zingaretti at UNAERP.\n" + "(Universidade de Ribeiro Preto - University of\n" + "Ribeiro Preto).\n\n" + "Version 1.03 - 07/06/2018", "About", JOptionPane.INFORMATION_MESSAGE); }//GEN-LAST:event_btnAboutActionPerformed private void list3DModelsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_list3DModelsMouseClicked if (list3DModels.getSelectedValue() != null) { selectedPDBModel = list3DModels.getSelectedValue().toString(); final String proteinId = selectedPDBModel.split(" ")[2].replace(".pdb", ""); if (proteinId.startsWith("PM")) { fieldPDBId.setText(""); fieldPMDBId.setText(proteinId); linkRCSBEntry.setForeground(Color.BLACK); linkRCSBEntry.setCursor(null); for (MouseListener ml : linkRCSBEntry.getMouseListeners()) { linkRCSBEntry.removeMouseListener(ml); } } else { fieldPDBId.setText(proteinId); fieldPMDBId.setText(""); linkRCSBEntry.setForeground(Color.BLUE); linkRCSBEntry.setCursor(new Cursor(Cursor.HAND_CURSOR)); for (MouseListener ml : linkRCSBEntry.getMouseListeners()) { linkRCSBEntry.removeMouseListener(ml); } linkRCSBEntry.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop() .browse(new URI("http://www.rcsb.org/pdb/explore/explore.do?structureId=" + proteinId.toLowerCase())); } catch (IOException | URISyntaxException exc) { Utils.showExceptionMessage(null, exc); } } } }); } } else { selectedPDBModel = null; fieldPDBId.setText(""); fieldPMDBId.setText(""); linkRCSBEntry.setForeground(Color.BLACK); linkRCSBEntry.setCursor(null); for (MouseListener ml : linkRCSBEntry.getMouseListeners()) { linkRCSBEntry.removeMouseListener(ml); } } }//GEN-LAST:event_list3DModelsMouseClicked private void btnSavePDBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSavePDBActionPerformed if (selectedPDBModel != null) { JFileChooser jfc = new JFileChooser(); FileNameExtensionFilter fnef = new FileNameExtensionFilter("PDB Model (*.pdb)", "pdb"); for (FileFilter f : jfc.getChoosableFileFilters()) { jfc.removeChoosableFileFilter(f); } jfc.setFileFilter(fnef); jfc.setDialogTitle("Save PDB"); jfc.setFileSelectionMode(JFileChooser.FILES_ONLY); jfc.setMultiSelectionEnabled(false); jfc.setSelectedFile(new File(selectedPDBModel)); if (jfc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { File f = jfc.getSelectedFile(); if (f.getName().lastIndexOf(".pdb") == -1) { f = new File(f.getAbsolutePath() + ".pdb"); } if (!f.exists() || (f.exists() && JOptionPane.showConfirmDialog(this, "The file already exists. Do you want to overwrite it?", "Warning", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION)) { try { File loadedFile = new File("./cryModels/" + selectedPDBModel); FileInputStream fis = new FileInputStream(loadedFile); FileOutputStream fos = new FileOutputStream(f); int data = 0; while ((data = fis.read()) != -1) { fos.write(data); } fis.close(); fos.close(); } catch (IOException exc) { Utils.showExceptionMessage(this, exc); } } } } else { JOptionPane.showMessageDialog(this, "You must select a model to save!", "Warning", JOptionPane.WARNING_MESSAGE); } }//GEN-LAST:event_btnSavePDBActionPerformed private void check3DomainsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_check3DomainsActionPerformed filter(); }//GEN-LAST:event_check3DomainsActionPerformed private void check3DModelsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_check3DModelsActionPerformed filter(); }//GEN-LAST:event_check3DModelsActionPerformed private void prepareConfiguration() { configs = new Properties(); defaultConfigs = new Properties(); // creating default configs defaultConfigs.setProperty("bpcR", String.valueOf(baseProteinColor.getRed())); defaultConfigs.setProperty("bpcG", String.valueOf(baseProteinColor.getGreen())); defaultConfigs.setProperty("bpcB", String.valueOf(baseProteinColor.getBlue())); defaultConfigs.setProperty("coDIS", "false"); defaultConfigs.setProperty("coMbedCGT", "true"); defaultConfigs.setProperty("coMbedCI", "true"); defaultConfigs.setProperty("coNCI", "0"); defaultConfigs.setProperty("coMGTI", "0"); defaultConfigs.setProperty("coMHMMI", "0"); defaultConfigs.setProperty("coO", "0"); defaultConfigs.setProperty("coOF", "0"); defaultConfigs.setProperty("cwPWT", "slow"); defaultConfigs.setProperty("cwPWSPWM", "2"); defaultConfigs.setProperty("cwPWSGO", "3"); defaultConfigs.setProperty("cwPWSGE", "1"); defaultConfigs.setProperty("cwPWFKTUP", "0"); defaultConfigs.setProperty("cwPWFWL", "5"); defaultConfigs.setProperty("cwPWFST", "0"); defaultConfigs.setProperty("cwPWFTD", "5"); defaultConfigs.setProperty("cwPWFPG", "2"); defaultConfigs.setProperty("cwMPWM", "2"); defaultConfigs.setProperty("cwMGO", "3"); defaultConfigs.setProperty("cwMGE", "1"); defaultConfigs.setProperty("cwMGD", "5"); defaultConfigs.setProperty("cwMNEG", "false"); defaultConfigs.setProperty("cwMI", "0"); defaultConfigs.setProperty("cwMNI", "2"); defaultConfigs.setProperty("cwMC", "0"); defaultConfigs.setProperty("cwMO", "0"); defaultConfigs.setProperty("cwMOF", "1"); defaultConfigs.setProperty("mMFD", "false"); defaultConfigs.setProperty("mMOF", "1"); defaultConfigs.setProperty("mwPP", "/"); defaultConfigs.setProperty("mwAC", "2"); defaultConfigs.setProperty("mwACM", "0"); defaultConfigs.setProperty("mwAGM", "0"); defaultConfigs.setProperty("mwCC", "2"); defaultConfigs.setProperty("mwCCM", "0"); defaultConfigs.setProperty("mwCGM", "0"); try { configs.load(new FileInputStream("conf/conf.properties")); baseProteinColor = new Color(Integer.parseInt(configs.getProperty("bpcR")), Integer.parseInt(configs.getProperty("bpcG")), Integer.parseInt(configs.getProperty("bpcB"))); } catch (IOException exc) { // properties not found... creating if (exc instanceof FileNotFoundException) { // loading default configuration into configs for (String s : defaultConfigs.stringPropertyNames()) { configs.setProperty(s, defaultConfigs.getProperty(s)); } try { configs.store(new FileOutputStream("conf/conf.properties"), "CryGetter Configuration File - Must not be changed!!!"); } catch (IOException ex) { Utils.showExceptionMessage(this, ex); System.exit(1); } } } } private void updateProteinColors() { // colors // getting all classes Set<String> cryPrefixSet = new LinkedHashSet<>(); for (CryToxin ct : ctList) { Pattern pp = Pattern.compile("Cry(\\d+)[A-Z][A-z]\\d*"); Matcher mm = pp.matcher(ct.name); mm.matches(); cryPrefixSet.add("Cry" + mm.group(1)); } float jump = (float) (1.0 / cryPrefixSet.size()); float acum = 0; Map<String, Color> colorMap = new HashMap<>(); float[] baseHSB = Color.RGBtoHSB(baseProteinColor.getRed(), baseProteinColor.getGreen(), baseProteinColor.getBlue(), null); for (String prefix : cryPrefixSet) { colorMap.put(prefix, new Color(Color.HSBtoRGB(baseHSB[0] - acum, baseHSB[1], baseHSB[2]))); acum += jump; } for (CryToxin ct : ctList) { Pattern pp = Pattern.compile("Cry(\\d+)[A-Z][A-z]\\d*"); Matcher mm = pp.matcher(ct.name); mm.matches(); ct.classColor = colorMap.get("Cry" + mm.group(1)); } } private void fillCompleteSequenceTextPane() { if (selectedSeq != null && selectedSeq.getGBSeqSequence() != null) { areaCompSeq.setText(""); Utils.appendToPane(areaCompSeq, "", Color.BLACK, Color.WHITE); String sequence = selectedCt.proteinSequence; CryToxinDomain d1 = selectedCt.getDomain(1); CryToxinDomain d2 = selectedCt.getDomain(2); CryToxinDomain d3 = selectedCt.getDomain(3); SequenceInterval prev = new SequenceInterval(); prev.start = 1; prev.end = d1.interval.start - 1; SequenceInterval d12 = new SequenceInterval(); d12.start = d1.interval.end + 1; d12.end = d2.interval.start - 1; SequenceInterval d23 = new SequenceInterval(); d23.start = d2.interval.end + 1; d23.end = d3.interval.start - 1; SequenceInterval end = new SequenceInterval(); end.start = d3.interval.end + 1; end.end = sequence.length(); String content = ""; int jump = 0; int lastNewLineIndex = 0; int lastLineLength = 0; String spaceInsert = ""; String lineInsert = ""; Utils.appendToPane(areaCompSeq, Utils.formatProtein(sequence.substring(prev.start - 1, prev.end)), Color.BLACK, Color.WHITE); if (d1.interval.start <= d1.interval.end) { content = areaCompSeq.getText(); jump = content.length() - Utils.countChar(content, ' ') - Utils.countChar(content, '\n'); lastNewLineIndex = content.lastIndexOf('\n'); lastLineLength = content.substring(lastNewLineIndex + 1, content.length()).trim() .replaceAll("[\n]|[ ]", "").length(); spaceInsert = lastLineLength % 10 == 0 && lastLineLength % 60 != 0 && lastLineLength != 0 ? " " : ""; lineInsert = lastLineLength % 60 == 0 && lastLineLength != 0 ? "\n" : ""; if (checkD1.isSelected()) { Utils.appendToPane(areaCompSeq, spaceInsert + lineInsert + Utils.formatProtein( sequence.substring(d1.interval.start - 1, d1.interval.end), jump), Color.BLACK, cD1); } else { Utils.appendToPane(areaCompSeq, spaceInsert + lineInsert + Utils.formatProtein( sequence.substring(d1.interval.start - 1, d1.interval.end), jump), Color.BLACK, Color.WHITE); } } if (d12.start <= d12.end) { content = areaCompSeq.getText(); jump = content.length() - Utils.countChar(content, ' ') - Utils.countChar(content, '\n'); lastNewLineIndex = content.lastIndexOf('\n'); lastLineLength = content.substring(lastNewLineIndex + 1, content.length()).trim() .replaceAll("[\n]|[ ]", "").length(); spaceInsert = lastLineLength % 10 == 0 && lastLineLength % 60 != 0 && lastLineLength != 0 ? " " : ""; lineInsert = lastLineLength % 60 == 0 && lastLineLength != 0 ? "\n" : ""; Utils.appendToPane(areaCompSeq, spaceInsert + lineInsert + Utils.formatProtein(sequence.substring(d12.start - 1, d12.end), jump), Color.BLACK, Color.WHITE); } if (d2.interval.start <= d2.interval.end) { content = areaCompSeq.getText(); jump = content.length() - Utils.countChar(content, ' ') - Utils.countChar(content, '\n'); lastNewLineIndex = content.lastIndexOf('\n'); lastLineLength = content.substring(lastNewLineIndex + 1, content.length()).trim() .replaceAll("[\n]|[ ]", "").length(); spaceInsert = lastLineLength % 10 == 0 && lastLineLength % 60 != 0 && lastLineLength != 0 ? " " : ""; lineInsert = lastLineLength % 60 == 0 && lastLineLength != 0 ? "\n" : ""; if (checkD2.isSelected()) { Utils.appendToPane(areaCompSeq, spaceInsert + lineInsert + Utils.formatProtein( sequence.substring(d2.interval.start - 1, d2.interval.end), jump), Color.BLACK, cD2); } else { Utils.appendToPane(areaCompSeq, spaceInsert + lineInsert + Utils.formatProtein( sequence.substring(d2.interval.start - 1, d2.interval.end), jump), Color.BLACK, Color.WHITE); } } if (d23.start <= d23.end) { content = areaCompSeq.getText(); jump = content.length() - Utils.countChar(content, ' ') - Utils.countChar(content, '\n'); lastNewLineIndex = content.lastIndexOf('\n'); lastLineLength = content.substring(lastNewLineIndex + 1, content.length()).trim() .replaceAll("[\n]|[ ]", "").length(); spaceInsert = lastLineLength % 10 == 0 && lastLineLength % 60 != 0 && lastLineLength != 0 ? " " : ""; lineInsert = lastLineLength % 60 == 0 && lastLineLength != 0 ? "\n" : ""; Utils.appendToPane(areaCompSeq, spaceInsert + lineInsert + Utils.formatProtein(sequence.substring(d23.start - 1, d23.end), jump), Color.BLACK, Color.WHITE); } if (d3.interval.start <= d3.interval.end) { content = areaCompSeq.getText(); jump = content.length() - Utils.countChar(content, ' ') - Utils.countChar(content, '\n'); lastNewLineIndex = content.lastIndexOf('\n'); lastLineLength = content.substring(lastNewLineIndex + 1, content.length()).trim() .replaceAll("[\n]|[ ]", "").length(); spaceInsert = lastLineLength % 10 == 0 && lastLineLength % 60 != 0 && lastLineLength != 0 ? " " : ""; lineInsert = lastLineLength % 60 == 0 && lastLineLength != 0 ? "\n" : ""; if (checkD3.isSelected()) { Utils.appendToPane(areaCompSeq, spaceInsert + lineInsert + Utils.formatProtein( sequence.substring(d3.interval.start - 1, d3.interval.end), jump), Color.BLACK, cD3); } else { Utils.appendToPane(areaCompSeq, spaceInsert + lineInsert + Utils.formatProtein( sequence.substring(d3.interval.start - 1, d3.interval.end), jump), Color.BLACK, Color.WHITE); } } if (end.start <= end.end) { content = areaCompSeq.getText(); jump = content.length() - Utils.countChar(content, ' ') - Utils.countChar(content, '\n'); lastNewLineIndex = content.lastIndexOf('\n'); lastLineLength = content.substring(lastNewLineIndex + 1, content.length()).trim() .replaceAll("[\n]|[ ]", "").length(); spaceInsert = lastLineLength % 10 == 0 && lastLineLength % 60 != 0 && lastLineLength != 0 ? " " : ""; lineInsert = lastLineLength % 60 == 0 && lastLineLength != 0 ? "\n" : ""; Utils.appendToPane(areaCompSeq, spaceInsert + lineInsert + Utils.formatProtein(sequence.substring(end.start - 1, end.end), jump), Color.BLACK, Color.WHITE); } } } private void openDomainXRefLink(JLabel xrefLink) { String text = xrefLink.getText(); if (text.contains("CDD") && Desktop.isDesktopSupported()) { try { Desktop.getDesktop() .browse(new URI(String.format("http://www.ncbi.nlm.nih.gov/Structure/cdd/cddsrv.cgi?uid=%s", text.replace("CDD:", "")))); } catch (IOException | URISyntaxException exc) { Utils.showExceptionMessage(this, exc); } } } private void updateGUI() { String data = day + "/" + month + "/" + year + " - " + hour + ":" + minute + ":" + second + "hs"; fieldDateExtr.setText(data); fieldGrossAmount.setText(size); fieldProcessAmount.setText(String.valueOf(ctList.size())); } private void updateProteinList(boolean threeDomains, boolean threeDModels) { proteinListModel.setSize(0); int count = 0; for (CryToxin ct : ctList) { if (threeDomains && threeDModels) { if (ct.domains.size() == 3 && ct.proteinModels.size() > 0) { proteinListModel.addElement(ct); count++; } } else if (threeDomains) { if (ct.domains.size() == 3) { proteinListModel.addElement(ct); count++; } } else if (threeDModels) { if (ct.proteinModels.size() > 0) { proteinListModel.addElement(ct); count++; } } else { proteinListModel.addElement(ct); count++; } } lblProteinsFiltered.setText("Proteins Filtered: " + count); } private void updateDetails() { if (selectedCt != null) { selectedSeq = correspondenceTable.get(selectedCt); fieldName.setText(selectedCt.name); fieldAccNo.setText(selectedCt.accessionNo); fieldIdProt.setText(selectedCt.ncbiProtein); fieldIdNuc.setText(selectedCt.ncbiNucleotide); fieldAut.setText(selectedCt.authors); fieldYear.setText(selectedCt.year); fieldStrain.setText(selectedCt.sourceStrain); linkMainURL.setText(selectedCt.ncbiURL); areaCom.setText(selectedCt.comment); fieldLocus.setText(selectedSeq.getGBSeqLocus()); fieldLength.setText(selectedSeq.getGBSeqLength()); fieldType.setText(selectedSeq.getGBSeqMoltype()); fieldTopo.setText(selectedSeq.getGBSeqTopology()); fieldDivi.setText(selectedSeq.getGBSeqDivision()); fieldCre.setText(selectedSeq.getGBSeqCreateDate()); fieldDef.setText(selectedSeq.getGBSeqDefinition()); fieldPriAccess.setText(selectedSeq.getGBSeqPrimaryAccession()); fieldAccessVersion.setText(selectedSeq.getGBSeqAccessionVersion()); fieldSource.setText(selectedSeq.getGBSeqSource()); fieldOrg.setText(selectedSeq.getGBSeqOrganism()); fieldTaxo.setText(selectedSeq.getGBSeqTaxonomy()); fieldSDB.setText(selectedSeq.getGBSeqSourceDb()); StringBuilder sbk = new StringBuilder(); if (selectedSeq.getGBSeqKeywords() != null) { for (GBKeyword gk : selectedSeq.getGBSeqKeywords().getGBKeyword()) { sbk.append(gk.getvalue()).append(" "); } } fieldKey.setText(sbk.toString()); areaComment.setText(selectedSeq.getGBSeqComment()); referencesListModel.setSize(0); if (selectedSeq.getGBSeqReferences() != null && selectedSeq.getGBSeqReferences().getGBReference() != null) { for (GBReference ref : selectedSeq.getGBSeqReferences().getGBReference()) { referencesListModel.addElement(ref); } } fieldAutRef.setText(""); fieldTitRef.setText(""); fieldJournalRef.setText(""); linkURLPubmedRef.setText(" "); fillSequenceData(); BufferedImage img = Utils.generateProteinSchemeImage(selectedCt, true); lblScheme.setIcon(new ImageIcon(img)); // 3D model model3dListModel.clear(); for (String s : selectedCt.proteinModels) { model3dListModel.addElement(s); } fieldPDBId.setText(""); fieldPMDBId.setText(""); selectedPDBModel = null; linkRCSBEntry.setForeground(Color.BLACK); linkRCSBEntry.setCursor(null); for (MouseListener ml : linkRCSBEntry.getMouseListeners()) { linkRCSBEntry.removeMouseListener(ml); } } else { fieldName.setText(""); fieldAccNo.setText(""); fieldIdProt.setText(""); fieldIdNuc.setText(""); fieldAut.setText(""); fieldYear.setText(""); fieldStrain.setText(""); linkMainURL.setText(" "); areaCom.setText(""); fieldLocus.setText(""); fieldLength.setText(""); fieldType.setText(""); fieldTopo.setText(""); fieldDivi.setText(""); fieldCre.setText(""); fieldDef.setText(""); fieldPriAccess.setText(""); fieldAccessVersion.setText(""); fieldSource.setText(""); fieldOrg.setText(""); fieldTaxo.setText(""); fieldSDB.setText(""); fieldKey.setText(""); areaComment.setText(""); referencesListModel.setSize(0); fieldAutRef.setText(""); fieldTitRef.setText(""); fieldJournalRef.setText(""); linkURLPubmedRef.setText(" "); areaCompSeq.setText(""); Utils.appendToPane(areaCompSeq, "", Color.BLACK, Color.WHITE); fieldIntCompSeq.setText(""); fieldNameCompSeq.setText(""); areaD1.setText(""); fieldIntD1.setText(""); fieldNameD1.setText(""); fieldComD1.setText(""); linkXrefD1.setText(""); areaD2.setText(""); fieldIntD2.setText(""); fieldNameD2.setText(""); fieldComD2.setText(""); linkXrefD2.setText(""); areaD3.setText(""); fieldIntD3.setText(""); fieldNameD3.setText(""); fieldComD3.setText(""); linkXrefD3.setText(""); checkD1.setSelected(false); checkD2.setSelected(false); checkD3.setSelected(false); lblScheme.setIcon(null); // 3D models model3dListModel.clear(); fieldPDBId.setText(""); fieldPMDBId.setText(""); selectedPDBModel = null; linkRCSBEntry.setForeground(Color.BLACK); linkRCSBEntry.setCursor(null); for (MouseListener ml : linkRCSBEntry.getMouseListeners()) { linkRCSBEntry.removeMouseListener(ml); } } } private void fillSequenceData() { if (selectedSeq.getGBSeqSequence() != null) { String sequence = selectedCt.proteinSequence; //areaSeqComp.setText( Utils.formatProtein( sequence ) ); Utils.setTextToPane(areaCompSeq, Utils.formatProtein(sequence), Color.BLACK, Color.WHITE); fieldIntCompSeq.setText(selectedCt.proteinSequenceInterval); fieldNameCompSeq.setText(selectedCt.proteinSequenceName); if (selectedCt.domains.size() == 3) { areaD1.setText(Utils.formatProtein(selectedCt.getDomainSequence(1))); fieldIntD1.setText(selectedCt.getDomainInterval(1)); fieldNameD1.setText(selectedCt.getDomain(1).name); fieldComD1.setText(selectedCt.getDomain(1).note); linkXrefD1.setText(selectedCt.getDomain(1).xref); areaD2.setText(Utils.formatProtein(selectedCt.getDomainSequence(2))); fieldIntD2.setText(selectedCt.getDomainInterval(2)); fieldNameD2.setText(selectedCt.getDomain(2).name); fieldComD2.setText(selectedCt.getDomain(2).note); linkXrefD2.setText(selectedCt.getDomain(2).xref); areaD3.setText(Utils.formatProtein(selectedCt.getDomainSequence(3))); fieldIntD3.setText(selectedCt.getDomainInterval(3)); fieldNameD3.setText(selectedCt.getDomain(3).name); fieldComD3.setText(selectedCt.getDomain(3).note); linkXrefD3.setText(selectedCt.getDomain(3).xref); checkD1.setEnabled(true); checkD2.setEnabled(true); checkD3.setEnabled(true); } else { areaD1.setText(""); fieldIntD1.setText(""); fieldNameD1.setText(""); fieldComD1.setText(""); linkXrefD1.setText(""); areaD2.setText(""); fieldIntD2.setText(""); fieldNameD2.setText(""); fieldComD2.setText(""); linkXrefD2.setText(""); areaD3.setText(""); fieldIntD3.setText(""); fieldNameD3.setText(""); fieldComD3.setText(""); linkXrefD3.setText(""); checkD1.setEnabled(false); checkD2.setEnabled(false); checkD3.setEnabled(false); } if (checkD1.isSelected() || checkD2.isSelected() || checkD3.isSelected()) { fillCompleteSequenceTextPane(); } } } /** * Task to perform extraction (provides thread safety in Swing) */ private class ExtractionTask implements Runnable { JFrame frame; ExtractionTask(JFrame frame) { this.frame = frame; } @Override public void run() { try { btnExtract.setEnabled(false); btnLoad.setEnabled(false); btnAligment.setEnabled(false); btnColor.setEnabled(false); btnFASTA.setEnabled(false); lblWait.setText("Wait..."); Date d = new Date(); // getting data from BtNomenclature ctList = Utils.getCryToxinList(); String cryDataFilePath = "temp/cryData"; String sequenceDataFilePath = "temp/sequenceData"; String dataFileSufix = String.format("-%tY-%tm-%td-(%tH-%tM-%tS)-size=%d.xml", d, d, d, d, d, d, ctList.size()); cryDataFilePath += dataFileSufix; sequenceDataFilePath += dataFileSufix; File cryDataFile = new File(cryDataFilePath); File sequenceDataFile = new File(sequenceDataFilePath); // serializing cry data from BtNomenclature CryToxinSet ctSet = new CryToxinSet(); ctSet.cryToxins = ctList; Serializer ser = new Persister(); ser.write(ctSet, cryDataFile); // getting and serializing data from NCBI StringBuilder sbIds = new StringBuilder(); for (CryToxin ct : ctList) { sbIds.append(ct.ncbiProtein).append(","); } String ids = sbIds.toString(); String completeData = Utils.getDataFromHttpsRequestViaPost( "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi", "tool=crygetter&email=davidbuzatto@ifsp.edu.br&db=protein&retmode=xml&id=" + ids.substring(0, ids.length() - 1)); try (FileWriter fw = new FileWriter(sequenceDataFile)) { fw.write(completeData); } // saving the files with zip JFileChooser jfc = new JFileChooser(); FileNameExtensionFilter fnef = new FileNameExtensionFilter("CryGetter Extraction (*.cgext)", "cgext"); for (FileFilter f : jfc.getChoosableFileFilters()) { jfc.removeChoosableFileFilter(f); } jfc.setFileFilter(fnef); jfc.setDialogTitle("Save Extracted Data"); jfc.setFileSelectionMode(JFileChooser.FILES_ONLY); jfc.setMultiSelectionEnabled(false); if (jfc.showSaveDialog(frame) == JFileChooser.APPROVE_OPTION) { File f = jfc.getSelectedFile(); if (f.getName().lastIndexOf(".cgext") == -1) { f = new File(f.getAbsolutePath() + ".cgext"); } if (!f.exists() || (f.exists() && JOptionPane.showConfirmDialog(frame, "The file already exists. Do you want to overwrite it?", "Warning", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION)) { Utils.zip(f, cryDataFile, sequenceDataFile); } } // deleting generated files cryDataFile.delete(); sequenceDataFile.delete(); } catch (Exception exc) { Utils.showExceptionMessage(frame, exc); } finally { btnExtract.setEnabled(true); btnLoad.setEnabled(true); btnAligment.setEnabled(true); btnColor.setEnabled(true); btnFASTA.setEnabled(true); lblWait.setText(" "); } } } /** * Task to perform package loading extraction (provides thread safety in Swing) */ private class LoadTask implements Runnable { JFrame frame; File fileToOpen; LoadTask(JFrame frame, File fileToOpen) { this.frame = frame; this.fileToOpen = fileToOpen; } @Override public void run() { try { btnExtract.setEnabled(false); btnLoad.setEnabled(false); btnAligment.setEnabled(false); btnColor.setEnabled(false); btnFASTA.setEnabled(false); lblWait.setText("Wait..."); selectedCt = null; selectedSeq = null; updateDetails(); // processing List<File> unzippedFiles = Utils.unzip(fileToOpen); String name = ""; GBSet gb = null; List<CryToxin> ctl = null; ctList = new ArrayList<>(); gbSeqList = new ArrayList<>(); correspondenceTable = new LinkedHashMap<>(); // processing unzipped files and loading // raw data for (File f : unzippedFiles) { name = f.getName(); if (name.startsWith("sequenceData")) { gb = Utils.getGBSet(f); } else if (name.startsWith("cryData")) { Serializer serializer = new Persister(); CryToxinSet ctSet = serializer.read(CryToxinSet.class, f); ctl = ctSet.cryToxins; } f.delete(); } // extrating date and time data from file name Pattern p = Pattern .compile("(\\d{4})-(\\d{2})-(\\d{2})-[(](\\d{2})-(\\d{2})-(\\d{2})[)]-size=(\\d+)[.]xml"); name = name.replace("cryData-", "").replace("sequenceData-", ""); Matcher m = p.matcher(name); if (m.matches()) { year = m.group(1); month = m.group(2); day = m.group(3); hour = m.group(4); minute = m.group(5); second = m.group(6); size = m.group(7); } // removing duplicates // the duplicate test used is the equality between acession numbers // from cry toxin list and primary acession from NCBI data. // accept only proteins with the correct nomenclature (Cry\d+\w{2}\d+) Map<String, String> noDuplicatesMap = new HashMap<>(); for (CryToxin ct : ctl) { for (GBSeq seq : gb.getGBSeq()) { if (ct.accessionNo.equals(seq.getGBSeqPrimaryAccession())) { if (!noDuplicatesMap.containsKey(ct.accessionNo) && ct.name.matches("Cry\\d+[A-Z][a-z]\\d*")) { correspondenceTable.put(ct, seq); } } } } // processing domains List<CryToxin> toxinsToRemove = new ArrayList<>(); for (Entry<CryToxin, GBSeq> e : correspondenceTable.entrySet()) { int cDom = 0; CryToxin ct = e.getKey(); for (GBFeature feat : e.getValue().getGBSeqFeatureTable().getGBFeature()) { if (feat.getGBFeatureKey().equalsIgnoreCase("protein")) { ct.proteinSequenceInterval = feat.getGBFeatureLocation(); for (GBQualifier q : feat.getGBFeatureQuals().getGBQualifier()) { if (q.getGBQualifierName().equalsIgnoreCase("name")) { ct.proteinSequenceName = q.getGBQualifierValue(); } } } else if (feat.getGBFeatureKey().equalsIgnoreCase("region")) { if (cDom < 3) { // guarantee String[] pInt = feat.getGBFeatureLocation().split("[.][.]"); CryToxinDomain domain = new CryToxinDomain(); SequenceInterval seqInt = new SequenceInterval(); domain.interval = seqInt; for (GBQualifier q : feat.getGBFeatureQuals().getGBQualifier()) { if (q.getGBQualifierName().equalsIgnoreCase("region_name")) { domain.name = q.getGBQualifierValue(); } else if (q.getGBQualifierName().equalsIgnoreCase("note")) { domain.note = q.getGBQualifierValue(); } else if (q.getGBQualifierName().equalsIgnoreCase("db_xref")) { domain.xref = q.getGBQualifierValue(); } } try { seqInt.start = Integer.parseInt(pInt[0]); seqInt.end = Integer.parseInt(pInt[1]); ct.domains.add(domain); cDom++; } catch (NumberFormatException exc) { // malformed domain } } } } } // 1 - populating the lists of cry toxins and gbseqs, // 2 - setting the proteinSequence from gbseq to cry toxin and // 3 - adding the affected orders // 4 - adding models //File[] files = new File( getClass().getResource( "/" ).toURI() ).listFiles(); File[] files = new File("./cryModels").listFiles(); for (Entry<CryToxin, GBSeq> e : correspondenceTable.entrySet()) { CryToxin ct = e.getKey(); e.getKey().proteinSequence = e.getValue().getGBSeqSequence().toUpperCase(); ctList.add(ct); // 1 gbSeqList.add(e.getValue()); // 2 // 3 for (Entry<String, List<String>> eo : cryOrderData.entrySet()) { for (String affectedToxinName : eo.getValue()) { if (ct.name.startsWith(affectedToxinName)) { ct.addAffectedOrder(eo.getKey()); } } } // 4 List<String> models = new ArrayList<>(); for (File f : files) { if (f.getName().startsWith(ct.name)) { models.add(f.getName()); } } ct.proteinModels = models; } filter(); } catch (Exception exc) { Utils.showExceptionMessage(frame, exc); } finally { btnExtract.setEnabled(true); btnLoad.setEnabled(true); btnAligment.setEnabled(true); btnColor.setEnabled(true); btnFASTA.setEnabled(true); lblWait.setText(" "); } } } /** * Task to perform FASTA file generation from protein data. */ private class GenerateFASTATask implements Runnable { JFrame frame; File whereToWrite; GenerateFASTATask(JFrame frame, File whereToWrite) { this.frame = frame; this.whereToWrite = whereToWrite; } @Override public void run() { try { btnExtract.setEnabled(false); btnLoad.setEnabled(false); btnAligment.setEnabled(false); btnColor.setEnabled(false); btnFASTA.setEnabled(false); lblWait.setText("Wait..."); if (whereToWrite.exists()) { Utils.recursiveDelete(whereToWrite); } whereToWrite.mkdir(); for (CryToxin ct : ctList) { File ctDir = new File(whereToWrite.getPath() + "/" + ct.name); ctDir.mkdir(); FileWriter fwComplete = new FileWriter( new File(ctDir.getPath() + "/" + ct.name + "-Complete.fasta")); fwComplete.write(Utils.formatAsFasta(ct.name + " - Complete", ct.proteinSequence, 60)); fwComplete.close(); if (ct.domains.size() == 3) { FileWriter fwD1 = new FileWriter(new File(ctDir.getPath() + "/" + ct.name + "-D1.fasta")); fwD1.write(Utils.formatAsFasta(ct.name + " - Domain 1", ct.getDomainSequence(1), 60)); fwD1.close(); FileWriter fwD2 = new FileWriter(new File(ctDir.getPath() + "/" + ct.name + "-D2.fasta")); fwD2.write(Utils.formatAsFasta(ct.name + " - Domain 2", ct.getDomainSequence(2), 60)); fwD2.close(); FileWriter fwD3 = new FileWriter(new File(ctDir.getPath() + "/" + ct.name + "-D3.fasta")); fwD3.write(Utils.formatAsFasta(ct.name + " - Domain 3", ct.getDomainSequence(3), 60)); fwD3.close(); } } JOptionPane.showMessageDialog(frame, "FASTA files generated successfully at\n" + whereToWrite.getPath(), "Information", JOptionPane.INFORMATION_MESSAGE); } catch (IOException exc) { Utils.showExceptionMessage(frame, exc); } finally { btnExtract.setEnabled(true); btnLoad.setEnabled(true); btnAligment.setEnabled(true); btnColor.setEnabled(true); btnFASTA.setEnabled(true); lblWait.setText(" "); } } } /** * Loads Cry Data (order affect) */ private void loadCryData() { try { Workbook wb = WorkbookFactory.create(getClass().getResourceAsStream("/cryData.xlsx")); Sheet sheet = wb.getSheetAt(0); Row orderNameRow = sheet.getRow(1); cryOrderData = new LinkedHashMap<>(); for (int i = 2;; i++) { Cell orderNameCell = orderNameRow.getCell(i); if (orderNameCell != null) { List<String> affectList = new ArrayList<>(); for (int j = 2;; j++) { Row orderValueRow = sheet.getRow(j); if (orderValueRow != null) { Cell cryValueCell = orderValueRow.getCell(1); Cell orderValueCell = orderValueRow.getCell(i); if (orderValueCell != null && !orderValueCell.getStringCellValue().equals("")) { String value = orderValueCell.getStringCellValue(); if (value.equals("A") || value.equals("P")) { affectList.add("Cry" + cryValueCell.getStringCellValue()); } } } else { break; } } if (!affectList.isEmpty()) { cryOrderData.put(orderNameCell.getStringCellValue(), affectList); } } else { break; } } } catch (IOException | InvalidFormatException exc) { Utils.showExceptionMessage(this, exc); } } /** * Loads Amino Acid Data */ private void loadAAData() { try { Workbook wb = WorkbookFactory.create(getClass().getResourceAsStream("/aaData.xlsx")); Sheet sheet = wb.getSheetAt(0); aaData = new LinkedHashMap<>(); for (int i = 1;; i++) { Row aaDataRow = sheet.getRow(i); if (aaDataRow != null) { String name = aaDataRow.getCell(0).getStringCellValue(); String threeLetter = aaDataRow.getCell(1).getStringCellValue(); String oneLetter = aaDataRow.getCell(2).getStringCellValue(); String group = aaDataRow.getCell(3).getStringCellValue(); String sideChainGroup = aaDataRow.getCell(4).getStringCellValue(); String sideChainPolarity = aaDataRow.getCell(5).getStringCellValue(); String sideChainCharge = aaDataRow.getCell(6).getStringCellValue(); String hydropathyIndex = aaDataRow.getCell(7).getStringCellValue(); String molecularMass = aaDataRow.getCell(8).getStringCellValue(); String vanderWaalsVolume = aaDataRow.getCell(9).getStringCellValue(); String frequencyInProteins = aaDataRow.getCell(10).getStringCellValue(); String surfaceArea = aaDataRow.getCell(11).getStringCellValue(); String[] observations = aaDataRow.getCell(12).getStringCellValue().split("[$]"); AminoAcid aa = new AminoAcid(); aa.name = name; aa.threeLetter = threeLetter; aa.oneLetter = oneLetter; aa.group = group; aa.sideChainGroup = sideChainGroup; aa.sideChainPolarity = sideChainPolarity; aa.sideChainCharge = sideChainCharge; aa.hydropathyIndex = hydropathyIndex; aa.molecularMass = molecularMass; aa.vanderWaalsVolume = vanderWaalsVolume; aa.frequencyInProteins = frequencyInProteins; aa.surfaceArea = surfaceArea; aa.observations.addAll(Arrays.asList(observations)); aa.pdbFile = "/" + threeLetter.toLowerCase() + ".pdb"; aa.pngFile = "/" + threeLetter.toLowerCase() + ".png"; aaData.put(oneLetter, aa); } else { break; } } } catch (IOException | InvalidFormatException exc) { Utils.showExceptionMessage(this, exc); } } public Map<String, AminoAcid> getAAData() { return aaData; } private void filter() { updateProteinColors(); updateGUI(); updateProteinList(check3Domains.isSelected(), check3DModels.isSelected()); } /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new MainWindow().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextArea areaCom; private javax.swing.JTextArea areaComment; private javax.swing.JTextPane areaCompSeq; private javax.swing.JTextArea areaD1; private javax.swing.JTextArea areaD2; private javax.swing.JTextArea areaD3; private javax.swing.JButton btnAbout; private javax.swing.JButton btnAboutProc; private javax.swing.JButton btnAligment; private javax.swing.JButton btnColor; private javax.swing.JButton btnExtract; private javax.swing.JButton btnFASTA; private javax.swing.JButton btnLoad; private javax.swing.JButton btnSavePDB; private javax.swing.JCheckBox check3DModels; private javax.swing.JCheckBox check3Domains; private javax.swing.JCheckBox checkD1; private javax.swing.JCheckBox checkD2; private javax.swing.JCheckBox checkD3; private javax.swing.JTextField fieldAccNo; private javax.swing.JTextField fieldAccessVersion; private javax.swing.JTextField fieldAut; private javax.swing.JTextField fieldAutRef; private javax.swing.JTextField fieldComD1; private javax.swing.JTextField fieldComD2; private javax.swing.JTextField fieldComD3; private javax.swing.JTextField fieldCre; private javax.swing.JTextField fieldDateExtr; private javax.swing.JTextField fieldDef; private javax.swing.JTextField fieldDivi; private javax.swing.JTextField fieldGrossAmount; private javax.swing.JTextField fieldIdNuc; private javax.swing.JTextField fieldIdProt; private javax.swing.JTextField fieldIntCompSeq; private javax.swing.JTextField fieldIntD1; private javax.swing.JTextField fieldIntD2; private javax.swing.JTextField fieldIntD3; private javax.swing.JTextField fieldJournalRef; private javax.swing.JTextField fieldKey; private javax.swing.JTextField fieldLength; private javax.swing.JTextField fieldLocus; private javax.swing.JTextField fieldName; private javax.swing.JTextField fieldNameCompSeq; private javax.swing.JTextField fieldNameD1; private javax.swing.JTextField fieldNameD2; private javax.swing.JTextField fieldNameD3; private javax.swing.JTextField fieldOrg; private javax.swing.JTextField fieldPDBId; private javax.swing.JTextField fieldPMDBId; private javax.swing.JTextField fieldPriAccess; private javax.swing.JTextField fieldProcessAmount; private javax.swing.JTextField fieldSDB; private javax.swing.JTextField fieldSource; private javax.swing.JTextField fieldStrain; private javax.swing.JTextField fieldTaxo; private javax.swing.JTextField fieldTitRef; private javax.swing.JTextField fieldTopo; private javax.swing.JTextField fieldType; private javax.swing.JTextField fieldYear; private javax.swing.JLabel labelDateExtr; private javax.swing.JLabel labelGrossAmount; private javax.swing.JLabel labelProcessAmount; private javax.swing.JLabel lblAccNo; private javax.swing.JLabel lblAccessVersion; private javax.swing.JLabel lblAut; private javax.swing.JLabel lblAutRef; private javax.swing.JLabel lblCom; private javax.swing.JLabel lblComD1; private javax.swing.JLabel lblComD2; private javax.swing.JLabel lblComD3; private javax.swing.JLabel lblComment; private javax.swing.JLabel lblCre; private javax.swing.JLabel lblDef; private javax.swing.JLabel lblDivi; private javax.swing.JLabel lblIdNuc; private javax.swing.JLabel lblIdProt; private javax.swing.JLabel lblIntCompSeq; private javax.swing.JLabel lblIntD1; private javax.swing.JLabel lblIntD2; private javax.swing.JLabel lblIntD3; private javax.swing.JLabel lblJournalRef; private javax.swing.JLabel lblKey; private javax.swing.JLabel lblLength; private javax.swing.JLabel lblLocus; private javax.swing.JLabel lblMainURL; private javax.swing.JLabel lblName; private javax.swing.JLabel lblNameCompSeq; private javax.swing.JLabel lblNameD1; private javax.swing.JLabel lblNameD2; private javax.swing.JLabel lblOrg; private javax.swing.JLabel lblPDBId; private javax.swing.JLabel lblPMDBId; private javax.swing.JLabel lblPriAccess; private javax.swing.JLabel lblProteinsFiltered; private javax.swing.JLabel lblSDB; private javax.swing.JLabel lblScheme; private javax.swing.JLabel lblSource; private javax.swing.JLabel lblStrain; private javax.swing.JLabel lblTaxo; private javax.swing.JLabel lblTitRef; private javax.swing.JLabel lblTopo; private javax.swing.JLabel lblType; private javax.swing.JLabel lblURLPubmedRef; private javax.swing.JLabel lblWait; private javax.swing.JLabel lblXrefD1; private javax.swing.JLabel lblXrefD2; private javax.swing.JLabel lblXrefD3; private javax.swing.JLabel lblYear; private javax.swing.JLabel ldlNameD3; private javax.swing.JLabel linkMainURL; private javax.swing.JLabel linkRCSBEntry; private javax.swing.JLabel linkURLPubmedRef; private javax.swing.JLabel linkXrefD1; private javax.swing.JLabel linkXrefD2; private javax.swing.JLabel linkXrefD3; private javax.swing.JList list3DModels; private javax.swing.JList<CryToxin> listProteins; private javax.swing.JList listRef; private javax.swing.JPanel painel3D; private javax.swing.JPanel painelAvailable3DModels; private javax.swing.JPanel painelMisc; private javax.swing.JPanel painelNCBI; private javax.swing.JPanel panelBtData; private javax.swing.JPanel panelCompleteSequence; private javax.swing.JPanel panelD1; private javax.swing.JPanel panelD2; private javax.swing.JPanel panelD3; private javax.swing.JPanel panelDetails; private javax.swing.JPanel panelExtractionDetails; private javax.swing.JPanel panelMain01; private javax.swing.JPanel panelMain02; private javax.swing.JPanel panelMainNCBI; private javax.swing.JPanel panelNCBIRef; private javax.swing.JPanel panelNCBISeq; private javax.swing.JPanel panelProteins; private javax.swing.JPanel panelRefDetails; private javax.swing.JPanel panelRefList; private javax.swing.JScrollPane scrollList3DModels; private javax.swing.JScrollPane scrollProteins; private javax.swing.JScrollPane spCom; private javax.swing.JScrollPane spComment; private javax.swing.JScrollPane spCompSeq; private javax.swing.JScrollPane spD1; private javax.swing.JScrollPane spD2; private javax.swing.JScrollPane spD3; private javax.swing.JScrollPane spRefList; private javax.swing.JTabbedPane tabsDetails; private javax.swing.JTabbedPane tabsNCBIDetails; private javax.swing.JTabbedPane tabsNCBISequences; // End of variables declaration//GEN-END:variables }