Skip to content
Snippets Groups Projects
Commit d4fae968 authored by tjc's avatar tjc
Browse files

update

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@1839 ee4ac58c-ac51-4696-9907-e4b3aa274f04
parent 3cddabf4
No related branches found
No related tags found
No related merge requests found
......@@ -46,6 +46,7 @@ public class BigPane extends JFrame
protected static JCheckBoxMenuItem srsWin;
protected static JInternalFrame srsFrame;
private JTextArea qualifier;
private DataViewInternalFrame dataView;
public BigPane(Object dataFile[], JTextArea qualifier)
{
......@@ -76,21 +77,27 @@ public class BigPane extends JFrame
// data set
int hgt = getHeight()-60;
int wid = getWidth()-100;
DataViewInternalFrame dataView = new DataViewInternalFrame(dataFile,desktop,
dataView = new DataViewInternalFrame(dataFile,desktop,
wid,qualifier_txt);
dataView.setLocation(50,0);
dataView.setSize(wid,hgt);
dataView.setVisible(true);
desktop.add(dataView);
JMenuBar menuBar = createMenuBar(desktop,dataView);
JMenuBar menuBar = createMenuBar(desktop);
setJMenuBar(menuBar);
setVisible(true);
}
private JMenuBar createMenuBar(final JDesktopPane desktop,
final DataViewInternalFrame dataView)
/**
*
* Create a menu bar.
* @param desktop pane.
* @return menu bar.
*
*/
private JMenuBar createMenuBar(final JDesktopPane desktop)
{
JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("File");
......@@ -107,6 +114,16 @@ public class BigPane extends JFrame
fileMenu.add(reReadMenu);
fileMenu.add(new JSeparator());
JMenuItem applyMenu = new JMenuItem("Apply to Feature Editor");
applyMenu.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
qualifier.setText(dataView.getFeatureText());
}
});
fileMenu.add(applyMenu);
fileMenu.add(new JSeparator());
//
JMenuItem exitMenu = new JMenuItem("Close");
exitMenu.addActionListener(new ActionListener()
......@@ -167,11 +184,14 @@ public class BigPane extends JFrame
buttGroup.add(liveDrag);
buttGroup.add(outlineDrag);
return menuBar;
}
/**
*
* Set up the tabbed SRS frame
*
*/
protected static void setUpSRSFrame(int hgt, JDesktopPane desktop)
{
BigPane.srsFrame = new JInternalFrame("SRS",
......@@ -214,7 +234,13 @@ public class BigPane extends JFrame
{
public void windowClosing(WindowEvent we)
{
if(qualifier == null)
System.exit(0);
qualifier.setText(dataView.getFeatureText());
BigPane.srsFrame = null;
dispose();
}
}
......
......@@ -275,7 +275,31 @@ public class DataCollectionPane extends JScrollPane
{
final String go_id = ((String)gov_enum.nextElement()).trim();
bacross = Box.createHorizontalBox();
JButton goButton = new JButton("GO:"+go_id);
final JCheckBox goBox = new JCheckBox();
goBox.setSelected(false);
goBox.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
if(goBox.isSelected())
{
String go_term = hit.getGoAssociation(go_id);
if(go_term == null)
{
go_term = setGoAnnotation(ann,hit.getAcc(),go_id);
hit.setGoAssociation(go_id,go_term);
}
else
ann.insert(go_term,false);
}
else
ann.delete(go_id,false);
}
});
goBox.setMargin(new Insets(0,1,0,1));
MouseOverButton goButton = new MouseOverButton("GO:"+go_id);
goButton.setFont(BigPane.font);
goButton.addActionListener(new ActionListener()
{
......@@ -306,7 +330,12 @@ public class DataCollectionPane extends JScrollPane
}
});
goButton.setForeground(Color.blue);
goButton.setMargin(new Insets(1,1,1,1));
goButton.setBorderPainted(false);
bacross.add(Box.createHorizontalStrut(10));
bacross.add(goBox);
bacross.add(goButton);
goButton.setMargin(new Insets(0,1,0,1));
......@@ -616,7 +645,71 @@ public class DataCollectionPane extends JScrollPane
hit.setEMBL(tok.nextToken());
}
}
}
/**
*
* Sets the GO annotation for a given ID, first by querying
* Amigo and if not successful querying SRS.
* @param ann annotation display
* @param id database id
* @param go_id GO id
* @return annotation
*
*/
private String setGoAnnotation(Annotation ann, String id, String go_id)
{
String go_ann = new String("/GO_component=\"GO:"+
go_id+"; "+id+";\"");
String cmd[] = { "etc/go_associations.pl", "-assoc", id };
ExternalApplication app = new ExternalApplication(cmd,
null,null);
String res = app.getProcessStdout();
boolean found = false;
try
{
String line;
BufferedReader buffRead = new BufferedReader(new StringReader(res));
while((line = buffRead.readLine()) != null)
{
if(line.indexOf(go_id) > -1)
{
go_ann = new String("/GO_component=\""+line+"\"");
found = true;
break;
}
}
}
catch(IOException ioe) { ioe.printStackTrace(); }
if(!found) // try SRS
{
String env[] = { "PATH=/usr/local/pubseq/bin/" };
String cmd2[] = { "getz", "-f", "dbxref", "[uniprot:"+id+"]" };
app = new ExternalApplication(cmd2,env,null);
res = app.getProcessStdout();
try
{
String line;
BufferedReader buffRead = new BufferedReader(new StringReader(res));
while((line = buffRead.readLine()) != null)
{
if(line.indexOf(go_id) > -1)
{
go_ann = new String("/GO_component=\""+line.substring(3).trim()+"\"");
found = true;
break;
}
}
}
catch(IOException ioe) { ioe.printStackTrace(); }
}
ann.insert(go_ann,false);
return go_ann;
}
......@@ -759,6 +852,11 @@ public class DataCollectionPane extends JScrollPane
super();
}
public MouseOverButton(String s)
{
super(s);
}
public MouseOverButton(HitInfo hit)
{
super(hit.getID());
......@@ -795,6 +893,7 @@ public class DataCollectionPane extends JScrollPane
protected void processMouseEvent(MouseEvent evt)
{
super.processMouseEvent(evt);
switch (evt.getID())
{
case MouseEvent.MOUSE_ENTERED:
......@@ -808,7 +907,7 @@ public class DataCollectionPane extends JScrollPane
repaint();
break;
}
super.processMouseEvent(evt);
// super.processMouseEvent(evt);
}
}
......
......@@ -27,6 +27,7 @@ package uk.ac.sanger.artemis.editor;
import java.util.StringTokenizer;
import java.util.NoSuchElementException;
import java.util.Vector;
import java.util.Hashtable;
/**
*
......@@ -78,6 +79,8 @@ public class HitInfo
private int startQuery;
/** query hit end point */
private int endQuery;
/** hastable for go terms */
private Hashtable go_hash;
public HitInfo(String header, String format)
{
......@@ -597,6 +600,12 @@ public class HitInfo
return geneName;
}
/**
*
* Set the GO term
*
*/
protected void setGO(String go_terms)
{
go_terms = go_terms.trim();
......@@ -609,9 +618,41 @@ public class HitInfo
}
}
/**
*
* Get GO collection.
*
*/
protected Vector getGO()
{
return go;
}
/**
*
* Set a GO association.
*
*/
protected void setGoAssociation(String go_id, String assoc)
{
if(go_hash == null)
go_hash = new Hashtable();
go_hash.put(go_id,assoc);
}
/**
*
* Get a GO association.
*
*/
protected String getGoAssociation(String go_id)
{
if(go_hash != null && go_hash.containsKey(go_id))
return (String)go_hash.get(go_id);
return null;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment