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

change predicate to fix multiple transcripts

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@10225 ee4ac58c-ac51-4696-9907-e4b3aa274f04
parent 788cb049
Branches
Tags
No related merge requests found
...@@ -45,7 +45,6 @@ import java.util.Vector; ...@@ -45,7 +45,6 @@ import java.util.Vector;
import javax.swing.Box; import javax.swing.Box;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
...@@ -63,6 +62,7 @@ import uk.ac.sanger.artemis.SimpleEntryGroup; ...@@ -63,6 +62,7 @@ import uk.ac.sanger.artemis.SimpleEntryGroup;
import uk.ac.sanger.artemis.chado.ChadoTransactionManager; import uk.ac.sanger.artemis.chado.ChadoTransactionManager;
import uk.ac.sanger.artemis.components.genebuilder.GeneEdit; import uk.ac.sanger.artemis.components.genebuilder.GeneEdit;
import uk.ac.sanger.artemis.components.genebuilder.GeneUtils; import uk.ac.sanger.artemis.components.genebuilder.GeneUtils;
import uk.ac.sanger.artemis.io.ChadoCanonicalGene;
import uk.ac.sanger.artemis.io.DatabaseDocumentEntry; import uk.ac.sanger.artemis.io.DatabaseDocumentEntry;
import uk.ac.sanger.artemis.io.GFFStreamFeature; import uk.ac.sanger.artemis.io.GFFStreamFeature;
import uk.ac.sanger.artemis.io.InvalidRelationException; import uk.ac.sanger.artemis.io.InvalidRelationException;
...@@ -222,7 +222,6 @@ class TransferAnnotationTool extends JFrame ...@@ -222,7 +222,6 @@ class TransferAnnotationTool extends JFrame
final Box geneNameBox = Box.createVerticalBox(); final Box geneNameBox = Box.createVerticalBox();
pane.add(geneNameBox, c); pane.add(geneNameBox, c);
if(geneNames != null) if(geneNames != null)
{ {
for(int i = 0; i < geneNames.size(); i++) for(int i = 0; i < geneNames.size(); i++)
...@@ -277,7 +276,7 @@ class TransferAnnotationTool extends JFrame ...@@ -277,7 +276,7 @@ class TransferAnnotationTool extends JFrame
JScrollPane jsp = new JScrollPane(geneNameTextArea); JScrollPane jsp = new JScrollPane(geneNameTextArea);
int res = JOptionPane.showConfirmDialog(TransferAnnotationTool.this, int res = JOptionPane.showConfirmDialog(TransferAnnotationTool.this,
jsp, "Paste Features to Add", jsp, "Paste Feature Names to Add",
JOptionPane.OK_CANCEL_OPTION); JOptionPane.OK_CANCEL_OPTION);
if(res == JOptionPane.CANCEL_OPTION) if(res == JOptionPane.CANCEL_OPTION)
return; return;
...@@ -697,7 +696,8 @@ class TransferAnnotationTool extends JFrame ...@@ -697,7 +696,8 @@ class TransferAnnotationTool extends JFrame
/** /**
* Test if the feature is nominated to have annotation transferred * Test if the feature is nominated to have annotation transferred
* to it. * to it. For genes in a chado database it looks at the gene name
* and transcript name.
*/ */
class TransferFeaturePredicate implements FeaturePredicate class TransferFeaturePredicate implements FeaturePredicate
{ {
...@@ -707,8 +707,10 @@ class TransferAnnotationTool extends JFrame ...@@ -707,8 +707,10 @@ class TransferAnnotationTool extends JFrame
private boolean isDatabaseEntry; private boolean isDatabaseEntry;
private String[] geneNames; private String[] geneNames;
public TransferFeaturePredicate(final String key, final boolean sameKey, public TransferFeaturePredicate(final String key,
final boolean isDatabaseEntry, final String[] geneNames) final boolean sameKey,
final boolean isDatabaseEntry,
final String[] geneNames)
{ {
this.key = key; this.key = key;
this.sameKey = sameKey; this.sameKey = sameKey;
...@@ -722,21 +724,32 @@ class TransferAnnotationTool extends JFrame ...@@ -722,21 +724,32 @@ class TransferAnnotationTool extends JFrame
if (!sameKey || !targetKey.equals(key)) if (!sameKey || !targetKey.equals(key))
return false; return false;
String chadoGeneName = null; Vector chadoNames = null;
if (isDatabaseEntry) if (isDatabaseEntry)
{ {
GFFStreamFeature gffFeature = GFFStreamFeature gffFeature =
((GFFStreamFeature) targetFeature.getEmblFeature()); ((GFFStreamFeature) targetFeature.getEmblFeature());
if (gffFeature.getChadoGene() != null) if (gffFeature.getChadoGene() != null)
chadoGeneName = gffFeature.getChadoGene().getGeneUniqueName(); {
chadoNames = new Vector();
ChadoCanonicalGene chadoGene = gffFeature.getChadoGene();
chadoNames.add(chadoGene.getGeneUniqueName());
List transcripts = chadoGene.getTranscripts();
for(int i=0;i<transcripts.size();i++)
{
GFFStreamFeature feature = (GFFStreamFeature) transcripts.get(i);
chadoNames.add(GeneUtils.getUniqueName(feature));
}
}
} }
String thisFeatureSystematicName = targetFeature.getSystematicName(); String thisFeatureSystematicName = targetFeature.getSystematicName();
for (int i = 0; i < geneNames.length; i++) for (int i = 0; i < geneNames.length; i++)
{ {
if (geneNames[i].equals(thisFeatureSystematicName) if(geneNames[i].equals(thisFeatureSystematicName) ||
|| (chadoGeneName != null && geneNames[i].equals(chadoGeneName))) (chadoNames != null && chadoNames.contains(geneNames[i])))
{ {
geneName = geneNames[i]; geneName = geneNames[i];
return true; return true;
...@@ -745,7 +758,7 @@ class TransferAnnotationTool extends JFrame ...@@ -745,7 +758,7 @@ class TransferAnnotationTool extends JFrame
return false; return false;
} }
public String getGeneName() protected String getGeneName()
{ {
return geneName; return geneName;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment