Iron-sulfur (2Fe-2S) FER_BRANA -1 77 77 METAL
<html>Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 8_8</a></html> FER_BRANA -1 8 83 Pfam
Ferredoxin_fold Status: True Positive FER_BRANA -1 2 96 Cath
-Iron-sulfur (2Fe-2S) FER2_ARATH -1 91 91 METAL
-Iron-sulfur (2Fe-2S) FER2_ARATH -1 96 96 METAL
-Iron-sulfur (2Fe-2S) FER2_ARATH -1 99 99 METAL
-Iron-sulfur (2Fe-2S) FER2_ARATH -1 129 129 METAL
-<html>Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 60_13</a></html> FER2_ARATH -1 60 135 Pfam
-Ferredoxin_fold Status: True Positive FER2_ARATH -1 50 145 Cath
+Iron-sulfur (2Fe-2S) FER1_ARATH -1 91 91 METAL
+Iron-sulfur (2Fe-2S) FER1_ARATH -1 96 96 METAL
+Iron-sulfur (2Fe-2S) FER1_ARATH -1 99 99 METAL
+Iron-sulfur (2Fe-2S) FER1_ARATH -1 129 129 METAL
+<html>Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 60_13</a></html> FER1_ARATH -1 60 135 Pfam
+Ferredoxin_fold Status: True Positive FER1_ARATH -1 50 145 Cath
<html>Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 60_11</a></html> Q93Z60_ARATH -1 60 118 Pfam
Ferredoxin_fold Status: True Positive Q93Z60_ARATH -1 52 118 Cath
Iron-sulfur (2Fe-2S) FER1_MAIZE -1 91 91 METAL
<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00221&service=NetPhos-2.0">PHOSPHORYLATION (S) 112_11</a></html> FER1_SPIOL -1 112 112 PHOSPHORYLATION (S)
<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00221&service=NetPhos-2.0">PHOSPHORYLATION (T) 139_13</a></html> FER1_SPIOL -1 139 139 PHOSPHORYLATION (T)
<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00221&service=NetPhos-2.0">PHOSPHORYLATION (Y) 73_7</a></html> FER1_SPIOL -1 73 73 PHOSPHORYLATION (Y)
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (S) 19_1</a></html> FER1_ARATH -1 19 19 PHOSPHORYLATION (S)
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (S) 24_2</a></html> FER1_ARATH -1 24 24 PHOSPHORYLATION (S)
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (S) 90_9</a></html> FER1_ARATH -1 90 90 PHOSPHORYLATION (S)
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (S) 107_10</a></html> FER1_ARATH -1 107 107 PHOSPHORYLATION (S)
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (S) 114_11</a></html> FER1_ARATH -1 114 114 PHOSPHORYLATION (S)
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (T) 141_14</a></html> FER1_ARATH -1 141 141 PHOSPHORYLATION (T)
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (Y) 75_7</a></html> FER1_ARATH -1 75 75 PHOSPHORYLATION (Y)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER2_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (S) 19_1</a></html> FER2_ARATH -1 19 19 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER2_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (S) 24_2</a></html> FER2_ARATH -1 24 24 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER2_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (S) 90_9</a></html> FER2_ARATH -1 90 90 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER2_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (S) 107_10</a></html> FER2_ARATH -1 107 107 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER2_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (S) 114_11</a></html> FER2_ARATH -1 114 114 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER2_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (T) 141_14</a></html> FER2_ARATH -1 141 141 PHOSPHORYLATION (T)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER2_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (Y) 75_7</a></html> FER2_ARATH -1 75 75 PHOSPHORYLATION (Y)
<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00227&service=NetPhos-2.0">PHOSPHORYLATION (S) 38_3</a></html> FER_BRANA -1 38 38 PHOSPHORYLATION (S)
<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00227&service=NetPhos-2.0">PHOSPHORYLATION (S) 62_6</a></html> FER_BRANA -1 62 62 PHOSPHORYLATION (S)
<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00227&service=NetPhos-2.0">PHOSPHORYLATION (T) 89_8</a></html> FER_BRANA -1 89 89 PHOSPHORYLATION (T)
EVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSFLDDDQIAEGFVLTCAAYPTSDVT
IETHREEDMV--
>FER1_ARATH/1-148
-----MASTALSSAIVGTSFIRRSPAPISLRSLPSANT-QSLFGLKS-GTARGGRVTAMATYKVKFITPEGEL
-EVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSFLDDEQIGEGFVLTCAAYPTSDVT
-IETHKEEDIV--
+----MASTALSSAIVSTSFLRRQQTPISLRSLPFANT-QSLFGLKS-STARGGRVTAMATYKVKFITPEGEQ
+EVECEEDVYVLDAAEEAGLDLPYSCRAGSCSSCAGKVVSGSIDQSDQSFLDDEQMSEGYVLTCVAYPTSDVV
+IETHKEEAIM--
>FER_BRANA/1-96
----------------------------------------------------------ATYKVKFITPEGEQ
EVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGFVDQSDESFLDDDQIAEGFVLTCAAYPTSDVT
IETHKEEELV--
>FER2_ARATH/1-148
-----MASTALSSAIVSTSFLRRQQTPISLRSLPFANT-QSLFGLKS-STARGGRVTAMATYKVKFITPEGEQ
-EVECEEDVYVLDAAEEAGLDLPYSCRAGSCSSCAGKVVSGSIDQSDQSFLDDEQMSEGYVLTCVAYPTSDVV
-IETHKEEAIM--
+----MASTALSSAIVGTSFIRRSPAPISLRSLPSANT-QSLFGLKS-GTARGGRVTAMATYKVKFITPEGEL
+EVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSFLDDEQIGEGFVLTCAAYPTSDVT
+IETHKEEDIV--
>Q93Z60_ARATH/1-118
----MASTALSSAIVSTSFLRRQQTPISLRSLPFANT-QSLFGLKS-STARGGRVTAMATYKVKFITPEGEQ
EVECEEDVYVLDAAEEAGLDLPYSCRAGSCSSCAGKVVSGSIDQSDQSFLDD--------------------
R -> K FER3_RAPSA -1 91 91 VARIANT
M -> V FER3_RAPSA -1 95 95 VARIANT
<html>Description: Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 8_83</a></html> FER3_RAPSA -1 8 83 Pfam
-Chloroplast FER1_ARATH -1 1 52 TRANSIT
-Iron-sulfur (2Fe-2S) FER1_ARATH -1 91 91 METAL
-Iron-sulfur (2Fe-2S) FER1_ARATH -1 96 96 METAL
-Iron-sulfur (2Fe-2S) FER1_ARATH -1 99 99 METAL
-Iron-sulfur (2Fe-2S) FER1_ARATH -1 129 129 METAL
-<html>Description: Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 60_135</a></html> FER1_ARATH -1 60 135 Pfam
-Iron-sulfur (2Fe-2S) FER_BRANA -1 39 39 METAL
-Iron-sulfur (2Fe-2S) FER_BRANA -1 44 44 METAL
-Iron-sulfur (2Fe-2S) FER_BRANA -1 47 47 METAL
-Iron-sulfur (2Fe-2S) FER_BRANA -1 77 77 METAL
-<html>Description: Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 8_83</a></html> FER_BRANA -1 8 83 Pfam
Chloroplast FER2_ARATH -1 1 52 TRANSIT
Iron-sulfur (2Fe-2S) FER2_ARATH -1 91 91 METAL
Iron-sulfur (2Fe-2S) FER2_ARATH -1 96 96 METAL
Iron-sulfur (2Fe-2S) FER2_ARATH -1 99 99 METAL
Iron-sulfur (2Fe-2S) FER2_ARATH -1 129 129 METAL
<html>Description: Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 60_135</a></html> FER2_ARATH -1 60 135 Pfam
+Iron-sulfur (2Fe-2S) FER_BRANA -1 39 39 METAL
+Iron-sulfur (2Fe-2S) FER_BRANA -1 44 44 METAL
+Iron-sulfur (2Fe-2S) FER_BRANA -1 47 47 METAL
+Iron-sulfur (2Fe-2S) FER_BRANA -1 77 77 METAL
+<html>Description: Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 8_83</a></html> FER_BRANA -1 8 83 Pfam
+Chloroplast FER1_ARATH -1 1 52 TRANSIT
+Iron-sulfur (2Fe-2S) FER1_ARATH -1 91 91 METAL
+Iron-sulfur (2Fe-2S) FER1_ARATH -1 96 96 METAL
+Iron-sulfur (2Fe-2S) FER1_ARATH -1 99 99 METAL
+Iron-sulfur (2Fe-2S) FER1_ARATH -1 129 129 METAL
+<html>Description: Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 60_135</a></html> FER1_ARATH -1 60 135 Pfam
<html>Description: Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 60_118</a></html> Q93Z60_ARATH -1 60 118 Pfam
Chloroplast FER1_MAIZE -1 1 52 TRANSIT
STRAND FER1_MAIZE -1 57 59 STRAND
QEVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSFLDDDQIAEGFVLTCAAYPTSDV
TIETHREEDMV--
>FER1_ARATH Ferredoxin-1, chloroplast precursor
-MAST----ALSSAIVGTSFIRRSPAPISLRSLPSANTQ--SLFGLKS-GTARGGRVTAMATYKVKFITPEGE
-LEVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSFLDDEQIGEGFVLTCAAYPTSDV
-TIETHKEEDIV--
+MAST----ALSSAIVSTSFLRRQQTPISLRSLPFANTQ--SLFGLKS-STARGGRVTAMATYKVKFITPEGE
+QEVECEEDVYVLDAAEEAGLDLPYSCRAGSCSSCAGKVVSGSIDQSDQSFLDDEQMSEGYVLTCVAYPTSDV
+VIETHKEEAIM--
>FER_BRANA Ferredoxin
-----------------------------------------------------------ATYKVKFITPEGE
QEVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGFVDQSDESFLDDDQIAEGFVLTCAAYPTSDV
TIETHKEEELV--
>FER2_ARATH Ferredoxin-2, chloroplast precursor
-MAST----ALSSAIVSTSFLRRQQTPISLRSLPFANTQ--SLFGLKS-STARGGRVTAMATYKVKFITPEGE
-QEVECEEDVYVLDAAEEAGLDLPYSCRAGSCSSCAGKVVSGSIDQSDQSFLDDEQMSEGYVLTCVAYPTSDV
-VIETHKEEAIM--
+MAST----ALSSAIVGTSFIRRSPAPISLRSLPSANTQ--SLFGLKS-GTARGGRVTAMATYKVKFITPEGE
+LEVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSFLDDEQIGEGFVLTCAAYPTSDV
+TIETHKEEDIV--
>Q93Z60_ARATH At1g10960/T19D16_12
MAST----ALSSAIVSTSFLRRQQTPISLRSLPFANTQ--SLFGLKS-STARGGRVTAMATYKVKFITPEGE
QEVECEEDVYVLDAAEEAGLDLPYSCRAGSCSSCAGKVVSGSIDQSDQSFLDD-------------------
</p>
<p>
To search UniProt, simply begin typing in the text box. After a
- short delay (uabout 1.5 seconds), results will be shown in the table
+ short delay (about 1.5 seconds), results will be shown in the table
below. You can sort results by clicking on the displayed columns,
and select entries with the mouse or keyboard. Once you have
selected one or more entries, hit the <strong>OK</strong> button to
the alignment will have a secondary structure line shown below it,
and a number of additional options become available:
<ul>
- <li><a href="../colourschemes/rnahelicesColouring.html">RNA
+ <li><a href="../colourSchemes/rnahelicesColouring.html">RNA
Helix colouring</a> - highlights columns of alignment involved in
particular RNA helices, Uses the first displayed secondary
structure annotation.</li>
_data_column.is_shown_by_default
_data_column.is_searchable
PDB Id;pdb_id;String;g2;40;60;45;true;true
-Title;title;String;g6;300;1500;400;true;false
+Title;title;String;g6;50;1500;400;true;false
Molecule;molecule_name;String;g3;50;400;95;false;true
Molecule Type;molecule_type;String;g3;50;400;95;false;true
Sequence;molecule_sequence;String;g6;50;400;95;false;false
Number of Polymer Entities;number_of_polymer_entities;int;g6;50;400;95;false;false
Number of Bound Entities;number_of_bound_entities;int;g6;50;400;95;false;false
Crystallisation Reservoir;crystallisation_reservoir;String;g6;50;400;95;false;false
-Data Scalling Software;data_scaling_software;String;g4;50;400;95;false;false
+Data Scaling Software;data_scaling_software;String;g4;50;400;95;false;false
Detector;detector;String;g6;50;400;95;false;false
Detector Type;detector_type;String;g6;50;400;95;false;false
Modified Residue Flag;modified_residue_flag;String;g6;50;400;95;false;false
label.add_sbrs_definition = Add a SBRS Definition
label.edit_sbrs_definition = Edit SBRS Definition
label.delete_sbrs_definition = Delete SBRS Definition
-label.your_sequences_have_been_verified = Your sequences have been verified against known sequence databases. Some of the ids have been\n altered, most likely the start/end residue will have been updated.\n Save your alignment to maintain the updated id.\n\n
-label.sequence_names_updated = Sequence names updated
+label.your_sequences_have_been_verified = Your sequences have been verified against known sequence databases.\n(Use Calculate | Show flanking regions to show enclosing sequence.)\nTo preserve data changes, save your alignment.\n\n
+label.sequences_updated = Sequences updated
label.dbref_search_completed = DBRef search completed
label.show_all_chains = Show all chains
label.fetch_all_param = Fetch all {0}
label.add_sbrs_definition = Añadir una definición SBRS
label.edit_sbrs_definition = Editar una definición SBRS
label.delete_sbrs_definition = Borrar una definición SBRS
-label.your_sequences_have_been_verified = Sus secuencias has sido verificadas en una base de datos de secuencias conocidas. Algunos de sus ID se han alterado y\n, probablemente, el residuo de inicio/fin se haya actualizado.\nGuarde su alineamiento para mantener el ID actualizado.\n\n
-label.sequence_names_updated = Nombres de secuencia actualizados
+label.your_sequences_have_been_verified = Sus secuencias has sido verificadas en una base de datos de secuencias conocidas.\n(Usar Calcular | Mostrar flancos para ver ampliación.)\nPara mantener los datos actualizados, guarde su alineamiento.\n\n
+label.sequences_updated = Secuencias actualizadas
label.dbref_search_completed = Búsqueda de DBRef terminada
label.show_all_chains = Mostrar todas las cadenas
label.fetch_all_param = Recuperar todas {0}
*/
public class ChimeraManager
{
+ private static final int REST_REPLY_TIMEOUT_MS = 15000;
+
+ private static final int CONNECTION_TIMEOUT_MS = 100;
+
private static final boolean debug = false;
private int chimeraRestPort;
BufferedReader response = null;
try
{
- response = HttpClientUtils
- .doHttpUrlPost(restUrl, commands, 100, 5000);
+ response = HttpClientUtils.doHttpUrlPost(restUrl, commands, CONNECTION_TIMEOUT_MS,
+ REST_REPLY_TIMEOUT_MS);
String line = "";
while ((line = response.readLine()) != null)
{
*/
AlignedCodonFrame dnaToCdsMapping = new AlignedCodonFrame();
MapList dnaToCdsMap = new MapList(mapList.getFromRanges(),
- cdsRange, 1,
- 1);
+ cdsRange, 1, 1);
dnaToCdsMapping.addMap(dnaSeq.getDatasetSequence(), cdsSeqDss,
dnaToCdsMap);
if (!mappings.contains(dnaToCdsMapping))
/*
* transfer any features on dna that overlap the CDS
*/
- transferFeatures(dnaSeq, cdsSeq, cdsToProteinMap, null,
+ transferFeatures(dnaSeq, cdsSeq, dnaToCdsMap, null,
SequenceOntologyI.CDS);
}
}
*/
package jalview.appletgui;
+import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.SequenceGroup;
import jalview.schemes.AnnotationColourGradient;
import jalview.schemes.ColourSchemeI;
slider.addAdjustmentListener(this);
slider.addMouseListener(this);
- if (av.getAlignment().getAlignmentAnnotation() == null)
+ AlignmentAnnotation[] anns = av.getAlignment().getAlignmentAnnotation();
+ if (anns == null)
{
return;
}
// seqAssociated.setState(acg.isSeqAssociated());
}
- Vector list = new Vector();
+ Vector<String> list = new Vector<String>();
int index = 1;
- for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++)
+ for (int i = 0; i < anns.length; i++)
{
- String label = av.getAlignment().getAlignmentAnnotation()[i].label;
+ String label = anns[i].label;
+ if (anns[i].sequenceRef != null)
+ {
+ label = label + "_" + anns[i].sequenceRef.getName();
+ }
if (!list.contains(label))
{
list.addElement(label);
Checkbox thresholdIsMin = new Checkbox();
+ @Override
public void actionPerformed(ActionEvent evt)
{
if (evt.getSource() == thresholdValue)
}
}
+ @Override
public void itemStateChanged(ItemEvent evt)
{
if (evt.getSource() == currentColours)
changeColour();
}
+ @Override
public void adjustmentValueChanged(AdjustmentEvent evt)
{
if (!adjusting)
}
+ @Override
public void mouseClicked(MouseEvent evt)
{
}
+ @Override
public void mousePressed(MouseEvent evt)
{
}
+ @Override
public void mouseReleased(MouseEvent evt)
{
ap.paintAlignment(true);
}
+ @Override
public void mouseEntered(MouseEvent evt)
{
}
+ @Override
public void mouseExited(MouseEvent evt)
{
}
slider.addAdjustmentListener(this);
slider.addMouseListener(this);
- if (av.getAlignment().getAlignmentAnnotation() == null)
+ AlignmentAnnotation[] anns = av.getAlignment().getAlignmentAnnotation();
+ if (anns == null)
{
return;
}
setOldColumnSelection(av.getColumnSelection());
adjusting = true;
- Vector list = new Vector();
+ Vector<String> list = new Vector<String>();
int index = 1;
- for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++)
+ for (int i = 0; i < anns.length; i++)
{
- String label = av.getAlignment().getAlignmentAnnotation()[i].label;
+ String label = anns[i].label;
+ if (anns[i].sequenceRef != null)
+ {
+ label = label + "_" + anns[i].sequenceRef.getName();
+ }
if (!list.contains(label))
{
list.addElement(label);
this.validate();
}
+ @Override
@SuppressWarnings("unchecked")
public void reset()
{
}
+ @Override
public void adjustmentValueChanged(AdjustmentEvent evt)
{
if (!adjusting)
});
}
+ @Override
public void valueChanged(boolean updateAllAnnotation)
{
if (slider.isEnabled())
}
}
+ @Override
public void actionPerformed(ActionEvent evt)
{
if (evt.getSource() == thresholdValue)
}
- public Vector getAnnotationItems(boolean isSeqAssociated)
- {
- Vector list = new Vector();
- int index = 1;
- int[] anmap = new int[av.getAlignment().getAlignmentAnnotation().length];
- for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++)
- {
- if (av.getAlignment().getAlignmentAnnotation()[i].sequenceRef == null)
- {
- if (isSeqAssociated)
- {
- continue;
- }
- }
- else
- {
- enableSeqAss = true;
- }
- String label = av.getAlignment().getAlignmentAnnotation()[i].label;
- if (!list.contains(label))
- {
- anmap[list.size()] = i;
- list.add(label);
-
- }
- else
- {
- if (!isSeqAssociated)
- {
- anmap[list.size()] = i;
- list.add(label + "_" + (index++));
- }
- }
- }
- this.annmap = new int[list.size()];
- System.arraycopy(anmap, 0, this.annmap, 0, this.annmap.length);
- return list;
- }
-
protected int getSelectedThresholdItem(int indexValue)
{
int selectedThresholdItem = -1;
import java.util.List;
import java.util.Vector;
+import org.jmol.util.Logger;
+
public class AppletJmol extends EmbmenuFrame implements
// StructureListener,
KeyListener, ActionListener, ItemListener
jmb.allocateViewer(renderPanel, true, ap.av.applet.getName()
+ "_jmol_", ap.av.applet.getDocumentBase(),
ap.av.applet.getCodeBase(), "-applet", scriptWindow, null);
+ Logger.setLogLevel(Logger.LEVEL_WARN);
} catch (Exception e)
{
System.err
}
if (selectioncom.length() > 0)
{
- System.out.println("Select regions:\n" + selectioncom.toString());
+ // System.out.println("Select regions:\n" + selectioncom.toString());
evalStateCommand("select *; cartoons off; backbone; select ("
+ selectioncom.toString() + "); cartoons; ");
// selcom.append("; ribbons; ");
String cmdString = command.toString();
- System.out.println("Superimpose command(s):\n" + cmdString);
+ // System.out.println("Superimpose command(s):\n" + cmdString);
evalStateCommand(cmdString);
}
{
selectioncom.setLength(selectioncom.length() - 1);
}
- System.out.println("Select regions:\n" + selectioncom.toString());
+ // System.out.println("Select regions:\n" + selectioncom.toString());
evalStateCommand("select *; cartoons off; backbone; select ("
+ selectioncom.toString() + "); cartoons; ");
// evalStateCommand("select *; backbone; select "+selcom.toString()+"; cartoons; center "+selcom.toString());
{
try
{
+ /*
+ * params -o (output to sysout) -i (no info logging, less verbose)
+ * -n (nodisplay) -x (exit when finished)
+ * see http://wiki.jmol.org/index.php/Jmol_Application
+ */
viewer = (Viewer) JmolViewer.allocateViewer(null, null, null, null,
- null, "-x -o -n", this);
+ null, "-x -o -n -i", this);
// ensure the 'new' (DSSP) not 'old' (Ramachandran) SS method is used
viewer.setBooleanProperty("defaultStructureDSSP", true);
} catch (ClassCastException x)
@Override
public void actionPerformed(ActionEvent e)
{
- ok_actionPerformed(e);
+ ok_actionPerformed();
}
});
cancel.setOpaque(false);
@Override
public void actionPerformed(ActionEvent e)
{
- cancel_actionPerformed(e);
+ cancel_actionPerformed();
}
});
defColours.setOpaque(false);
@Override
public void actionPerformed(ActionEvent arg0)
{
- resetColours_actionPerformed(arg0);
+ resetColours_actionPerformed();
}
});
@Override
public void actionPerformed(ActionEvent e)
{
- annotations_actionPerformed(e);
+ annotations_actionPerformed();
}
});
getThreshold().addActionListener(new ActionListener()
@Override
public void actionPerformed(ActionEvent e)
{
- threshold_actionPerformed(e);
+ threshold_actionPerformed();
}
});
thresholdValue.addActionListener(new ActionListener()
@Override
public void actionPerformed(ActionEvent e)
{
- thresholdValue_actionPerformed(e);
+ thresholdValue_actionPerformed();
}
});
slider.setPaintLabels(false);
@Override
public void actionPerformed(ActionEvent e)
{
- currentColours_actionPerformed(e);
+ currentColours_actionPerformed();
}
});
thresholdIsMin.setBackground(Color.white);
@Override
public void actionPerformed(ActionEvent actionEvent)
{
- thresholdIsMin_actionPerformed(actionEvent);
+ thresholdIsMin_actionPerformed();
}
});
seqAssociated.setBackground(Color.white);
@Override
public void actionPerformed(ActionEvent arg0)
{
- seqAssociated_actionPerformed(arg0, annotations, seqAssociated);
+ seqAssociated_actionPerformed(annotations);
}
});
this.validate();
}
- protected void resetColours_actionPerformed(ActionEvent arg0)
+ protected void resetColours_actionPerformed()
{
setDefaultMinMax();
updateView();
updateView();
}
+ @Override
public void reset()
{
av.setGlobalColourScheme(oldcs);
}
}
+ @Override
public void valueChanged(boolean updateAllAnnotation)
{
if (slider.isEnabled())
this.threshold = threshold;
}
- public void currentColours_actionPerformed(ActionEvent e)
+ public void currentColours_actionPerformed()
{
if (currentColours.isSelected())
{
@Override
public void actionPerformed(ActionEvent e)
{
- ok_actionPerformed(e);
+ ok_actionPerformed();
}
});
@Override
public void actionPerformed(ActionEvent e)
{
- cancel_actionPerformed(e);
+ cancel_actionPerformed();
}
});
@Override
public void actionPerformed(ActionEvent e)
{
- threshold_actionPerformed(e);
+ threshold_actionPerformed();
}
});
@Override
public void actionPerformed(ActionEvent e)
{
- thresholdValue_actionPerformed(e);
+ thresholdValue_actionPerformed();
}
});
String defaultTtip = MessageManager
.getString("info.change_threshold_mode_to_enable");
- String threshold = getThreshold().getSelectedItem().toString();
- if (threshold.equalsIgnoreCase("No Threshold"))
+ String thresh = getThreshold().getSelectedItem().toString();
+ if (thresh.equalsIgnoreCase("No Threshold"))
{
thresholdValue.setToolTipText(defaultTtip);
slider.setToolTipText(defaultTtip);
}
}
+ @Override
public void reset()
{
if (this.getOldColumnSelection() != null)
}
+ @Override
public void valueChanged(boolean updateAllAnnotation)
{
if (slider.isEnabled())
import jalview.schemes.AnnotationColourGradient;
import jalview.util.MessageManager;
-import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Vector;
protected boolean enableSeqAss = false;
- private jalview.datamodel.AlignmentAnnotation currentAnnotation;
+ private AlignmentAnnotation currentAnnotation;
protected boolean adjusting = false;
enableSeqAss = true;
}
String label = av.getAlignment().getAlignmentAnnotation()[i].label;
+ // add associated sequence ID if available
+ if (!isSeqAssociated
+ && av.getAlignment().getAlignmentAnnotation()[i].sequenceRef != null)
+ {
+ label = label
+ + "_"
+ + av.getAlignment().getAlignmentAnnotation()[i].sequenceRef
+ .getName();
+ }
+ // make label unique
if (!list.contains(label))
{
anmap[list.size()] = i;
list.add(label);
-
}
else
{
seqAssociated.setEnabled(enableSeqAss);
}
- public void ok_actionPerformed(ActionEvent e)
+ public void ok_actionPerformed()
{
try
{
}
}
- public void cancel_actionPerformed(ActionEvent e)
+ public void cancel_actionPerformed()
{
reset();
ap.paintAlignment(true);
}
}
- public void thresholdCheck_actionPerformed(ActionEvent e)
+ public void thresholdCheck_actionPerformed()
{
updateView();
}
- public void annotations_actionPerformed(ActionEvent e)
+ public void annotations_actionPerformed()
{
updateView();
}
- public void threshold_actionPerformed(ActionEvent e)
+ public void threshold_actionPerformed()
{
updateView();
}
- public void thresholdValue_actionPerformed(ActionEvent e)
+ public void thresholdValue_actionPerformed()
{
try
{
}
}
- public void thresholdIsMin_actionPerformed(ActionEvent actionEvent)
+ public void thresholdIsMin_actionPerformed()
{
updateView();
}
.getString("label.threshold_feature_below_threshold"));
}
- protected void seqAssociated_actionPerformed(ActionEvent arg0,
- JComboBox<String> annotations, JCheckBox seqAssociated)
+ protected void seqAssociated_actionPerformed(JComboBox<String> annotations)
{
adjusting = true;
String cursel = (String) annotations.getSelectedItem();
}
protected boolean colorAlignmContaining(
- AlignmentAnnotation currentAnnotation, int selectedThresholdItem)
+ AlignmentAnnotation currentAnn, int selectedThresholdOption)
{
AnnotationColourGradient acg = null;
if (currentColours.isSelected())
{
- acg = new AnnotationColourGradient(currentAnnotation,
- av.getGlobalColourScheme(), selectedThresholdItem);
+ acg = new AnnotationColourGradient(currentAnn,
+ av.getGlobalColourScheme(), selectedThresholdOption);
}
else
{
- acg = new AnnotationColourGradient(currentAnnotation,
+ acg = new AnnotationColourGradient(currentAnn,
minColour.getBackground(), maxColour.getBackground(),
- selectedThresholdItem);
+ selectedThresholdOption);
}
acg.setSeqAssociated(seqAssociated.isSelected());
- if (currentAnnotation.graphMin == 0f
- && currentAnnotation.graphMax == 0f)
+ if (currentAnn.graphMin == 0f
+ && currentAnn.graphMax == 0f)
{
acg.setPredefinedColours(true);
}
if (currentColours.isSelected())
{
- sg.cs = new AnnotationColourGradient(currentAnnotation, sg.cs,
- selectedThresholdItem);
+ sg.cs = new AnnotationColourGradient(currentAnn, sg.cs,
+ selectedThresholdOption);
((AnnotationColourGradient) sg.cs).setSeqAssociated(seqAssociated
.isSelected());
}
else
{
- sg.cs = new AnnotationColourGradient(currentAnnotation,
+ sg.cs = new AnnotationColourGradient(currentAnn,
minColour.getBackground(), maxColour.getBackground(),
- selectedThresholdItem);
+ selectedThresholdOption);
((AnnotationColourGradient) sg.cs).setSeqAssociated(seqAssociated
.isSelected());
}
import jalview.structures.models.AAStructureBindingModel;
import jalview.util.MessageManager;
import jalview.util.Platform;
+import jalview.ws.dbsources.Pdb;
import java.awt.BorderLayout;
import java.awt.Color;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
+import javax.swing.SwingUtilities;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;
import javax.swing.event.MenuEvent;
public class AppJmol extends StructureViewerBase
{
+ private static final String SPACE = " ";
+
+ private static final String BACKSLASH = "\"";
+
AppJmolBinding jmb;
JPanel scriptWindow;
scriptWindow.setVisible(false);
}
- jmb.allocateViewer(renderPanel, true, "", null, null, "", scriptWindow,
- null);
+ /*
+ * -i for no info logging (less verbose)
+ */
+ jmb.allocateViewer(renderPanel, true, "", null, null, "-i",
+ scriptWindow, null);
// jmb.newJmolPopup("Jmol");
if (command == null)
{
public void run()
{
_started = true;
+ try
+ {
+ List<String> files = fetchPdbFiles();
+ if (files.size() > 0)
+ {
+ showFilesInViewer(files);
+ }
+ } finally
+ {
+ _started = false;
+ worker = null;
+ }
+ }
+
+ /**
+ * Either adds the given files to a structure viewer or opens a new viewer to
+ * show them
+ *
+ * @param files
+ * list of absolute paths to structure files
+ */
+ void showFilesInViewer(List<String> files)
+ {
+ long lastnotify = jmb.getLoadNotifiesHandled();
+ StringBuilder fileList = new StringBuilder();
+ for (String s : files)
+ {
+ fileList.append(SPACE).append(BACKSLASH).append(Platform.escapeString(s))
+ .append(BACKSLASH);
+ }
+ String filesString = fileList.toString();
+
+ if (!addingStructures)
+ {
+ try
+ {
+ initJmol("load FILES " + filesString);
+ } catch (OutOfMemoryError oomerror)
+ {
+ new OOMWarning("When trying to open the Jmol viewer!", oomerror);
+ Cache.log.debug("File locations are " + filesString);
+ } catch (Exception ex)
+ {
+ Cache.log.error("Couldn't open Jmol viewer!", ex);
+ }
+ }
+ else
+ {
+ StringBuilder cmd = new StringBuilder();
+ cmd.append("loadingJalviewdata=true\nload APPEND ");
+ cmd.append(filesString);
+ cmd.append("\nloadingJalviewdata=null");
+ final String command = cmd.toString();
+ lastnotify = jmb.getLoadNotifiesHandled();
+
+ try
+ {
+ jmb.evalStateCommand(command);
+ } catch (OutOfMemoryError oomerror)
+ {
+ new OOMWarning(
+ "When trying to add structures to the Jmol viewer!",
+ oomerror);
+ Cache.log.debug("File locations are " + filesString);
+ } catch (Exception ex)
+ {
+ Cache.log.error("Couldn't add files to Jmol viewer!", ex);
+ }
+ }
+
+ // need to wait around until script has finished
+ int waitMax = 5000; // give up after 5 seconds
+ int waitFor = 35;
+ int waitTotal = 0;
+ while (addingStructures ? lastnotify >= jmb.getLoadNotifiesHandled()
+ : !(jmb.isFinishedInit() && jmb.getPdbFile() != null && jmb
+ .getPdbFile().length == files.size()))
+ {
+ try
+ {
+ Cache.log.debug("Waiting around for jmb notify.");
+ Thread.sleep(waitFor);
+ waitTotal += waitFor;
+ } catch (Exception e)
+ {
+ }
+ if (waitTotal > waitMax)
+ {
+ System.err.println("Timed out waiting for Jmol to load files");
+ break;
+ }
+ }
+
+ // refresh the sequence colours for the new structure(s)
+ for (AlignmentPanel ap : _colourwith)
+ {
+ jmb.updateColours(ap);
+ }
+ // do superposition if asked to
+ if (Cache.getDefault("AUTOSUPERIMPOSE", true) && alignAddedStructures)
+ {
+ alignAddedStructures();
+ }
+ addingStructures = false;
+ }
+
+ /**
+ * Queues a thread to align structures with Jalview alignments
+ */
+ void alignAddedStructures()
+ {
+ javax.swing.SwingUtilities.invokeLater(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ if (jmb.viewer.isScriptExecuting())
+ {
+ SwingUtilities.invokeLater(this);
+ try
+ {
+ Thread.sleep(5);
+ } catch (InterruptedException q)
+ {
+ }
+ return;
+ }
+ else
+ {
+ alignStructs_withAllAlignPanels();
+ }
+ }
+ });
+ alignAddedStructures = false;
+ }
+
+ /**
+ * Retrieves and saves as file any modelled PDB entries for which we do not
+ * already have a file saved. Returns a list of absolute paths to structure
+ * files which were either retrieved, or already stored but not modelled in
+ * the structure viewer (i.e. files to add to the viewer display).
+ *
+ * @return
+ */
+ List<String> fetchPdbFiles()
+ {
+ // todo - record which pdbids were successfully imported.
+ StringBuilder errormsgs = new StringBuilder();
+
+ List<String> files = new ArrayList<String>();
String pdbid = "";
- // todo - record which pdbids were successfuly imported.
- StringBuffer errormsgs = new StringBuffer(), files = new StringBuffer();
try
{
- String[] curfiles = jmb.getPdbFile(); // files currently in viewer
+ String[] filesInViewer = jmb.getPdbFile();
// TODO: replace with reference fetching/transfer code (validate PDBentry
// as a DBRef?)
- jalview.ws.dbsources.Pdb pdbclient = new jalview.ws.dbsources.Pdb();
+ Pdb pdbclient = new Pdb();
for (int pi = 0; pi < jmb.getPdbCount(); pi++)
{
String file = jmb.getPdbEntry(pi).getFile();
} catch (Exception ex)
{
ex.printStackTrace();
- errormsgs.append("'" + pdbid + "'");
- }
- if (progressBar != null)
+ errormsgs.append("'").append(pdbid).append("'");
+ } finally
{
- progressBar.setProgressBar(
- MessageManager.getString("label.state_completed"), hdl);
+ if (progressBar != null)
+ {
+ progressBar.setProgressBar(
+ MessageManager.getString("label.state_completed"),
+ hdl);
+ }
}
if (pdbseq != null)
{
file = new File(pdbseq.getSequenceAt(0).getAllPDBEntries()
.elementAt(0).getFile()).getAbsolutePath();
jmb.getPdbEntry(pi).setFile(file);
-
- files.append(" \"" + Platform.escapeString(file) + "\"");
+ files.add(file);
}
else
{
- errormsgs.append("'" + pdbid + "' ");
+ errormsgs.append("'").append(pdbid).append("' ");
}
}
else
{
- if (curfiles != null && curfiles.length > 0)
+ if (filesInViewer != null && filesInViewer.length > 0)
{
addingStructures = true; // already files loaded.
- for (int c = 0; c < curfiles.length; c++)
+ for (int c = 0; c < filesInViewer.length; c++)
{
- if (curfiles[c].equals(file))
+ if (filesInViewer[c].equals(file))
{
file = null;
break;
}
if (file != null)
{
- files.append(" \"" + Platform.escapeString(file) + "\"");
+ files.add(file);
}
}
}
} catch (Exception ex)
{
ex.printStackTrace();
- errormsgs.append("When retrieving pdbfiles : current was: '" + pdbid
- + "'");
+ errormsgs.append("When retrieving pdbfiles : current was: '")
+ .append(pdbid).append("'");
}
if (errormsgs.length() > 0)
{
-
JOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager
.formatMessage("label.pdb_entries_couldnt_be_retrieved",
new String[] { errormsgs.toString() }),
MessageManager.getString("label.couldnt_load_file"),
JOptionPane.ERROR_MESSAGE);
-
- }
- long lastnotify = jmb.getLoadNotifiesHandled();
- if (files.length() > 0)
- {
- if (!addingStructures)
- {
-
- try
- {
- initJmol("load FILES " + files.toString());
- } catch (OutOfMemoryError oomerror)
- {
- new OOMWarning("When trying to open the Jmol viewer!", oomerror);
- Cache.log.debug("File locations are " + files);
- } catch (Exception ex)
- {
- Cache.log.error("Couldn't open Jmol viewer!", ex);
- }
- }
- else
- {
- StringBuffer cmd = new StringBuffer();
- cmd.append("loadingJalviewdata=true\nload APPEND ");
- cmd.append(files.toString());
- cmd.append("\nloadingJalviewdata=null");
- final String command = cmd.toString();
- cmd = null;
- lastnotify = jmb.getLoadNotifiesHandled();
-
- try
- {
- jmb.evalStateCommand(command);
- } catch (OutOfMemoryError oomerror)
- {
- new OOMWarning(
- "When trying to add structures to the Jmol viewer!",
- oomerror);
- Cache.log.debug("File locations are " + files);
- } catch (Exception ex)
- {
- Cache.log.error("Couldn't add files to Jmol viewer!", ex);
- }
- }
-
- // need to wait around until script has finished
- while (addingStructures ? lastnotify >= jmb.getLoadNotifiesHandled()
- : (!jmb.isFinishedInit() && jmb.getPdbFile() != null && jmb
- .getPdbFile().length != jmb.getPdbCount()))
- {
- try
- {
- Cache.log.debug("Waiting around for jmb notify.");
- Thread.sleep(35);
- } catch (Exception e)
- {
- }
- }
-
- // refresh the sequence colours for the new structure(s)
- for (AlignmentPanel ap : _colourwith)
- {
- jmb.updateColours(ap);
- }
- // do superposition if asked to
- if (Cache.getDefault("AUTOSUPERIMPOSE", true) && alignAddedStructures)
- {
- javax.swing.SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- if (jmb.viewer.isScriptExecuting())
- {
- javax.swing.SwingUtilities.invokeLater(this);
- try
- {
- Thread.sleep(5);
- } catch (InterruptedException q)
- {
- }
- ;
- return;
- }
- else
- {
- alignStructs_withAllAlignPanels();
- }
- }
- });
- alignAddedStructures = false;
- }
- addingStructures = false;
-
}
- _started = false;
- worker = null;
+ return files;
}
@Override
public class StructureChooser extends GStructureChooser implements
IProgressIndicator
{
- private boolean structuresDiscovered = false;
-
private SequenceI selectedSequence;
private SequenceI[] selectedSequences;
progressBar = new ProgressBar(this.statusPanel, this.statusBar);
}
+ // ensure a filter option is in force for search
+ populateFilterComboBox(true);
Thread discoverPDBStructuresThread = new Thread(new Runnable()
{
@Override
.getString("status.searching_for_pdb_structures"),
startTime);
fetchStructuresMetaData();
- populateFilterComboBox();
+ // revise filter options if no results were found
+ populateFilterComboBox(isStructuresDiscovered());
updateProgressIndicator(null, startTime);
mainFrame.setVisible(true);
updateCurrentView();
pdbRequest.setAllowEmptySeq(false);
pdbRequest.setResponseSize(500);
pdbRequest.setFieldToSearchBy("(");
+ FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
+ .getSelectedItem());
+ pdbRequest.setFieldToSortBy(selectedFilterOpt.getValue(),
+ !chk_invertFilter.isSelected());
pdbRequest.setWantedFields(wantedFields);
pdbRequest.setSearchTerm(buildQuery(seq) + ")");
pdbRequest.setAssociatedSequence(seq);
getResultTable().setModel(
FTSRestResponse.getTableModel(lastPdbRequest,
discoveredStructuresSet));
- structuresDiscovered = true;
noOfStructuresFound = discoveredStructuresSet.size();
mainFrame.setTitle(MessageManager.formatMessage(
"label.structure_chooser_no_of_structures",
* Populates the filter combo-box options dynamically depending on discovered
* structures
*/
- @Override
- protected void populateFilterComboBox()
+ protected void populateFilterComboBox(boolean haveData)
{
- if (isStructuresDiscovered())
+ /*
+ * temporarily suspend the change listener behaviour
+ */
+ cmb_filterOption.removeItemListener(this);
+
+ cmb_filterOption.removeAllItems();
+ if (haveData)
{
cmb_filterOption.addItem(new FilterOption("Best Quality",
"overall_quality", VIEWS_FILTER));
VIEWS_FROM_FILE));
cmb_filterOption.addItem(new FilterOption("Cached PDB Entries", "-",
VIEWS_LOCAL_PDB));
+
+ cmb_filterOption.addItemListener(this);
}
/**
* Updates the displayed view based on the selected filter option
*/
- @Override
protected void updateCurrentView()
{
FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
{
final long progressSessionId = System.currentTimeMillis();
final StructureSelectionManager ssm = ap.getStructureSelectionManager();
+ final int preferredHeight = pnl_filter.getHeight();
ssm.setProgressIndicator(this);
ssm.setProgressSessionId(progressSessionId);
new Thread(new Runnable()
@Override
public void run()
{
- FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
- .getSelectedItem());
- String currentView = selectedFilterOpt.getView();
- if (currentView == VIEWS_FILTER)
- {
+ FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
+ .getSelectedItem());
+ String currentView = selectedFilterOpt.getView();
+ if (currentView == VIEWS_FILTER)
+ {
int pdbIdColIndex = getResultTable().getColumn("PDB Id")
.getModelIndex();
int refSeqColIndex = getResultTable().getColumn("Ref Sequence")
- .getModelIndex();
+ .getModelIndex();
int[] selectedRows = getResultTable().getSelectedRows();
- PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
- int count = 0;
- ArrayList<SequenceI> selectedSeqsToView = new ArrayList<SequenceI>();
- for (int row : selectedRows)
- {
+ PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
+ int count = 0;
+ ArrayList<SequenceI> selectedSeqsToView = new ArrayList<SequenceI>();
+ for (int row : selectedRows)
+ {
String pdbIdStr = getResultTable().getValueAt(row,
- pdbIdColIndex)
- .toString();
+ pdbIdColIndex).toString();
SequenceI selectedSeq = (SequenceI) getResultTable()
- .getValueAt(row,
- refSeqColIndex);
- selectedSeqsToView.add(selectedSeq);
+ .getValueAt(row, refSeqColIndex);
+ selectedSeqsToView.add(selectedSeq);
PDBEntry pdbEntry = selectedSeq.getPDBEntry(pdbIdStr);
if (pdbEntry == null)
{
pdbEntry = getFindEntry(pdbIdStr,
selectedSeq.getAllPDBEntries());
}
- if (pdbEntry == null)
- {
- pdbEntry = new PDBEntry();
- pdbEntry.setId(pdbIdStr);
- pdbEntry.setType(PDBEntry.Type.PDB);
- selectedSeq.getDatasetSequence().addPDBId(pdbEntry);
- }
- pdbEntriesToView[count++] = pdbEntry;
- }
- SequenceI[] selectedSeqs = selectedSeqsToView
- .toArray(new SequenceI[selectedSeqsToView.size()]);
+ if (pdbEntry == null)
+ {
+ pdbEntry = new PDBEntry();
+ pdbEntry.setId(pdbIdStr);
+ pdbEntry.setType(PDBEntry.Type.PDB);
+ selectedSeq.getDatasetSequence().addPDBId(pdbEntry);
+ }
+ pdbEntriesToView[count++] = pdbEntry;
+ }
+ SequenceI[] selectedSeqs = selectedSeqsToView
+ .toArray(new SequenceI[selectedSeqsToView.size()]);
launchStructureViewer(ssm, pdbEntriesToView, ap, selectedSeqs);
- }
- else if (currentView == VIEWS_LOCAL_PDB)
- {
- int[] selectedRows = tbl_local_pdb.getSelectedRows();
- PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
- int count = 0;
+ }
+ else if (currentView == VIEWS_LOCAL_PDB)
+ {
+ int[] selectedRows = tbl_local_pdb.getSelectedRows();
+ PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
+ int count = 0;
int pdbIdColIndex = tbl_local_pdb.getColumn("PDB Id")
.getModelIndex();
- int refSeqColIndex = tbl_local_pdb.getColumn("Ref Sequence")
- .getModelIndex();
- ArrayList<SequenceI> selectedSeqsToView = new ArrayList<SequenceI>();
- for (int row : selectedRows)
- {
- PDBEntry pdbEntry = (PDBEntry) tbl_local_pdb.getValueAt(row,
- pdbIdColIndex);
- pdbEntriesToView[count++] = pdbEntry;
- SequenceI selectedSeq = (SequenceI) tbl_local_pdb.getValueAt(row,
- refSeqColIndex);
- selectedSeqsToView.add(selectedSeq);
- }
- SequenceI[] selectedSeqs = selectedSeqsToView
- .toArray(new SequenceI[selectedSeqsToView.size()]);
+ int refSeqColIndex = tbl_local_pdb.getColumn("Ref Sequence")
+ .getModelIndex();
+ ArrayList<SequenceI> selectedSeqsToView = new ArrayList<SequenceI>();
+ for (int row : selectedRows)
+ {
+ PDBEntry pdbEntry = (PDBEntry) tbl_local_pdb.getValueAt(row,
+ pdbIdColIndex);
+ pdbEntriesToView[count++] = pdbEntry;
+ SequenceI selectedSeq = (SequenceI) tbl_local_pdb.getValueAt(
+ row, refSeqColIndex);
+ selectedSeqsToView.add(selectedSeq);
+ }
+ SequenceI[] selectedSeqs = selectedSeqsToView
+ .toArray(new SequenceI[selectedSeqsToView.size()]);
launchStructureViewer(ssm, pdbEntriesToView, ap, selectedSeqs);
- }
- else if (currentView == VIEWS_ENTER_ID)
- {
- SequenceI userSelectedSeq = ((AssociateSeqOptions) idInputAssSeqPanel
- .getCmb_assSeq().getSelectedItem()).getSequence();
- if (userSelectedSeq != null)
- {
- selectedSequence = userSelectedSeq;
- }
+ }
+ else if (currentView == VIEWS_ENTER_ID)
+ {
+ SequenceI userSelectedSeq = ((AssociateSeqOptions) idInputAssSeqPanel
+ .getCmb_assSeq().getSelectedItem()).getSequence();
+ if (userSelectedSeq != null)
+ {
+ selectedSequence = userSelectedSeq;
+ }
- String pdbIdStr = txt_search.getText();
- PDBEntry pdbEntry = selectedSequence.getPDBEntry(pdbIdStr);
- if (pdbEntry == null)
- {
- pdbEntry = new PDBEntry();
+ String pdbIdStr = txt_search.getText();
+ PDBEntry pdbEntry = selectedSequence.getPDBEntry(pdbIdStr);
+ if (pdbEntry == null)
+ {
+ pdbEntry = new PDBEntry();
if (pdbIdStr.split(":").length > 1)
{
pdbEntry.setId(pdbIdStr.split(":")[0]);
{
pdbEntry.setId(pdbIdStr);
}
- pdbEntry.setType(PDBEntry.Type.PDB);
- selectedSequence.getDatasetSequence().addPDBId(pdbEntry);
- }
+ pdbEntry.setType(PDBEntry.Type.PDB);
+ selectedSequence.getDatasetSequence().addPDBId(pdbEntry);
+ }
- PDBEntry[] pdbEntriesToView = new PDBEntry[] { pdbEntry };
+ PDBEntry[] pdbEntriesToView = new PDBEntry[] { pdbEntry };
launchStructureViewer(ssm, pdbEntriesToView, ap,
new SequenceI[] { selectedSequence });
- }
- else if (currentView == VIEWS_FROM_FILE)
- {
- SequenceI userSelectedSeq = ((AssociateSeqOptions) fileChooserAssSeqPanel
- .getCmb_assSeq().getSelectedItem()).getSequence();
- if (userSelectedSeq != null)
- {
- selectedSequence = userSelectedSeq;
- }
- PDBEntry fileEntry = new AssociatePdbFileWithSeq()
- .associatePdbWithSeq(selectedPdbFileName,
- jalview.io.AppletFormatAdapter.FILE,
- selectedSequence, true, Desktop.instance);
+ }
+ else if (currentView == VIEWS_FROM_FILE)
+ {
+ SequenceI userSelectedSeq = ((AssociateSeqOptions) fileChooserAssSeqPanel
+ .getCmb_assSeq().getSelectedItem()).getSequence();
+ if (userSelectedSeq != null)
+ {
+ selectedSequence = userSelectedSeq;
+ }
+ PDBEntry fileEntry = new AssociatePdbFileWithSeq()
+ .associatePdbWithSeq(selectedPdbFileName,
+ jalview.io.AppletFormatAdapter.FILE,
+ selectedSequence, true, Desktop.instance);
launchStructureViewer(ssm, new PDBEntry[] { fileEntry }, ap,
new SequenceI[] { selectedSequence });
- }
- closeAction();
+ }
+ closeAction(preferredHeight);
}
}).start();
}
if (SiftsSettings.isMapWithSifts())
{
- ArrayList<SequenceI> seqsWithoutSourceDBRef = new ArrayList<SequenceI>();
+ List<SequenceI> seqsWithoutSourceDBRef = new ArrayList<SequenceI>();
int p = 0;
// TODO: skip PDBEntry:Sequence pairs where PDBEntry doesn't look like a
// real PDB ID. For moment, we can also safely do this if there is already
{
seqWithoutSrcDBRef[x++] = fSeq;
}
- new DBRefFetcher(seqWithoutSrcDBRef).fetchDBRefs(true);
+ DBRefFetcher dbRefFetcher = new DBRefFetcher(seqWithoutSrcDBRef);
+ dbRefFetcher.fetchDBRefs(true);
}
}
if (pdbEntriesToView.length > 1)
public boolean isStructuresDiscovered()
{
- return structuresDiscovered;
- }
-
- public void setStructuresDiscovered(boolean structuresDiscovered)
- {
- this.structuresDiscovered = structuresDiscovered;
+ return discoveredStructuresSet != null
+ && !discoveredStructuresSet.isEmpty();
}
public Collection<FTSData> getDiscoveredStructuresSet()
public class PDBFeatureSettings extends FeatureSettingsAdapter
{
+ // TODO find one central place to define feature names
+ private static final String FEATURE_INSERTION = "INSERTION";
- public static final String FEATURE_INSERTION = "INSERTION";
-
- public static final String FEATURE_RES_NUM = "RESNUM";
+ private static final String FEATURE_RES_NUM = "RESNUM";
@Override
public boolean isFeatureDisplayed(String type)
protected JScrollPane scrl_localPDB = new JScrollPane(tbl_local_pdb);
- private JTabbedPane pnl_filter = new JTabbedPane();
+ protected JTabbedPane pnl_filter = new JTabbedPane();
protected FTSDataColumnPreferences pdbDocFieldPrefs = new FTSDataColumnPreferences(
PreferenceSource.STRUCTURE_CHOOSER,
@Override
public void actionPerformed(ActionEvent e)
{
- closeAction();
+ closeAction(pnl_filter.getHeight());
}
});
btn_cancel.addKeyListener(new KeyAdapter()
{
if (evt.getKeyCode() == KeyEvent.VK_ENTER)
{
- closeAction();
+ closeAction(pnl_filter.getHeight());
}
}
});
@Override
public void internalFrameClosing(InternalFrameEvent e)
{
- closeAction();
+ closeAction(pnl_filter.getHeight());
}
});
mainFrame.setVisible(true);
Desktop.addInternalFrame(mainFrame, frameTitle, width, height);
}
- protected void closeAction()
+ protected void closeAction(int preferredHeight)
{
// System.out.println(">>>>>>>>>> closing internal frame!!!");
// System.out.println("width : " + mainFrame.getWidth());
// System.out.println("x : " + mainFrame.getX());
// System.out.println("y : " + mainFrame.getY());
tempUserPrefs.put("structureChooser.width", pnl_filter.getWidth());
- tempUserPrefs.put("structureChooser.height", pnl_filter.getHeight());
+ tempUserPrefs.put("structureChooser.height", preferredHeight);
tempUserPrefs.put("structureChooser.x", mainFrame.getX());
tempUserPrefs.put("structureChooser.y", mainFrame.getY());
mainFrame.dispose();
}
+
public boolean wantedFieldsUpdated()
{
if (previousWantedFields == null)
protected abstract void stateChanged(ItemEvent e);
- protected abstract void updateCurrentView();
-
- protected abstract void populateFilterComboBox();
-
protected abstract void ok_ActionPerformed();
protected abstract void pdbFromFile_actionPerformed();
seqMap = new IdentityHashMap<SequenceI, Color[]>();
AnnotatedCollectionI alcontext = alignment instanceof AlignmentI ? alignment
: alignment.getContext();
+ if (alcontext == null)
+ {
+ return;
+ }
int w = 0;
for (AlignmentAnnotation al : alcontext
.findAnnotation(TCoffeeScoreFile.TCOFFEE_SCORE))
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.gui.CutAndPasteTransfer;
+import jalview.gui.DasSourceBrowser;
import jalview.gui.Desktop;
import jalview.gui.FeatureSettings;
import jalview.gui.IProgressIndicator;
import jalview.gui.OOMWarning;
+import jalview.util.DBRefUtils;
import jalview.util.MessageManager;
import jalview.ws.dbsources.das.api.jalviewSourceI;
+import jalview.ws.dbsources.das.datamodel.DasSequenceSource;
import jalview.ws.seqfetcher.DbSourceProxy;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.List;
import java.util.Vector;
import uk.ac.ebi.picr.model.UPEntry;
+import uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperServiceLocator;
/**
* Implements a runnable for validating a sequence against external databases
*/
public class DBRefFetcher implements Runnable
{
+ private static final String NEWLINE = System.lineSeparator();
+
public interface FetchFinishedListenerI
{
void finished();
}
- private List<FetchFinishedListenerI> listeners;
-
SequenceI[] dataset;
IProgressIndicator progressWindow;
CutAndPasteTransfer output = new CutAndPasteTransfer();
- StringBuffer sbuffer = new StringBuffer();
-
boolean running = false;
/**
*/
uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface picrClient = null;
- // /This will be a collection of Vectors of sequenceI refs.
+ // This will be a collection of Vectors of sequenceI refs.
// The key will be the seq name or accession id of the seq
- Hashtable seqRefs;
+ Hashtable<String, Vector<SequenceI>> seqRefs;
DbSourceProxy[] dbSources;
SequenceFetcher sfetcher;
+ private List<FetchFinishedListenerI> listeners;
+
private SequenceI[] alseqs;
- /**
+ /*
* when true - retrieved sequences will be trimmed to cover longest derived
* alignment sequence
*/
trimDsSeqs = Cache.getDefault("TRIM_FETCHED_DATASET_SEQS", true);
if (sources == null)
{
- // af.featureSettings_actionPerformed(null);
- String[] defdb = null, otherdb = sfetcher
- .getDbInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class);
- List<DbSourceProxy> selsources = new ArrayList<DbSourceProxy>();
- Vector<jalviewSourceI> dasselsrc = (featureSettings != null) ? featureSettings
- .getSelectedSources() : new jalview.gui.DasSourceBrowser()
- .getSelectedSources();
- Enumeration<jalviewSourceI> en = dasselsrc.elements();
- while (en.hasMoreElements())
+ setDatabaseSources(featureSettings, isNucleotide);
+ }
+ else
+ {
+ // we assume the caller knows what they're doing and ensured that all the
+ // db source names are valid
+ dbSources = sources;
+ }
+ }
+
+ /**
+ * Helper method to configure the list of database sources to query
+ *
+ * @param featureSettings
+ * @param forNucleotide
+ */
+ void setDatabaseSources(FeatureSettings featureSettings,
+ boolean forNucleotide)
+ {
+ // af.featureSettings_actionPerformed(null);
+ String[] defdb = null;
+ List<DbSourceProxy> selsources = new ArrayList<DbSourceProxy>();
+ Vector<jalviewSourceI> dasselsrc = (featureSettings != null) ? featureSettings
+ .getSelectedSources() : new DasSourceBrowser()
+ .getSelectedSources();
+
+ for (jalviewSourceI src : dasselsrc)
+ {
+ List<DbSourceProxy> sp = src.getSequenceSourceProxies();
+ if (sp != null)
{
- jalviewSourceI src = en.nextElement();
- List<DbSourceProxy> sp = src.getSequenceSourceProxies();
- if (sp != null)
+ selsources.addAll(sp);
+ if (sp.size() > 1)
{
- selsources.addAll(sp);
- if (sp.size() > 1)
- {
- Cache.log.debug("Added many Db Sources for :" + src.getTitle());
- }
+ Cache.log.debug("Added many Db Sources for :" + src.getTitle());
}
}
- // select appropriate databases based on alignFrame context.
- if (isNucleotide)
- {
- defdb = DBRefSource.DNACODINGDBS;
- }
- else
- {
- defdb = DBRefSource.PROTEINDBS;
- }
- List<DbSourceProxy> srces = new ArrayList<DbSourceProxy>();
- for (String ddb : defdb)
+ }
+ // select appropriate databases based on alignFrame context.
+ if (forNucleotide)
+ {
+ defdb = DBRefSource.DNACODINGDBS;
+ }
+ else
+ {
+ defdb = DBRefSource.PROTEINDBS;
+ }
+ List<DbSourceProxy> srces = new ArrayList<DbSourceProxy>();
+ for (String ddb : defdb)
+ {
+ List<DbSourceProxy> srcesfordb = sfetcher.getSourceProxy(ddb);
+ if (srcesfordb != null)
{
- List<DbSourceProxy> srcesfordb = sfetcher.getSourceProxy(ddb);
- if (srcesfordb != null)
+ for (DbSourceProxy src : srcesfordb)
{
- srces.addAll(srcesfordb);
+ if (!srces.contains(src))
+ {
+ srces.addAll(srcesfordb);
+ }
}
}
- // append the PDB data source, since it is 'special', catering for both
- // nucleotide and protein
- srces.addAll(sfetcher.getSourceProxy(DBRefSource.PDB));
-
- // append the selected sequence sources to the default dbs
- srces.addAll(selsources);
- dbSources = srces.toArray(new DbSourceProxy[0]);
- }
- else
- {
- // we assume the caller knows what they're doing and ensured that all the
- // db source names are valid
- dbSources = sources;
}
+ // append the PDB data source, since it is 'special', catering for both
+ // nucleotide and protein
+ // srces.addAll(sfetcher.getSourceProxy(DBRefSource.PDB));
+
+ srces.addAll(selsources);
+ dbSources = srces.toArray(new DbSourceProxy[srces.size()]);
}
/**
}
// append additional sources
DbSourceProxy[] otherdb = sfetcher
- .getDbSourceProxyInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class);
+ .getDbSourceProxyInstances(DasSequenceSource.class);
if (otherdb != null && otherdb.length > 0)
{
DbSourceProxy[] newsrc = new DbSourceProxy[dbSources.length
*/
public void fetchDBRefs(boolean waitTillFinished)
{
+ // TODO can we not simply write
+ // if (waitTillFinished) { run(); } else { new Thread(this).start(); }
+
Thread thread = new Thread(this);
thread.start();
running = true;
{
key = key.toUpperCase();
- Vector seqs;
+ Vector<SequenceI> seqs;
if (seqRefs.containsKey(key))
{
- seqs = (Vector) seqRefs.get(key);
+ seqs = seqRefs.get(key);
if (seqs != null && !seqs.contains(seq))
{
}
else if (seqs == null)
{
- seqs = new Vector();
+ seqs = new Vector<SequenceI>();
seqs.addElement(seq);
}
}
else
{
- seqs = new Vector();
+ seqs = new Vector<SequenceI>();
seqs.addElement(seq);
}
{
if (Cache.getDefault("DBREFFETCH_USEPICR", false))
{
- picrClient = new uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperServiceLocator()
+ picrClient = new AccessionMapperServiceLocator()
.getAccessionMapperPort();
}
} catch (Exception e)
System.err.println("Couldn't locate PICR service instance.\n");
e.printStackTrace();
}
+
+ Vector<SequenceI> sdataset = new Vector<SequenceI>(
+ Arrays.asList(dataset));
+ List<String> warningMessages = new ArrayList<String>();
+
int db = 0;
- Vector sdataset = new Vector();
- for (int s = 0; s < dataset.length; s++)
- {
- sdataset.addElement(dataset[s]);
- }
while (sdataset.size() > 0 && db < dbSources.length)
{
- int maxqlen = 1; // default number of queries made to at one time
- System.err.println("Verifying against " + dbSources[db].getDbName());
- boolean dn = false;
+ int maxqlen = 1; // default number of queries made at one time
+ System.out.println("Verifying against " + dbSources[db].getDbName());
// iterate through db for each remaining un-verified sequence
SequenceI[] currSeqs = new SequenceI[sdataset.size()];
sdataset.copyInto(currSeqs);// seqs that are to be validated against
// dbSources[db]
- Vector queries = new Vector(); // generated queries curSeq
- seqRefs = new Hashtable();
+ Vector<String> queries = new Vector<String>(); // generated queries curSeq
+ seqRefs = new Hashtable<String, Vector<SequenceI>>();
int seqIndex = 0;
- jalview.ws.seqfetcher.DbSourceProxy dbsource = dbSources[db];
+ DbSourceProxy dbsource = dbSources[db];
+ // for moment, we dumbly iterate over all retrieval sources for a
+ // particular database
+ // TODO: introduce multithread multisource queries and logic to remove a
+ // query from other sources if any source for a database returns a
+ // record
+ maxqlen = dbsource.getMaximumQueryCount();
+
+ while (queries.size() > 0 || seqIndex < currSeqs.length)
{
- // for moment, we dumbly iterate over all retrieval sources for a
- // particular database
- // TODO: introduce multithread multisource queries and logic to remove a
- // query from other sources if any source for a database returns a
- // record
- maxqlen = dbsource.getMaximumQueryCount();
-
- while (queries.size() > 0 || seqIndex < currSeqs.length)
+ if (queries.size() > 0)
{
- if (queries.size() > 0)
- {
- // Still queries to make for current seqIndex
- StringBuffer queryString = new StringBuffer("");
- int numq = 0, nqSize = (maxqlen > queries.size()) ? queries
- .size() : maxqlen;
+ // Still queries to make for current seqIndex
+ StringBuffer queryString = new StringBuffer("");
+ int numq = 0;
+ int nqSize = (maxqlen > queries.size()) ? queries
+ .size() : maxqlen;
- while (queries.size() > 0 && numq < nqSize)
- {
- String query = (String) queries.elementAt(0);
- if (dbsource.isValidReference(query))
- {
- queryString.append((numq == 0) ? "" : dbsource
- .getAccessionSeparator());
- queryString.append(query);
- numq++;
- }
- // remove the extracted query string
- queries.removeElementAt(0);
- }
- // make the queries and process the response
- AlignmentI retrieved = null;
- try
- {
- if (jalview.bin.Cache.log.isDebugEnabled())
- {
- jalview.bin.Cache.log.debug("Querying "
- + dbsource.getDbName() + " with : '"
- + queryString.toString() + "'");
- }
- retrieved = dbsource.getSequenceRecords(queryString
- .toString());
- } catch (Exception ex)
- {
- ex.printStackTrace();
- } catch (OutOfMemoryError err)
+ while (queries.size() > 0 && numq < nqSize)
+ {
+ String query = queries.elementAt(0);
+ if (dbsource.isValidReference(query))
{
- new OOMWarning("retrieving database references ("
- + queryString.toString() + ")", err);
+ queryString.append((numq == 0) ? "" : dbsource
+ .getAccessionSeparator());
+ queryString.append(query);
+ numq++;
}
- if (retrieved != null)
+ // remove the extracted query string
+ queries.removeElementAt(0);
+ }
+ // make the queries and process the response
+ AlignmentI retrieved = null;
+ try
+ {
+ if (Cache.log.isDebugEnabled())
{
- transferReferences(sdataset, dbsource.getDbSource(),
- retrieved, trimDsSeqs);
+ Cache.log.debug("Querying " + dbsource.getDbName()
+ + " with : '" + queryString.toString() + "'");
}
+ retrieved = dbsource.getSequenceRecords(queryString.toString());
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ } catch (OutOfMemoryError err)
+ {
+ new OOMWarning("retrieving database references ("
+ + queryString.toString() + ")", err);
+ }
+ if (retrieved != null)
+ {
+ transferReferences(sdataset, dbsource.getDbSource(), retrieved,
+ trimDsSeqs, warningMessages);
}
- else
+ }
+ else
+ {
+ // make some more strings for use as queries
+ for (int i = 0; (seqIndex < dataset.length) && (i < 50); seqIndex++, i++)
{
- // make some more strings for use as queries
- for (int i = 0; (seqIndex < dataset.length) && (i < 50); seqIndex++, i++)
+ SequenceI sequence = dataset[seqIndex];
+ DBRefEntry[] uprefs = DBRefUtils.selectRefs(
+ sequence.getDBRefs(),
+ new String[] { dbsource.getDbSource() }); // jalview.datamodel.DBRefSource.UNIPROT
+ // });
+ // check for existing dbrefs to use
+ if (uprefs != null && uprefs.length > 0)
{
- SequenceI sequence = dataset[seqIndex];
- DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(
- sequence.getDBRefs(),
- new String[] { dbsource.getDbSource() }); // jalview.datamodel.DBRefSource.UNIPROT
- // });
- // check for existing dbrefs to use
- if (uprefs != null && uprefs.length > 0)
+ for (int j = 0; j < uprefs.length; j++)
{
- for (int j = 0; j < uprefs.length; j++)
- {
- addSeqId(sequence, uprefs[j].getAccessionId());
- queries.addElement(uprefs[j].getAccessionId()
- .toUpperCase());
- }
+ addSeqId(sequence, uprefs[j].getAccessionId());
+ queries.addElement(uprefs[j].getAccessionId().toUpperCase());
}
- else
+ }
+ else
+ {
+ // generate queries from sequence ID string
+ StringTokenizer st = new StringTokenizer(sequence.getName(),
+ "|");
+ while (st.hasMoreTokens())
{
- // generate queries from sequence ID string
- StringTokenizer st = new StringTokenizer(
- sequence.getName(), "|");
- while (st.hasMoreTokens())
+ String token = st.nextToken();
+ UPEntry[] presp = null;
+ if (picrClient != null)
{
- String token = st.nextToken();
- UPEntry[] presp = null;
- if (picrClient != null)
+ // resolve the string against PICR to recover valid IDs
+ try
{
- // resolve the string against PICR to recover valid IDs
- try
- {
- presp = picrClient.getUPIForAccession(token, null,
- picrClient.getMappedDatabaseNames(), null,
- true);
- } catch (Exception e)
- {
- System.err.println("Exception with Picr for '"
- + token + "'\n");
- e.printStackTrace();
- }
- }
- if (presp != null && presp.length > 0)
+ presp = picrClient
+ .getUPIForAccession(token, null,
+ picrClient.getMappedDatabaseNames(),
+ null, true);
+ } catch (Exception e)
{
- for (int id = 0; id < presp.length; id++)
- {
- // construct sequences from response if sequences are
- // present, and do a transferReferences
- // otherwise transfer non sequence x-references directly.
- }
- System.out
- .println("Validated ID against PICR... (for what its worth):"
- + token);
- addSeqId(sequence, token);
- queries.addElement(token.toUpperCase());
+ System.err.println("Exception with Picr for '" + token
+ + "'\n");
+ e.printStackTrace();
}
- else
+ }
+ if (presp != null && presp.length > 0)
+ {
+ for (int id = 0; id < presp.length; id++)
{
- // if ()
- // System.out.println("Not querying source with token="+token+"\n");
- addSeqId(sequence, token);
- queries.addElement(token.toUpperCase());
+ // construct sequences from response if sequences are
+ // present, and do a transferReferences
+ // otherwise transfer non sequence x-references directly.
}
+ System.out
+ .println("Validated ID against PICR... (for what its worth):"
+ + token);
+ addSeqId(sequence, token);
+ queries.addElement(token.toUpperCase());
+ }
+ else
+ {
+ // if ()
+ // System.out.println("Not querying source with token="+token+"\n");
+ addSeqId(sequence, token);
+ queries.addElement(token.toUpperCase());
}
}
}
}
// advance to next database
db++;
- } // all databases have been queries.
- if (sbuffer.length() > 0)
+ } // all databases have been queried
+ if (!warningMessages.isEmpty())
{
- output.setText(MessageManager
- .getString("label.your_sequences_have_been_verified")
- + sbuffer.toString());
+ StringBuilder sb = new StringBuilder(warningMessages.size() * 30);
+ sb.append(MessageManager
+ .getString("label.your_sequences_have_been_verified"));
+ for (String msg : warningMessages)
+ {
+ sb.append(msg).append(NEWLINE);
+ }
+ output.setText(sb.toString());
+
Desktop.addInternalFrame(output,
- MessageManager.getString("label.sequence_names_updated"),
+ MessageManager.getString("label.sequences_updated"),
600, 300);
// The above is the dataset, we must now find out the index
// of the viewed sequence
/**
* Verify local sequences in seqRefs against the retrieved sequence database
- * records.
+ * records. Returns true if any sequence was modified as a result (start/end
+ * changed and/or sequence enlarged), else false.
*
+ * @param sdataset
+ * dataset sequences we are retrieving for
+ * @param dbSource
+ * database source we are retrieving from
+ * @param retrievedAl
+ * retrieved sequences as alignment
* @param trimDatasetSeqs
- *
+ * if true, sequences will not be enlarged to match longer retrieved
+ * sequences, only their start/end adjusted
+ * @param warningMessages
+ * a list of messages to add to
*/
- void transferReferences(Vector sdataset, String dbSource,
- AlignmentI retrievedAl, boolean trimDatasetSeqs) // File
- // file)
+ boolean transferReferences(Vector<SequenceI> sdataset,
+ String dbSource,
+ AlignmentI retrievedAl, boolean trimDatasetSeqs,
+ List<String> warningMessages)
{
- System.out.println("trimming ? " + trimDatasetSeqs);
+ // System.out.println("trimming ? " + trimDatasetSeqs);
if (retrievedAl == null || retrievedAl.getHeight() == 0)
{
- return;
+ return false;
}
+
+ boolean modified = false;
SequenceI[] retrieved = recoverDbSequences(retrievedAl
.getSequencesArray());
SequenceI sequence = null;
- boolean transferred = false;
- StringBuffer messages = new StringBuffer();
- // Vector entries = new Uniprot().getUniprotEntries(file);
-
- int i, iSize = retrieved.length; // entries == null ? 0 : entries.size();
- // UniprotEntry entry;
- for (i = 0; i < iSize; i++)
+ for (SequenceI retrievedSeq : retrieved)
{
- SequenceI entry = retrieved[i]; // (UniprotEntry) entries.elementAt(i);
-
// Work out which sequences this sequence matches,
// taking into account all accessionIds and names in the file
- Vector sequenceMatches = new Vector();
+ Vector<SequenceI> sequenceMatches = new Vector<SequenceI>();
// look for corresponding accession ids
- DBRefEntry[] entryRefs = jalview.util.DBRefUtils.selectRefs(
- entry.getDBRefs(), new String[] { dbSource });
+ DBRefEntry[] entryRefs = DBRefUtils.selectRefs(retrievedSeq.getDBRefs(),
+ new String[] { dbSource });
if (entryRefs == null)
{
System.err
.println("Dud dbSource string ? no entryrefs selected for "
- + dbSource + " on " + entry.getName());
+ + dbSource + " on " + retrievedSeq.getName());
continue;
}
for (int j = 0; j < entryRefs.length; j++)
{
- String accessionId = entryRefs[j].getAccessionId(); // .getAccession().elementAt(j).toString();
+ String accessionId = entryRefs[j].getAccessionId();
// match up on accessionId
if (seqRefs.containsKey(accessionId.toUpperCase()))
{
- Vector seqs = (Vector) seqRefs.get(accessionId);
+ Vector<SequenceI> seqs = seqRefs.get(accessionId);
for (int jj = 0; jj < seqs.size(); jj++)
{
- sequence = (SequenceI) seqs.elementAt(jj);
+ sequence = seqs.elementAt(jj);
if (!sequenceMatches.contains(sequence))
{
sequenceMatches.addElement(sequence);
}
}
}
- if (sequenceMatches.size() == 0)
+ if (sequenceMatches.isEmpty())
{
// failed to match directly on accessionId==query so just compare all
// sequences to entry
- Enumeration e = seqRefs.keys();
+ Enumeration<String> e = seqRefs.keys();
while (e.hasMoreElements())
{
- Vector sqs = (Vector) seqRefs.get(e.nextElement());
+ Vector<SequenceI> sqs = seqRefs.get(e.nextElement());
if (sqs != null && sqs.size() > 0)
{
- Enumeration sqe = sqs.elements();
+ Enumeration<SequenceI> sqe = sqs.elements();
while (sqe.hasMoreElements())
{
sequenceMatches.addElement(sqe.nextElement());
*/
// sequenceMatches now contains the set of all sequences associated with
// the returned db record
- String entrySeq = entry.getSequenceAsString().toUpperCase();
+ final String retrievedSeqString = retrievedSeq.getSequenceAsString();
+ String entrySeq = retrievedSeqString.toUpperCase();
for (int m = 0; m < sequenceMatches.size(); m++)
{
- sequence = (SequenceI) sequenceMatches.elementAt(m);
+ sequence = sequenceMatches.elementAt(m);
// only update start and end positions and shift features if there are
// no existing references
// TODO: test for legacy where uniprot or EMBL refs exist but no
// TODO:
// verify sequence against the entry sequence
+ Mapping mp;
+ final int sequenceStart = sequence.getStart();
+
+ boolean remoteEnclosesLocal = false;
String nonGapped = AlignSeq.extractGaps("-. ",
sequence.getSequenceAsString()).toUpperCase();
-
int absStart = entrySeq.indexOf(nonGapped);
- Mapping mp;
-
- final int sequenceStart = sequence.getStart();
if (absStart == -1)
{
// couldn't find local sequence in sequence from database, so check if
{
// verification failed. couldn't find any relationship between
// entrySeq and local sequence
- messages.append(sequence.getName()
- + " SEQUENCE NOT %100 MATCH \n");
+ // messages suppressed as many-to-many matches are confusing
+ // String msg = sequence.getName()
+ // + " Sequence not 100% match with "
+ // + retrievedSeq.getName();
+ // addWarningMessage(warningMessages, msg);
continue;
}
/*
- * found match for the whole of the database sequence within the local
- * sequence's reference frame.
+ * retrieved sequence is a proper subsequence of local sequence
*/
- transferred = true;
- sbuffer.append(sequence.getName() + " HAS " + absStart
- + " PREFIXED RESIDUES COMPARED TO " + dbSource + "\n");
+ String msg = sequence.getName() + " has " + absStart
+ + " prefixed residues compared to "
+ + retrievedSeq.getName();
+ addWarningMessage(warningMessages, msg);
/*
* So create a mapping to the external entry from the matching region of
*/
mp = new Mapping(null, new int[] { sequenceStart + absStart,
sequenceStart + absStart + entrySeq.length() - 1 }, new int[]
- { entry.getStart(), entry.getStart() + entrySeq.length() - 1 },
+ { retrievedSeq.getStart(), retrievedSeq.getStart() + entrySeq.length() - 1 },
1, 1);
updateRefFrame = false;
}
else
{
/*
- * found a match for the local sequence within sequence from
- * the external database
+ * local sequence is a subsequence of (or matches) retrieved sequence
*/
- transferred = true;
-
- // update start and end of local sequence to place it in entry's
- // reference frame.
- // apply identity map map from whole of local sequence to matching
- // region of database
- // sequence
- mp = null; // Mapping.getIdentityMap();
- // new Mapping(null,
- // new int[] { absStart+sequence.getStart(),
- // absStart+sequence.getStart()+entrySeq.length()-1},
- // new int[] { entry.getStart(), entry.getEnd() }, 1, 1);
- // relocate local features for updated start
+ remoteEnclosesLocal = true;
+ mp = null;
if (updateRefFrame)
{
- if (sequence.getSequenceFeatures() != null)
+ SequenceFeature[] sfs = sequence.getSequenceFeatures();
+ if (sfs != null)
{
/*
* relocate existing sequence features by offset
*/
- SequenceFeature[] sf = sequence.getSequenceFeatures();
int start = sequenceStart;
int end = sequence.getEnd();
- int startShift = 1 - absStart - start; // how much the features
- // are
- // to be shifted by
- for (int sfi = 0; sfi < sf.length; sfi++)
+ int startShift = 1 - absStart - start;
+
+ if (startShift != 0)
{
- if (sf[sfi].getBegin() >= start && sf[sfi].getEnd() <= end)
+ for (SequenceFeature sf : sfs)
{
- // shift feature along by absstart
- sf[sfi].setBegin(sf[sfi].getBegin() + startShift);
- sf[sfi].setEnd(sf[sfi].getEnd() + startShift);
+ if (sf.getBegin() >= start && sf.getEnd() <= end)
+ {
+ sf.setBegin(sf.getBegin() + startShift);
+ sf.setEnd(sf.getEnd() + startShift);
+ modified = true;
+ }
}
}
}
}
System.out.println("Adding dbrefs to " + sequence.getName()
- + " from " + dbSource + " sequence : " + entry.getName());
- sequence.transferAnnotation(entry, mp);
+ + " from " + dbSource + " sequence : " + retrievedSeq.getName());
+ sequence.transferAnnotation(retrievedSeq, mp);
- absStart += entry.getStart();
+ absStart += retrievedSeq.getStart();
int absEnd = absStart + nonGapped.length() - 1;
if (!trimDatasetSeqs)
{
- // insert full length sequence from record
- sequence.setSequence(entry.getSequenceAsString());
- sequence.setStart(entry.getStart());
+ /*
+ * update start position and/or expand to longer retrieved sequence
+ */
+ if (!retrievedSeqString.equals(sequence.getSequenceAsString())
+ && remoteEnclosesLocal)
+ {
+ sequence.setSequence(retrievedSeqString);
+ modified = true;
+ addWarningMessage(warningMessages,
+ "Sequence for " + sequence.getName()
+ + " expanded from " + retrievedSeq.getName());
+ }
+ if (sequence.getStart() != retrievedSeq.getStart())
+ {
+ sequence.setStart(retrievedSeq.getStart());
+ modified = true;
+ if (absStart != sequenceStart)
+ {
+ addWarningMessage(warningMessages, "Start/end position for "
+ + sequence.getName() + " updated from "
+ + retrievedSeq.getName());
+ }
+ }
}
if (updateRefFrame)
{
if (trimDatasetSeqs)
{
// just fix start/end
- sequence.setStart(absStart);
- sequence.setEnd(absEnd);
+ if (sequence.getStart() != absStart
+ || sequence.getEnd() != absEnd)
+ {
+ sequence.setStart(absStart);
+ sequence.setEnd(absEnd);
+ modified = true;
+ addWarningMessage(warningMessages, "Start/end for "
+ + sequence.getName() + " updated from "
+ + retrievedSeq.getName());
+ }
}
// search for alignment sequences to update coordinate frame for
for (int alsq = 0; alsq < alseqs.length; alsq++)
{
alseqs[alsq].setEnd(ngAlsq.length()
+ alseqs[alsq].getStart() - 1);
+ modified = true;
}
}
}
// ids, so we can query all enabled DAS servers for them ?
}
}
- if (!transferred)
+ return modified;
+ }
+
+ /**
+ * Adds the message to the list unless it already contains it
+ *
+ * @param messageList
+ * @param msg
+ */
+ void addWarningMessage(List<String> messageList, String msg)
+ {
+ if (!messageList.contains(msg))
{
- // report the ID/sequence mismatches
- sbuffer.append(messages);
+ messageList.add(msg);
}
}
*/
private SequenceI[] recoverDbSequences(SequenceI[] sequencesArray)
{
- Vector nseq = new Vector();
+ Vector<SequenceI> nseq = new Vector<SequenceI>();
for (int i = 0; sequencesArray != null && i < sequencesArray.length; i++)
{
nseq.addElement(sequencesArray[i]);
- DBRefEntry dbr[] = sequencesArray[i].getDBRefs();
- jalview.datamodel.Mapping map = null;
+ DBRefEntry[] dbr = sequencesArray[i].getDBRefs();
+ Mapping map = null;
for (int r = 0; (dbr != null) && r < dbr.length; r++)
{
if ((map = dbr[r].getMap()) != null)
import java.util.ArrayList;
import java.util.List;
-import java.util.Vector;
import com.stevesoft.pat.Regex;
*/
public class Pdb extends EbiFileRetrievedProxy
{
+ private static final String SEPARATOR = "|";
+ private static final String COLON = ":";
+ private static final int PDB_ID_LENGTH = 4;
+
+
public Pdb()
{
super();
}
- public static final String FEATURE_INSERTION = "INSERTION";
-
- public static final String FEATURE_RES_NUM = "RESNUM";
-
/*
* (non-Javadoc)
*
@Override
public String getAccessionSeparator()
{
- // TODO Auto-generated method stub
return null;
}
public AlignmentI getSequenceRecords(String queries) throws Exception
{
AlignmentI pdbAlignment = null;
- Vector result = new Vector();
String chain = null;
String id = null;
- if (queries.indexOf(":") > -1)
+ if (queries.indexOf(COLON) > -1)
{
- chain = queries.substring(queries.indexOf(":") + 1);
- id = queries.substring(0, queries.indexOf(":"));
+ chain = queries.substring(queries.indexOf(COLON) + 1);
+ id = queries.substring(0, queries.indexOf(COLON));
}
else
{
id = queries;
}
- if (queries.length() > 4 && chain == null)
+
+ /*
+ * extract chain code if it is appended to the id and we
+ * don't already have one
+ */
+ if (queries.length() > PDB_ID_LENGTH && chain == null)
{
- chain = queries.substring(4, 5);
- id = queries.substring(0, 4);
+ chain = queries.substring(PDB_ID_LENGTH, PDB_ID_LENGTH + 1);
+ id = queries.substring(0, PDB_ID_LENGTH);
}
+
if (!isValidReference(id))
{
System.err.println("Ignoring invalid pdb query: '" + id + "'");
chid = pid.getChainCode();
}
- ;
-
}
if (chain == null
|| (chid != null && (chid.equals(chain)
{
// FIXME seems to result in 'PDB|1QIP|1qip|A' - 1QIP is redundant.
// TODO: suggest simplify naming to 1qip|A as default name defined
- pdbcs.setName(jalview.datamodel.DBRefSource.PDB + "|" + id
- + "|" + pdbcs.getName());
+ pdbcs.setName(jalview.datamodel.DBRefSource.PDB + SEPARATOR + id
+ + SEPARATOR + pdbcs.getName());
// Might need to add more metadata to the PDBEntry object
// like below
/*
/*
* scenario:
* dna1 --> [4, 6] [10,12] --> pep1
- * dna2 --> [1, 3] [7, 9] [13,15] --> pep1
+ * dna2 --> [1, 3] [7, 9] [13,15] --> pep2
*/
SequenceI dna1 = new Sequence("dna1", "aaaGGGcccTTTaaa");
SequenceI dna2 = new Sequence("dna2", "GGGcccTTTaaaCCC");
dna.setDataset(null);
/*
+ * put a variant feature on dna2 base 8
+ * - should transfer to cds2 base 5
+ */
+ dna2.addSequenceFeature(new SequenceFeature("variant", "hgmd", 8, 8,
+ 0f, null));
+
+ /*
* need a sourceDbRef if we are to construct dbrefs to the CDS
* sequence from the dna contig sequences
*/
assertSame(cds2Dss, m.getSequence());
assertEquals(7, m.getStart());
assertEquals(9, m.getEnd());
+
+ /*
+ * check cds2 acquired a variant feature in position 5
+ */
+ SequenceFeature[] sfs = cds2Dss.getSequenceFeatures();
+ assertNotNull(sfs);
+ assertEquals(1, sfs.length);
+ assertEquals("variant", sfs[0].type);
+ assertEquals(5, sfs[0].begin);
+ assertEquals(5, sfs[0].end);
}
/**
}
@Test(groups = { "Functional" })
- public void populateFilterComboBoxTest()
+ public void populateFilterComboBoxTest() throws InterruptedException
{
SequenceI[] selectedSeqs = new SequenceI[] { seq };
StructureChooser sc = new StructureChooser(selectedSeqs, seq, null);
- sc.populateFilterComboBox();
+ sc.populateFilterComboBox(false);
int optionsSize = sc.getCmbFilterOption().getItemCount();
assertEquals(3, optionsSize); // if structures are not discovered then don't
// populate filter options
- sc.setStructuresDiscovered(true);
- sc.populateFilterComboBox();
- try
- {
- Thread.sleep(2000);
- } catch (InterruptedException e)
- {
- e.printStackTrace();
- }
+ sc.populateFilterComboBox(true);
optionsSize = sc.getCmbFilterOption().getItemCount();
assertTrue(optionsSize > 3); // if structures are found, filter options
// should be populated