Skip to content
Snippets Groups Projects
Commit 5ff336b9 authored by tcarver's avatar tcarver
Browse files

update

parent 0e6eff51
No related branches found
No related tags found
No related merge requests found
/* ValidateViewer
*
* created: 2013
*
* This file is part of Artemis
*
* Copyright(C) 2013 Genome Research Limited
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or(at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
package uk.ac.sanger.artemis.components;
import java.awt.event.ActionEvent;
......@@ -5,12 +28,10 @@ import java.awt.event.ActionListener;
import javax.swing.JButton;
import uk.ac.sanger.artemis.EntryChangeEvent;
import uk.ac.sanger.artemis.EntryGroup;
import uk.ac.sanger.artemis.EntryGroupChangeEvent;
import uk.ac.sanger.artemis.EntryGroupChangeListener;
import uk.ac.sanger.artemis.FeatureChangeEvent;
import uk.ac.sanger.artemis.FeatureChangeListener;
import uk.ac.sanger.artemis.Feature;
import uk.ac.sanger.artemis.FeatureVector;
import uk.ac.sanger.artemis.components.genebuilder.GeneUtils;
import uk.ac.sanger.artemis.io.ChadoCanonicalGene;
......@@ -35,36 +56,27 @@ class ValidateViewer extends FileViewer implements EntryGroupChangeListener
update(features);
setVisible(true);
final JButton fixButton = new JButton("Auto-Fix");
fixButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
//entryGrp.getActionController().startAction();
for(int i=0; i<features.size(); i++)
try
{
if(features.elementAt(i).getEmblFeature() instanceof GFFStreamFeature)
{
fixBoundary((GFFStreamFeature)features.elementAt(i).getEmblFeature());
}
entryGrp.getActionController().startAction();
for(int i=0; i<features.size(); i++)
fixBoundary(features.elementAt(i));
}
finally
{
//update(features);
entryGrp.getActionController().endAction();
}
//entryGrp.entryChanged(new EntryChangeEvent());
//entryGrp.getActionController().endAction();
}
});
button_panel.add(fixButton);
entryGrp.addFeatureChangeListener(new FeatureChangeListener(){
public void featureChanged(FeatureChangeEvent event)
{
System.out.println("HEREREE");
update(features);
}
});
entryGrp.addEntryGroupChangeListener(new EntryGroupChangeListener(){
public void entryGroupChanged(EntryGroupChangeEvent event)
{
......@@ -87,14 +99,18 @@ class ValidateViewer extends FileViewer implements EntryGroupChangeListener
gffTest.featureValidate(features.elementAt(i).getEmblFeature(), this);
}
private void fixBoundary(final GFFStreamFeature gffFeature)
private void fixBoundary(final Feature feature)
{
if( ! (feature.getEmblFeature() instanceof GFFStreamFeature) )
return;
final GFFStreamFeature gffFeature = (GFFStreamFeature) feature.getEmblFeature();
final ChadoCanonicalGene gene = gffFeature.getChadoGene();
if(gene != null && !gene.getGene().isReadOnly() && GeneUtils.isBoundaryOK(gene) > 0)
{
System.out.println(GeneUtils.getUniqueName(gffFeature));
//updatedFeatures.add(feature);
GeneUtils.checkGeneBoundary(gene);
GeneUtils.checkGeneBoundary(gene, false);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment