--- /dev/null
+
+import jalview.bin.Jalview
+import jalview.io.gff.GffConstants;
+import jalview.workers.AnnotationProviderI
+import jalview.workers.AlignmentAnnotationFactory
+import jalview.datamodel.*;
+
+/*
+ * Define something that counts each visible feature type
+ */
+def sdppredCounter =
+ [
+ getNames: { visibleFeatures as String[] },
+ getDescriptions: { visibleFeatures as String[] },
+ getMinColour: { [0, 255, 255] as int[] }, // cyan
+ getMaxColour: { [0, 0, 255] as int[] }, // blue
+ count:
+ { res, feats ->
+ getCounts.call(feats)
+ },
+ calculateAnnotation:
+ { al, feat_rend ->
+ ProfilesI a_prof=al.getSequenceConsensusHash();
+ al_width = a_prof.getEndColumn();
+// jalview.datamodel.Annotation ai[] = new jalview.datamodel.Annotation[al_width];
+ def sg_profs = [];
+ al.getGroups().each({group -> sg_profs << group.getSequenceConsensusHash() });
+ if (sg_profs==null) {
+ return null;
+ }
+ annot = new Annotation[al_width];
+ for (int c=0;c<al_width;c++) {
+ def al_p=a_prof.get(c);
+ if (al_p!=null) {
+ def al_ng = al_p.getNonGapped()
+ if (al_p.getCounts()!=null) {
+ al_p = al_p.getCounts().getSymbolCounts();
+ def tot_count=[foo:0];
+ for (int a=al_p.values.length-1;a>-1;a--) {
+ tot_count << [(al_p.symbols[a]):(al_p.values[a])]
+ }
+ Ip=0.0;
+ if (al_ng>0) {
+ sg_profs.each({sg_prof ->
+ if (sg_prof!=null) {count = sg_prof.get(c);
+ if ((count!=null) && (count.getCounts()!=null)) {
+ g_size = count.getHeight();
+ count = count.getCounts().getSymbolCounts();
+ for (int a=count.values.length-1;a>-1; a--) {
+ Ip+= (count.values[a]/al_ng) * Math.log((count.values[a]*al_ng)/(g_size*tot_count[(count.symbols[a])]));
+ }
+ }
+ }
+ });
+ annot[c]=new Annotation((float) Ip);
+
+ }
+ }
+ }
+ }
+ AlignmentAnnotation annotrow = new AlignmentAnnotation("SDPpred","SDP calculation results for groups using displayed sequence logos for each group",annot);
+ annotrow.setCalcId("SDPPRED");
+ return [annotrow];
+ }
+ ] as AnnotationProviderI
+
+def alf = Jalview.getCurrentAlignFrame()
+alf.viewport.setShowGroupConsensus(true)
+alf.viewport.setShowSequenceLogo(true)
+alf.applyAutoAnnotationSettings.setState(true)
+alf.alignPanel.updateAnnotation(true)
+/*
+ * and register the counter
+ */
+AlignmentAnnotationFactory.newCalculator(sdppredCounter)
\ No newline at end of file
sqinfo.put("Description", seq.getDescription());
}
- Vector<SequenceFeature> sfeat = new Vector<SequenceFeature>();
- List<SequenceFeature> sfs = seq.getFeatures().getAllFeatures();
- sfeat.addAll(sfs);
-
if (seq.getDatasetSequence() == null)
{
+ Vector<SequenceFeature> sfeat = new Vector<>();
+ List<SequenceFeature> sfs = seq.getFeatures().getAllFeatures();
+ sfeat.addAll(sfs);
sqinfo.put("SeqFeatures", sfeat);
sqinfo.put("PdbId",
(seq.getAllPDBEntries() != null) ? seq.getAllPDBEntries()
package jalview.datamodel;
import jalview.analysis.AlignmentUtils;
+import jalview.analysis.Conservation;
import jalview.datamodel.AlignedCodonFrame.SequenceToSequenceMapping;
import jalview.io.FastaFile;
import jalview.util.Comparison;
private List<AlignedCodonFrame> codonFrameList;
+ private Conservation conservation;
+
+ private ProfilesI consensus;
+
+ private Hashtable[] codonConsensus, rnaStructureConsensus;
+
private void initAlignment(SequenceI[] seqs)
{
groups = Collections.synchronizedList(new ArrayList<SequenceGroup>());
}
}
+ @Override
+ public Hashtable[] getComplementConsensusHash()
+ {
+ return codonConsensus;
+ }
+
+ @Override
+ public Conservation getConservation()
+ {
+ return conservation;
+ }
+
+ @Override
+ public Hashtable[] getRnaStructureConsensusHash()
+ {
+ return rnaStructureConsensus;
+ }
+
+ @Override
+ public ProfilesI getSequenceConsensusHash()
+ {
+ return consensus;
+ }
+
+ @Override
+ public void setComplementConsensusHash(Hashtable[] hconsensus)
+ {
+ codonConsensus = hconsensus;
+
+ }
+
+ @Override
+ public void setConservation(Conservation cons)
+ {
+ conservation = cons;
+
+ }
+
+ @Override
+ public void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus)
+ {
+ rnaStructureConsensus = hStrucConsensus;
+
+ }
+
+ @Override
+ public void setSequenceConsensusHash(ProfilesI hconsensus)
+ {
+ consensus = hconsensus;
+
+ }
}
*/
package jalview.datamodel;
+import jalview.analysis.Conservation;
+
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
public HiddenColumns propagateInsertions(SequenceI profileseq,
AlignmentView input);
+ void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus);
+
+ void setSequenceConsensusHash(ProfilesI hconsensus);
+
+ void setComplementConsensusHash(Hashtable[] hconsensus);
+
+ void setConservation(Conservation cons);
+
}
*/
package jalview.datamodel;
+import jalview.analysis.Conservation;
+
+import java.util.Hashtable;
import java.util.List;
import java.util.Map;
* @return
*/
boolean isNucleotide();
+
+ /**
+ *
+ * @return the physicochemical property conservation for this sequence
+ * collection (protein only)
+ */
+ Conservation getConservation();
+
+ /**
+ *
+ * @return null or a valid Codon consensus object (protein only)
+ */
+ Hashtable[] getComplementConsensusHash();
+
+ /**
+ *
+ * @return null or a valid RNA Structure base pair consensus object (nucleotide
+ * only)
+ */
+ Hashtable[] getRnaStructureConsensusHash();
+
+ /**
+ *
+ * @return null or the consensus profile for this collection if it has been
+ * calculated
+ */
+ ProfilesI getSequenceConsensusHash();
+
}
import java.beans.PropertyChangeSupport;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Hashtable;
import java.util.List;
import java.util.Map;
*
* @return DOCUMENT ME!
*/
+ @Override
public Conservation getConservation()
{
return conserve;
public ProfilesI consensusData = null;
+ @Override
+ public ProfilesI getSequenceConsensusHash()
+ {
+ return consensusData;
+ }
+
+ @Override
+ public Hashtable[] getComplementConsensusHash()
+ {
+ // TODO: Groupwise CDS Consensus
+ return null;
+ }
+
+ @Override
+ public Hashtable[] getRnaStructureConsensusHash()
+ {
+ // TODO Groupwise RNA Consensus
+ return null;
+ }
+
private void _updateConsensusRow(ProfilesI cnsns, long nseq)
{
if (consensus == null)
@Override
public void setConservation(Conservation cons)
{
+ alignment.setConservation(cons);
hconservation = cons;
}
@Override
public void setSequenceConsensusHash(ProfilesI hconsensus)
{
+ alignment.setSequenceConsensusHash(hconsensus);
this.hconsensus = hconsensus;
}
public void setComplementConsensusHash(
Hashtable<String, Object>[] hconsensus)
{
+ alignment.setComplementConsensusHash(hconsensus);
this.hcomplementConsensus = hconsensus;
}
public void setRnaStructureConsensusHash(
Hashtable<String, Object>[] hStrucConsensus)
{
+ alignment.setRnaStructureConsensusHash(hStrucConsensus);
this.hStrucConsensus = hStrucConsensus;
}
for (AlignmentAnnotation ann : anns)
{
AlignmentAnnotation theAnn = alignment.findOrCreateAnnotation(
- ann.label, ann.description, false, null, null);
+ ann.label, ann.getCalcId(), ann.autoCalculated,
+ ann.sequenceRef,
+ ann.groupRef);
+ if (ann.description!=null) {
+ theAnn.description = ann.description;
+ }
theAnn.showAllColLabels = true;
theAnn.graph = AlignmentAnnotation.BAR_GRAPH;
theAnn.scaleColLabel = true;