⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 buildjembossform.java

📁 emboss的linux版本的源代码
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
  public void actionPerformed(ActionEvent ae)  {    String line;    if( ae.getActionCommand().startsWith("Advanced Option"))    {      if(advSectionBox != null)        advSectionBox.setVisible(!advSectionBox.isVisible());      if(addSectionBox != null)        addSectionBox.setVisible(!addSectionBox.isVisible());      p2.setVisible(false);      p2.setVisible(true);    }    else if ( ae.getActionCommand().startsWith("GO"))    {      f.setCursor(cbusy);      if(!withSoap)      {        Hashtable filesToMove = new Hashtable();        String embossCommand = getCommand(filesToMove);//      String embossCommand = getCommand();        if(!embossCommand.equals("NOT OK"))        {          if(mysettings.getCurrentMode().equals("batch"))          {            BatchSoapProcess bsp = new BatchSoapProcess(embossCommand,filesToMove,mysettings);            bsp.setWithSoap(false);            bsp.start();          }          else          {            JembossServer js = new JembossServer(mysettings.getResultsHome());            Vector result = js.run_prog(embossCommand, mysettings.getCurrentMode(),                                         filesToMove);            new ShowResultSet(convert(result,false),filesToMove,mysettings);          }        }      }      else      {        Hashtable filesToMove = new Hashtable();        String embossCommand = getCommand(filesToMove);        if(!embossCommand.equals("NOT OK"))        {          if (mysettings.getUseAuth() == true)            if (mysettings.getServiceUserName() == null)              System.out.println("OOPS! Authentication required!");          try          {            if(mysettings.getCurrentMode().equals("batch"))            {              BatchSoapProcess bsp = new BatchSoapProcess(embossCommand,filesToMove,mysettings);              bsp.start();            }            else            {              JembossRun thisrun = new JembossRun(embossCommand,"",                                           filesToMove,mysettings);              new ShowResultSet(thisrun.hash(),filesToMove,mysettings);            }          }          catch (JembossSoapException eae)          {            AuthPopup ap = new AuthPopup(mysettings,f);            ap.setBottomPanel();            ap.setSize(380,170);            ap.pack();            ap.setVisible(true);            f.setCursor(cdone);          }        }      }      f.setCursor(cdone);    }    else if( ae.getActionCommand().startsWith("Show Alignment"))    {       org.emboss.jemboss.editor.AlignJFrame ajFrame =               new org.emboss.jemboss.editor.AlignJFrame(new File(seqoutResult));       ajFrame.setVisible(true);    }  }  public static Hashtable convert(Vector vans, boolean keepStatus)  {    Hashtable proganswer = new Hashtable();    // assumes it's even sized    int n = vans.size();    for(int j=0;j<n;j+=2)    {      String s = (String)vans.get(j);      if(s.equals("msg"))      {        String msg = (String)vans.get(j+1);        if(msg.startsWith("Error"))          JOptionPane.showMessageDialog(null, msg, "alert",                                JOptionPane.ERROR_MESSAGE);      }      else if(keepStatus || !s.equals("status"))        proganswer.put(s,vans.get(j+1));    }    return proganswer;  }  /**  *  * Show standalone results in a tabbed pane.  *  */  private void showStandaloneResults(String stdout)  {    final JFrame res = new JFrame(applName + " Results  : " + seqoutResult);    res.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);    final JTabbedPane fresults = new JTabbedPane();    res.getContentPane().add(fresults,BorderLayout.CENTER);    Hashtable hashRes = new Hashtable();    Dimension d = res.getToolkit().getScreenSize();    res.setSize((int)d.getWidth()/2,(int)d.getHeight()/2);    JPanel presults;    ScrollPanel pscroll;    JScrollPane rscroll;    if(!stdout.equals("") &&       !(stdout.startsWith("Created") && (stdout.endsWith(".png") || stdout.endsWith(".dat")) ))    {      presults = new JPanel(new BorderLayout());      pscroll = new ScrollPanel(new BorderLayout());      rscroll = new JScrollPane(pscroll);      rscroll.getViewport().setBackground(Color.white);      presults.add(rscroll, BorderLayout.CENTER);      JTextPane atext = new JTextPane();      atext.setText(stdout);      atext.setFont(new Font("monospaced", Font.PLAIN, 12));      pscroll.add(atext, BorderLayout.CENTER);      atext.setCaretPosition(0);      fresults.add(applName+" output",presults);      hashRes.put(applName+" output",stdout);    }    boolean seenGraphs = false;    for(int j=0;j<numofFields;j++)    {      presults = new JPanel(new BorderLayout());      pscroll = new ScrollPanel(new BorderLayout());      rscroll = new JScrollPane(pscroll);      rscroll.getViewport().setBackground(Color.white);      presults.add(rscroll, BorderLayout.CENTER);      if(parseAcd.isOutputSequence(j) || parseAcd.isOutputFile(j))      {        try        {          String name = null;          if(parseAcd.isOutputSequence(j))            name = seqoutResult;          else            name = outfileResult;          StringBuffer text = new StringBuffer();          BufferedReader in = new BufferedReader(new FileReader(name));          String line = null;          while((line = in.readLine()) != null)            text = text.append(line + "\n");          in.close();          String txt = text.toString();          JTextPane seqText = new JTextPane();          seqText.setText(txt);          seqText.setFont(new Font("monospaced", Font.PLAIN, 12));          pscroll.add(seqText, BorderLayout.CENTER);          seqText.setCaretPosition(0);          fresults.add(name,presults);          hashRes.put(name,txt);        }        catch (IOException ioe)        {          if(mysettings.getDebug())            System.out.println("Failed to open sequence file " + seqoutResult);        }      }      else if(parseAcd.isOutputGraph(j) && !seenGraphs)      {        seenGraphs = true;        File cwdFile = new File(cwd);        String pngFiles[] = cwdFile.list(new FilenameFilter()        {          public boolean accept(File cwd, String name)          {            if(name.endsWith(".png") || name.endsWith(".dat"))              return name.startsWith(applName);            else              return false;          };        });        Arrays.sort(pngFiles, new NameComparator());        for(int i=0;i<pngFiles.length;i++)        {          if(pngFiles[i].endsWith(".dat"))          {            Graph2DPlot gp = new Graph2DPlot();            rscroll = new JScrollPane(gp);            rscroll.getViewport().setBackground(Color.white);                     gp.setFileData(new String((byte [])getLocalFile(new File(pngFiles[i]))),                           pngFiles[i]);            fresults.add(pngFiles[i],rscroll);//          setJMenuBar(gp.getMenuBar(false, this));          }          else          {            presults = new JPanel(new BorderLayout());            pscroll  = new ScrollPanel(new BorderLayout());            rscroll  = new JScrollPane(pscroll);            rscroll.getViewport().setBackground(Color.white);            presults.add(rscroll, BorderLayout.CENTER);            byte pngContents[] = getLocalFile(new File(pngFiles[i]));            ImageIcon icon = new ImageIcon(pngContents);            JLabel picture = new JLabel(icon);            pscroll.add(picture);            fresults.add(pngFiles[i],presults);            hashRes.put(pngFiles[i],pngContents);          }        }      }    }    final ResultsMenuBar menubar = new ResultsMenuBar(res,fresults,hashRes,mysettings);     fresults.addChangeListener(new ChangeListener()    {      public void stateChanged(ChangeEvent e)      {        setJMenuBar(fresults,res,menubar);      }    });    setJMenuBar(fresults,res,menubar);    res.setVisible(true);  }  /**  *  * Set the menu bar based on the title of the  * tabbed pane  *  */  private void setJMenuBar(JTabbedPane fresults, JFrame res, ResultsMenuBar menuBar)  {    int index = fresults.getSelectedIndex();    String title = fresults.getTitleAt(index);        if(title.endsWith(".dat"))    {      Graph2DPlot graph = getGraph2DPlot((JScrollPane)fresults.getSelectedComponent());      if(graph == null)        return;      JMenuBar graphMenuBar = graph.getMenuBar(false, res);      res.setJMenuBar(graphMenuBar);    }    else      res.setJMenuBar(menuBar);  }  /**  *  * Locate the Graph2DPlot component in the scrollpane  *  */  private Graph2DPlot getGraph2DPlot(JScrollPane jsp)  {    Component comp = jsp.getViewport().getView();    if(comp instanceof Graph2DPlot)        return (Graph2DPlot)comp;      return null;  }  private String checkParameters(ParseAcd parseAcd, int numofFields,                                  Hashtable filesToMove)  {    String params = new String("");    String appN = "";    String file = "";    String options = "";    String fn = "";    String sfn;     seqoutResult   = "";    outfileResult  = "";       for(int j=0;j<numofFields;j++)    {      String att = parseAcd.getParameterAttribute(j,0).toLowerCase();      String val = parseAcd.getParamValueStr(j,0).toLowerCase();      int h = parseAcd.getGuiHandleNumber(j);      if(att.startsWith("appl"))        appN = new String(att);      else if (parseAcd.isOutputGraph(j))      {        if(graphics == null)          System.out.println("graphics is NULL");        if(((String)graphics.getSelectedItem()).equals("PNG") )           options = options.concat(" -" + val + " png");        else          options = options.concat(" -" + val + " data");      }      if ( att.startsWith("dirlist") || att.startsWith("featout") ||           att.startsWith("string")  || att.startsWith("seqout")  ||           att.startsWith("outfile") || att.startsWith("codon")   ||           att.startsWith("regexp")  )      {        if(!(textf[h].getText()).equals("") && textf[h].isVisible()                                            && textf[h].isEnabled())         {          options = options.concat(" -" + val + " " + textf[h].getText());          if(att.startsWith("seqout"))            seqoutResult = textf[h].getText();          else if(att.startsWith("outfile"))            outfileResult = textf[h].getText();;        }        else if(!withSoap && applName.equals("emma") && att.startsWith("seqoutset"))        {          options = options.concat(" -" + val + " emma.aln ");           seqoutResult = "emma.aln";        }        if(att.startsWith("seqout"))          options = options.concat(outSeqAttr.getOuputSeqAttr());      }      else if ( att.startsWith("pattern") )      {        JTextField textFields[] = multiTextField[h].getJTextField();                if(textFields[0].getText() != null && !textFields[0].getText().trim().equals(""))          options = options.concat(" -" + val + " " + textFields[0].getText());                if(textFields[1].getText() != null && !textFields[1].getText().trim().equals(""))          options = options.concat(" -pmismatch " + textFields[1].getText());      }      else if ( att.startsWith("int") )      {        if( (textInt[h].getText() != null) && textInt[h].isVisible()                                           && textInt[h].isEnabled())          options = options.concat(" -" + val + " " + textInt[h].getValue());      }      else if ( att.startsWith("float") )      {        if( (textFloat[h].getText() != null) && textFloat[h].isVisible()                                             && textFloat[h].isEnabled())          options = options.concat(" -" + val + " " + textFloat[h].getValue());      }      else if ( att.startsWith("select") )         {        double max = 1.;        if(parseAcd.isMaxParamValue(j))          max = Double.parseDouble(parseAcd.getMaxParam(j));                                                            //defined by a number        if(max > 1.0 && multiOption[h].isVisible()                     && multiOption[h].isEnabled())         //multi selection        {          int sel[] = multiOption[h].getSelectedIndices();          options = options.concat(" -" + val + " ");          for(int i=0;i<sel.length;i++)          {            options = options.concat(Integer.toString(sel[i]+1));            if(i<sel.length-1)              options = options.concat(",");          }        }        else if (fieldOption[h].isVisible() && fieldOption[h].isEnabled())          options = options.concat(" -" + val + " " +        //single selection                    (fieldOption[h].getSelectedIndex()+1));      }      else if ( att.startsWith("list") )          {        double max = 1.;        if(parseAcd.isMaxParamValue(j))          max = Double.parseDouble(parseAcd.getMaxParam(j));                                                             //defined by a label        if(max > 1.0 && multiOption[h].isVisible()                     && multiOption[h].isEnabled())          //multi selection        {          int sel[] = multiOption[h].getSelectedIndices();          options = options.concat(" -" + val + " ");          for(int i=0;i<sel.length;i++)          {            options = options.concat(parseAcd.getListLabel(j,sel[i]));            if(i<sel.length-1)              options = options.concat(",");          }        }        else if (fieldOption[h].isVisible()               && fieldOption[h].isEnabled())        {          int index = fieldOption[h].getSelectedIndex();     //single selection          options = options.concat(" -" + val + " " +                       parseAcd.getListLabel(j,index));        }      }      else if ( att.startsWith("report") )      {        options = options.concat(rf.getReportFormat());      }      else if ( att.startsWith("align") )      {        options = options.concat(af.getAlignFormat());      }      else if ( att.startsWith("bool") && checkBox[h].isVisible()                                       && checkBox[h].isEnabled())      {        if( checkBox[h].isSelected() )          options = options.concat(" -" + val + " ");        else          options = options.concat(" -no" + val + " ");      }      else if( att.startsWith("range") && rangeField[h].isVisible()                                       && rangeField[h].isEnabled() )      {        if( !rangeField[h].getText().equals("") )        {          String rangeText = rangeField[h].getText();          int blank;             //remove spaces from the range (not sure if this is           //a good idea in all cases)!          while ((blank = rangeText.indexOf(" ")) > -1)          {            String rangePrefix = rangeText.substring(0,blank);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -