start = regions[r][0];\r
for (int s = 0; s < seqs.length; s++)\r
{\r
- sequence = seqs[s].getSequence();\r
+ sequence = seqs[s].getSequenceAsString();\r
StringBuffer newSeq = new StringBuffer();\r
\r
if (regions[r][1] > sequence.length())\r
if(command.seqs[i].getLength()>command.position)\r
{\r
command.string[i] = command.seqs[i].getSequence(command.position,\r
- command.position + command.number).toCharArray();\r
+ command.position + command.number);\r
\r
command.seqs[i].deleteChars(command.position,\r
command.position + command.number);\r
else\r
command.al.addSequence(command.seqs[i]);\r
}\r
- tmp = new StringBuffer(command.seqs[i].getSequence());\r
+ tmp = new StringBuffer();\r
+ tmp.append(command.seqs[i].getSequence());\r
\r
if(command.string!=null && command.string[i]!=null)\r
{\r
deletedCols = 0;\r
startCol = -1;\r
endCol = -1;\r
- sequence = seqs[s].getSequence(start, end+1).toCharArray();\r
+ sequence = seqs[s].getSequence(start, end+1);\r
\r
jSize = sequence.length;\r
for (j=0; j<jSize; j++)\r
{
Sequence ds = new Sequence(snew.getName(),
AlignSeq.extractGaps("-. ",
- snew.getSequence()),
+ snew.getSequenceAsString()),
snew.getStart(),
snew.getEnd());
for (int i = 0; i < sequences.size(); i++)
{
Sequence seq = (Sequence) sequences.elementAt(i);
- seq.setSequence( seq.getSequence().replace('.', gc) );
- seq.setSequence( seq.getSequence().replace('-', gc) );
- seq.setSequence( seq.getSequence().replace(' ', gc) );
+ seq.setSequence( seq.getSequenceAsString().replace('.', gc) );
+ seq.setSequence( seq.getSequenceAsString().replace('-', gc) );
+ seq.setSequence( seq.getSequenceAsString().replace(' ', gc) );
}
}
seqs[i] = new Sequence(currentSeq.getName(),
AlignSeq.extractGaps(
jalview.util.Comparison.GapChars,
- currentSeq.getSequence()
+ currentSeq.getSequenceAsString()
),
currentSeq.getStart(),
currentSeq.getEnd());
width = seqcigararray.getWidth(); // visible width
}
/**
- * Create an alignmentView where the first column corresponds with the 'firstcol' column of some reference alignment
+ * Create an alignmentView where the first column corresponds with the 'firstcol' column of some reference alignment
* @param sdata
* @param firstcol
*/
}
else
{
- alignment[s].setSequence(alignment[s].getSequence() +
+ alignment[s].setSequence(alignment[s].getSequenceAsString() +
mseq[s].getSequence());
if (mseq[s].getStart() <= mseq[s].getEnd())
{
}
else
{
- alignment[s].setSequence(alignment[s].getSequence() +
+ alignment[s].setSequence(alignment[s].getSequenceAsString() +
oseq.getSequence());
if (oseq.getEnd() >= oseq.getStart())
{
}
else
{
- alignment[s].setSequence(alignment[s].getSequence() +
+ alignment[s].setSequence(alignment[s].getSequenceAsString() +
hseq.getSequence());
if (hseq.getEnd() >= hseq.getStart())
{
}
else
{
- alignment[s].setSequence(alignment[s].getSequence() +
+ alignment[s].setSequence(alignment[s].getSequenceAsString() +
mseq[s].getSequence());
if (mseq[s].getEnd() >= mseq[s].getStart())
{
}
else
{
- alignment[s].setSequence(alignment[s].getSequence() +
+ alignment[s].setSequence(alignment[s].getSequenceAsString() +
oseq.getSequence());
if (oseq.getEnd() >= oseq.getStart())
{
}
/**
* returns simple array of start end positions of visible range on alignment.
- * vis_start and vis_end are inclusive - use SequenceI.getSubSequence(vis_start, vis_end+1) to recover visible sequence from underlying alignment.
+ * vis_start and vis_end are inclusive - use SequenceI.getSubSequence(vis_start, vis_end+1) to recover visible sequence from underlying alignment.
* @return int[] { start_i, end_i } for 1<i<n visible regions.
*/
public int[] getVisibleContigs() {
viscontigs[nvis+1]=contigs[contig+1]-1; // end is inclusive
nvis+=2;
}
- start = contigs[contig + 1] + contigs[contig + 2];
+ start = contigs[contig + 1] + contigs[contig + 2];
}
if (start<fwidth) {
viscontigs[nvis] = start;
}
}
/**
- *
- * @return position of first visible column of AlignmentView within its parent's alignment reference frame
+ *
+ * @return position of first visible column of AlignmentView within its parent's alignment reference frame
*/
public int getAlignmentOrigin() {
// TODO Auto-generated method stub
public void encode()\r
{\r
// Set all matrix to 0\r
- dbinary = new double[getSequence().length() * 21];\r
+ dbinary = new double[getSequence().length * 21];\r
\r
int nores = 21;\r
\r
dbinary[i] = 0.0;\r
}\r
\r
- for (int i = 0; i < getSequence().length(); i++)\r
+ for (int i = 0; i < getSequence().length; i++)\r
{\r
int aanum = 20;\r
\r
try\r
{\r
- aanum = ResidueProperties.aaIndex[getSequence().charAt(i)];\r
+ aanum = ResidueProperties.aaIndex[getCharAt(i)];\r
}\r
catch (NullPointerException e)\r
{\r
public void blosumEncode()\r
{\r
// Set all matrix to 0\r
- dbinary = new double[getSequence().length() * 21];\r
+ dbinary = new double[getSequence().length * 21];\r
\r
int nores = 21;\r
\r
//for (int i = 0; i < dbinary.length; i++) {\r
// dbinary[i] = 0.0;\r
//}\r
- for (int i = 0; i < getSequence().length(); i++)\r
+ for (int i = 0; i < getSequence().length; i++)\r
{\r
int aanum = 20;\r
\r
try\r
{\r
- aanum = ResidueProperties.aaIndex[getSequence().charAt(i)];\r
+ aanum = ResidueProperties.aaIndex[getCharAt(i)];\r
}\r
catch (NullPointerException e)\r
{\r
{\r
for(i=0; i<iSize; i++)\r
{\r
- selection[i] = seqs[i].getSequence(start, end);\r
+ selection[i] = seqs[i].getSequenceAsString(start, end);\r
}\r
}\r
\r
public String getSequenceString(char GapChar)
{
return (length == 0) ? "" :
- (String) getSequenceAndDeletions(refseq.getSequence().substring(start, end), GapChar)[0];
+ (String) getSequenceAndDeletions(refseq.getSequenceAsString(start, end), GapChar)[0];
}
/**
{
return null;
}
- Object[] edit_result = getSequenceAndDeletions(refseq.getSequence().substring(start,end),
+ Object[] edit_result = getSequenceAndDeletions(refseq.getSequenceAsString(start,end),
GapChar);
if (edit_result == null)
{
}
if (_s<0)
throw new Error("Implementation Error: _s="+_s);
- String seq_string = seq.getSequence();
+ String seq_string = seq.getSequenceAsString();
if (_e==0 || _e<_s || _e>seq_string.length())
_e=seq_string.length();
// resolve start and end positions relative to ungapped reference sequence
for (int i = 0; i < alseqs.length; i++)
{
alseqs_string[i]=alseqs[i].getRefSeq().
- getSequence().substring(alseqs[i].start,alseqs[i].end);
+ getSequenceAsString(alseqs[i].start,alseqs[i].end);
gs_regions[i] = alseqs[i].getSequenceAndDeletions(alseqs_string[i], gapCharacter); // gapped sequence, {start, start col, end. endcol}, hidden regions {{start, end, col}})
if (gs_regions[i] == null)
{
{
int e = st + rs;
sub_se_gp.deleteRange(st, e);
- String ssgapedseq = sub_se_gp.getSeq('-').getSequence();
+ String ssgapedseq = sub_se_gp.getSeq('-').getSequenceAsString();
System.out.println(st + "," + e + "\t:" + ssgapedseq);
st -=3;
}
*/
package jalview.datamodel;
-import java.awt.*;
import java.util.*;
{
SequenceI datasetSequence;
String name;
- private String sequence;
+ private char [] sequence;
String description;
int start;
int end;
public Sequence(String name, String sequence, int start, int end)
{
this.name = name;
- this.sequence = sequence;
+ this.sequence = sequence.toCharArray();
this.start = start;
this.end = end;
-
parseId();
+ checkValidRange();
+ }
+ public Sequence(String name, char [] sequence, int start, int end)
+ {
+ this.name = name;
+ this.sequence = sequence;
+ this.start = start;
+ this.end = end;
+ parseId();
checkValidRange();
}
if (end < 1)
{
int endRes = 0;
- char ch;
- for (int j = 0; j < sequence.length(); j++)
+ for (int j = 0; j < sequence.length; j++)
{
- ch = sequence.charAt(j);
- if (!jalview.util.Comparison.isGap( (ch)))
+ if (!jalview.util.Comparison.isGap( sequence[j] ))
{
endRes++;
}
*/
public int getLength()
{
- return this.sequence.length();
+ return this.sequence.length;
}
/**
*/
public void setSequence(String seq)
{
- this.sequence = seq;
+ this.sequence = seq.toCharArray();
checkValidRange();
}
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public String getSequence()
+
+ public String getSequenceAsString()
+ {
+ return new String(sequence);
+ }
+
+ public String getSequenceAsString(int start, int end)
+ {
+ return new String(getSequence(start, end));
+ }
+
+
+ public char [] getSequence()
{
- return this.sequence;
+ return sequence;
}
/**
*
* @return DOCUMENT ME!
*/
- public String getSequence(int start, int end)
+ public char [] getSequence(int start, int end)
{
// JBPNote - left to user to pad the result here (TODO:Decide on this policy)
- if (start >= sequence.length())
+ if (start >= sequence.length)
{
- return "";
+ System.out.println("DOES THIS GET CALLED???");
}
- if (end >= sequence.length())
+ if (end >= sequence.length)
{
- end = sequence.length();
+ end = sequence.length;
}
- return this.sequence.substring(start, end);
+ char [] reply = new char[end-start];
+ System.arraycopy(sequence, start, reply, 0, end-start);
+
+ return reply;
}
+
/**
* make a new Sequence object from start to end (including gaps) over this seqeunce
* @param start int
{
if (start < 0)
start = 0;
- String seq = getSequence(start, end);
- if (seq == "")
+ char [] seq = getSequence(start, end);
+ if (seq.length == 0)
return null;
int nstart = findPosition(start);
int nend = findPosition(end) - 1;
*/
public char getCharAt(int i)
{
- if (i < sequence.length())
+ if (i < sequence.length)
{
- return sequence.charAt(i);
+ return sequence[i];
}
else
{
int j = start;
int i = 0;
- while ( (i < sequence.length()) && (j <= end) && (j <= pos))
+ while ( (i < sequence.length) && (j <= end) && (j <= pos))
{
- if (!jalview.util.Comparison.isGap(sequence.charAt(i)))
+ if (!jalview.util.Comparison.isGap(sequence[i]))
{
j++;
}
{
int j = 0;
int pos = start;
- int seqlen = sequence.length();
+ int seqlen = sequence.length;
while ( (j < i) && (j < seqlen))
{
- if (!jalview.util.Comparison.isGap( (sequence.charAt(j))))
+ if (!jalview.util.Comparison.isGap( sequence[j] ))
{
pos++;
}
public int[] gapMap()
{
String seq = jalview.analysis.AlignSeq.extractGaps(jalview.util.Comparison.
- GapChars, sequence);
+ GapChars, new String(sequence));
int[] map = new int[seq.length()];
int j = 0;
int p = 0;
- while (j < sequence.length())
+ while (j < sequence.length)
{
- if (!jalview.util.Comparison.isGap(sequence.charAt(j)))
+ if (!jalview.util.Comparison.isGap(sequence[j]))
{
map[p++] = j;
}
* DOCUMENT ME!
*
* @param i DOCUMENT ME!
- */
- public void deleteCharAt(int i)
- {
- if (i >= sequence.length())
- {
- return;
- }
-
- sequence = sequence.substring(0, i) + sequence.substring(i + 1);
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param i DOCUMENT ME!
* @param j DOCUMENT ME!
*/
public void deleteChars(int i, int j)
{
- if (i >= sequence.length())
+ if (i >= sequence.length)
{
return;
}
- if (j >= sequence.length())
+ char [] tmp;
+
+ if (j >= sequence.length)
{
- sequence = sequence.substring(0, i);
+ tmp = new char[i];
+ System.arraycopy(sequence,0,tmp,0,i);
}
else
{
- sequence = sequence.substring(0, i) + sequence.substring(j);
+ tmp = new char[sequence.length-j+i];
+ System.arraycopy(sequence,0,tmp,0,i);
+ System.arraycopy(sequence,j,tmp,i,sequence.length-j);
}
+
+ sequence = tmp;
}
/**
*/
public void insertCharAt(int i, int length, char c)
{
- StringBuffer tmp;
+ char [] tmp = new char[sequence.length+length];
- if (i >= sequence.length())
+ if (i >= sequence.length)
{
- tmp = new StringBuffer(sequence);
+ System.arraycopy(sequence, 0, tmp, 0, sequence.length);
+ i = sequence.length;
}
else
- tmp = new StringBuffer(sequence.substring(0, i));
+ {
+ System.arraycopy(sequence, 0, tmp, 0, i);
+ }
+
+ int index = i;
while (length > 0)
{
- tmp.append(c);
+ tmp[ index++ ] = c;
length--;
}
- if (i < sequence.length())
+ if (i < sequence.length)
{
- tmp.append(sequence.substring(i));
+ System.arraycopy(sequence, i, tmp, index, sequence.length-i );
}
- sequence = tmp.toString();
+ sequence = tmp;
}
public void insertCharAt(int i, char c)
import java.util.*;
-import java.awt.*;
-
/**
* DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
- public String getSequence();
+ public String getSequenceAsString();
/**
* DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
- public String getSequence(int start, int end);
+ public String getSequenceAsString(int start, int end);
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public char [] getSequence();
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param start DOCUMENT ME!
+ * @param end DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public char [] getSequence(int start, int end);
/**
* create a new sequence object from start to end of this sequence
* @param start int
*/
public void deleteChars(int i, int j);
- /**
- * DOCUMENT ME!
- *
- * @param i DOCUMENT ME!
- */
- public void deleteCharAt(int i);
/**
* DOCUMENT ME!
cons.findQuality();
}
- String sequence = cons.getConsSequence().getSequence();
+ char [] sequence = cons.getConsSequence().getSequence();
float minR;
float minG;
float minB;
{
float value = 0;
- c = sequence.charAt(i);
+ c = sequence[i];
if (Character.isDigit(c))
value = (int) (c - '0');
} else {
for(i=0; i<iSize; i++)
{
- selection[i] = seqs[i].getSequence(start, end);
+ selection[i] = seqs[i].getSequenceAsString(start, end);
}
}
SequenceI [] dseqs=new SequenceI[] { sq.getDatasetSequence()};
if (dseqs[0]==null) {
dseqs[0] = new Sequence(sq);
- dseqs[0].setSequence(jalview.analysis.AlignSeq.extractGaps(jalview.util.Comparison.GapChars, sq.getSequence()));
+ dseqs[0].setSequence(
+ jalview.analysis.AlignSeq.extractGaps(
+ jalview.util.Comparison.GapChars,
+ sq.getSequenceAsString()));
+
sq.setDatasetSequence(dseqs[0]);
}
Alignment ds=new Alignment(dseqs);
int pady = (y1 + av.charHeight) - av.charHeight / 5;\r
for (i = fstart; i <= fend; i++)\r
{\r
- s = seq.getSequence().charAt(i);\r
+ s = seq.getCharAt(i);\r
\r
if (jalview.util.Comparison.isGap(s))\r
{\r
continue;\r
}\r
\r
- item = seq.getSequence();\r
+ item = seq.getSequenceAsString();\r
if(!caseSensitive.isSelected())\r
item = item.toUpperCase();\r
\r
drawIdString(gg, s, i, 0, ypos);\r
}\r
\r
- if(labels!=null)\r
+ if(labels!=null && av.showAnnotation)\r
{\r
gg.translate(0, ypos+(alheight * av.charHeight));\r
labels.drawComponent(gg, getWidth());\r
gg.translate(0, -ypos-(alheight * av.charHeight));\r
}\r
-\r
-\r
}\r
}\r
else\r
vamsasSeq = new Sequence();
vamsasSeq.setId(id + "");
vamsasSeq.setName(jds.getName());
- vamsasSeq.setSequence(jds.getSequence());
+ vamsasSeq.setSequence(jds.getSequenceAsString());
vamsasSeq.setDescription(jds.getDescription());
if (jds.getDatasetSequence().getDBRef() != null)
\r
if(omitHidden==null)\r
{\r
- seqi = originalSequences[i].getSequence(start, end);\r
- seqj = originalSequences[j].getSequence(start, end);\r
+ seqi = originalSequences[i].getSequenceAsString(start, end);\r
+ seqj = originalSequences[j].getSequenceAsString(start, end);\r
}\r
else\r
{\r
/////////////////////////////
Sequence ds = new Sequence(sequences[i].getName(),
AlignSeq.extractGaps("-. ",
- sequences[i].getSequence()),
+ sequences[i].getSequenceAsString()),
sequences[i].getStart(),
sequences[i].getEnd());
sequences[i].setDatasetSequence(ds);
{\r
if (cs != null)\r
{\r
- resBoxColour = cs.findColour(seq.getSequence(i, i + 1), i);\r
+ resBoxColour = cs.findColour(seq.getCharAt(i), i);\r
}\r
else if(forOverview && !jalview.util.Comparison.isGap(seq.getCharAt(i)))\r
{\r
&& !av.getColourText()\r
&& av.thresholdTextColour==0)\r
{\r
- if(av.renderGaps)\r
- graphics.drawString(seq.getSequence(start, end + 1), 0, y1);\r
- else\r
+ if (av.renderGaps)\r
+ graphics.drawString(seq.getSequenceAsString(start, end + 1), 0, y1);\r
+ else\r
{\r
char gap = av.getGapCharacter();\r
- graphics.drawString( seq.getSequence(start, end+1).replace(gap, ' '), 0, y1);\r
+ graphics.drawString( seq.getSequenceAsString(start, end+1).replace(gap, ' '), 0, y1);\r
}\r
}\r
else\r
{\r
if (i < seq.getLength())\r
{\r
- s = seq.getSequence().charAt(i);\r
+ s = seq.getCharAt(i);\r
}\r
\r
charOffset = (av.charWidth - fm.charWidth(s)) / 2;\r
\r
try\r
{\r
- col = oldColourScheme.findColour(aa, -1);\r
+ col = oldColourScheme.findColour(aa.charAt(0), -1);\r
}\r
catch (Exception ex)\r
{ }\r
}\r
\r
// Checks whether sequence is valid aa characters\r
- protected boolean isValidProteinSequence(String sequence)\r
+ protected boolean isValidProteinSequence(char [] sequence)\r
{\r
- for (int i = 0; i < sequence.length(); i++)\r
- if (jalview.schemes.ResidueProperties.aaIndex[sequence.charAt(i)]==-1)\r
+ for (int i = 0; i < sequence.length; i++)\r
+ if (jalview.schemes.ResidueProperties.aaIndex[sequence[i]]==-1)\r
{\r
- invalidCharacter = sequence.charAt(i);\r
+ invalidCharacter = sequence[i];\r
return false;\r
}\r
\r
for(int j=0; j<annotations.length; j++)\r
{\r
if(annotations[j]!=null)\r
- annotations[j].colour = ucs.findColour("A");\r
+ annotations[j].colour = ucs.findColour('A');\r
}\r
}\r
}\r
if(st.hasMoreTokens())\r
{\r
UserColourScheme ucs = new UserColourScheme(st.nextToken());\r
- colour = ucs.findColour("A");\r
+ colour = ucs.findColour('A');\r
}\r
\r
annotation.setThreshold(new GraphLine(value, label, colour));\r
{\r
out.append(">" + printId(s[i]) +"\n");\r
\r
- if (s[i].getSequence().length() > max)\r
+ if (s[i].getSequence().length > max)\r
{\r
- max = s[i].getSequence().length();\r
+ max = s[i].getSequence().length;\r
}\r
\r
i++;\r
\r
while ((i < s.length) && (s[i] != null))\r
{\r
- if (s[i].getSequence().length() > j)\r
+ if (s[i].getSequence().length > j)\r
{\r
- out.append(s[i].getSequence().substring(j, j + 1));\r
+ out.append(s[i].getSequenceAsString(j, j + 1));\r
}\r
else\r
{\r
{\r
String tmp = printId(s[i]);\r
\r
- if (s[i].getSequence().length() > max)\r
+ if (s[i].getSequence().length > max)\r
{\r
- max = s[i].getSequence().length();\r
+ max = s[i].getSequence().length;\r
}\r
\r
if (tmp.length() > maxid)\r
int start = i * len;\r
int end = start + len;\r
\r
- if ( (end < s[j].getSequence().length()) &&\r
- (start < s[j].getSequence().length()))\r
+ if ( (end < s[j].getSequence().length) &&\r
+ (start < s[j].getSequence().length))\r
{\r
- out.append(s[j].getSequence().substring(start, end));\r
+ out.append(s[j].getSequenceAsString(start, end));\r
}\r
else\r
{\r
- if (start < s[j].getSequence().length())\r
+ if (start < s[j].getSequence().length)\r
{\r
- out.append(s[j].getSequence().substring(start));\r
+ out.append(s[j].getSequenceAsString().substring(start));\r
}\r
}\r
\r
System.out.println("Adding dbref to " + sequence.getName() + " : " +\r
entry.getAccession().elementAt(0).toString());\r
\r
- String nonGapped = AlignSeq.extractGaps("-. ", sequence.getSequence()).\r
+ String nonGapped = AlignSeq.extractGaps("-. ",\r
+ sequence.getSequenceAsString()).\r
toUpperCase();\r
\r
int absStart = entry.getUniprotSequence().getContent().indexOf(\r
{\r
if (count != 0)\r
{\r
- if (!isValidProteinSequence(sb.toString()))\r
+ if (!isValidProteinSequence(sb.toString().toCharArray()))\r
{\r
throw new IOException(AppletFormatAdapter.INVALID_CHARACTERS\r
+" : "+seq.getName()\r
\r
if (count > 0)\r
{\r
- if (!isValidProteinSequence(sb.toString()))\r
+ if (!isValidProteinSequence(sb.toString().toCharArray()))\r
{\r
throw new IOException(AppletFormatAdapter.INVALID_CHARACTERS\r
+" : "+seq.getName()\r
\r
if (end < s[i].getLength())\r
{\r
- out.append(s[i].getSequence(start, end) + "\n");\r
+ out.append(s[i].getSequenceAsString(start, end) + "\n");\r
}\r
else if (start < s[i].getLength())\r
{\r
- out.append(s[i].getSequence(start, s[i].getLength()) + "\n");\r
+ out.append(s[i].getSequenceAsString(start, s[i].getLength()) + "\n");\r
}\r
}\r
\r
else\r
{\r
UserColourScheme ucs = new UserColourScheme(st.nextToken());\r
- colours.put(type, ucs.findColour("A"));\r
+ colours.put(type, ucs.findColour('A'));\r
if (st.hasMoreElements())\r
{\r
String link = st.nextToken();\r
{\r
// Probably the old style groups file\r
UserColourScheme ucs = new UserColourScheme(type);\r
- colours.put(type, ucs.findColour("A"));\r
+ colours.put(type, ucs.findColour('A'));\r
}\r
\r
sf = new SequenceFeature(type, desc, "", start, end, featureGroup);\r
// in the future we could search for the query
// sequence in the alignment before calling this function.
SequenceI seqRef = al.getSequenceAt(firstSeq);
- int width = preds[0].getSequence().length();
+ int width = preds[0].getSequence().length;
int[] gapmap = al.getSequenceAt(firstSeq).gapMap();
- if ((delMap!=null && delMap.length > width) || (delMap==null && gapmap.length!=width))
+ if ((delMap!=null && delMap.length > width) || (delMap==null && gapmap.length!=width))
{
throw (new Exception(
"Number of residues in "+(delMap==null ? "" : " mapped ")+"supposed query sequence ('" +
for (int j = 0; j < width; j++)
{
annotations[gapmap[delMap[j]]] = new Annotation(preds[i].getCharAt(
- j) + "", "", ' ', 0);
+ j) + "", "", ' ', 0);
}
}
}
*/
}
-}
\ No newline at end of file
+}
\r
// Replace ~ with a sensible gap character\r
seq = seq.replace('~', '-');\r
- if (!isValidProteinSequence(seq))\r
+ if (!isValidProteinSequence(seq.toCharArray()))\r
{\r
throw new IOException(AppletFormatAdapter.\r
INVALID_CHARACTERS\r
while ((i < seqs.length) && (seqs[i] != null))\r
{\r
// Replace all internal gaps with . and external spaces with ~\r
- s[i] =new Sequence(seqs[i].getName(),seqs[i].getSequence().replace('-', '.'));\r
+ s[i] =new Sequence(seqs[i].getName(),seqs[i].getSequenceAsString().replace('-', '.'));\r
+\r
+ StringBuffer sb = new StringBuffer();\r
+ sb.append(s[i].getSequence());\r
\r
- StringBuffer sb = new StringBuffer(s[i].getSequence());\r
for (int ii = 0; ii < sb.length(); ii++)\r
{\r
if (sb.charAt(ii) == '.')\r
\r
s[i].setSequence(sb.toString());\r
\r
- if (s[i].getSequence().length() > max)\r
+ if (s[i].getSequence().length > max)\r
{\r
- max = s[i].getSequence().length();\r
+ max = s[i].getSequence().length;\r
}\r
\r
i++;\r
int [] checksums = new int[s.length];\r
while ( i < s.length )\r
{\r
- checksums[i] = checkSum(s[i].getSequence());\r
+ checksums[i] = checkSum(s[i].getSequenceAsString());\r
bigChecksum += checksums[i];\r
i++;\r
}\r
\r
long maxNB = 0;\r
- out.append(" MSF: " + s[0].getSequence().length() + " Type: " +\r
+ out.append(" MSF: " + s[0].getSequence().length + " Type: " +\r
(is_NA ? "N" : "P") + " Check: " + (bigChecksum%10000) + " ..\n\n\n");\r
\r
String[] nameBlock = new String[s.length];\r
nameBlock[i] = new String(" Name: " + printId(s[i])+" ");\r
\r
idBlock[i] = new String("Len: " +\r
- maxLenpad.form(s[i].getSequence().length()) + " Check: " +\r
+ maxLenpad.form(s[i].getSequence().length) + " Check: " +\r
maxChkpad.form(checksums[i]) + " Weight: 1.00\n");\r
\r
if (s[i].getName().length() > maxid)\r
int start = (i * 50) + (k * 10);\r
int end = start + 10;\r
\r
- if ((end < s[j].getSequence().length()) &&\r
- (start < s[j].getSequence().length()))\r
+ if ((end < s[j].getSequence().length) &&\r
+ (start < s[j].getSequence().length))\r
{\r
- out.append(s[j].getSequence().substring(start, end));\r
+ out.append(s[j].getSequence(start, end));\r
\r
if (k < 4)\r
{\r
}\r
else\r
{\r
- if (start < s[j].getSequence().length())\r
+ if (start < s[j].getSequence().length)\r
{\r
- out.append(s[j].getSequence().substring(start));\r
+ out.append(s[j].getSequenceAsString().substring(start));\r
out.append("\n");\r
}\r
else\r
\r
while ( (i < s.length) && (s[i] != null))\r
{\r
- String seq = s[i].getSequence();\r
+ String seq = s[i].getSequenceAsString();\r
seq = seq + "*";\r
\r
\r
{\r
String tmp = printId(s[i]);\r
\r
- if (s[i].getSequence().length() > max)\r
+ if (s[i].getSequence().length > max)\r
{\r
- max = s[i].getSequence().length();\r
+ max = s[i].getSequence().length;\r
}\r
\r
if (tmp.length() > maxid)\r
{\r
out.append(new Format("%-" + maxid + "s").form( printId(s[j])+" "));\r
\r
- out.append(s[j].getSequence() + "\n");\r
+ out.append(s[j].getSequenceAsString() + "\n");\r
j++;\r
}\r
\r
int[] checksums = new int[s.length];\r
while (i < s.length)\r
{\r
- checksums[i] = checkSum(s[i].getSequence());\r
+ checksums[i] = checkSum(s[i].getSequenceAsString());\r
bigChecksum += checksums[i];\r
i++;\r
}\r
\r
- out.append(" MSF: " + s[0].getSequence().length() +\r
+ out.append(" MSF: " + s[0].getSequence().length +\r
" Type: P Check: " + bigChecksum%10000 + " ..\n\n\n");\r
\r
i=0;\r
while ( (i < s.length) && (s[i] != null))\r
{\r
- String seq = s[i].getSequence();\r
+ String seq = s[i].getSequenceAsString();\r
out.append(" Name: " + printId(s[i]) +\r
" oo Len: " +\r
- s[i].getSequence().length() + " Check: " + checksums[i] +\r
+ seq.length() + " Check: " + checksums[i] +\r
" Weight: 1.00\n");\r
\r
if (seq.length() > max)\r
int start = (i * 50) + (k * 10);\r
int end = start + 10;\r
\r
- if ( (end < s[j].getSequence().length()) &&\r
- (start < s[j].getSequence().length()))\r
+ if ( (end < s[j].getSequence().length) &&\r
+ (start < s[j].getSequence().length))\r
{\r
- out.append(s[j].getSequence().substring(start, end));\r
+ out.append(s[j].getSequence(start, end));\r
\r
if (k < 4)\r
{\r
}\r
else\r
{\r
- if (start < s[j].getSequence().length())\r
+ if (start < s[j].getSequence().length)\r
{\r
- out.append(s[j].getSequence().substring(start));\r
+ out.append(s[j].getSequenceAsString().substring(start));\r
out.append("\n");\r
}\r
else\r
import org.exolab.castor.mapping.Mapping;\r
\r
/*\r
- * \r
+ *\r
* static {\r
* org.exolab.castor.util.LocalConfiguration.getInstance().getProperties().setProperty(\r
* "org.exolab.castor.serializer", "org.apache.xml.serialize.XMLSerilazizer"); }\r
- * \r
+ *\r
*/\r
\r
public class VamsasDatastore {\r
* (UniprotFile) unmar.unmarshal(new FileReader(file)); // 3. marshal the data\r
* with the total price back and print the XML in the console Marshaller\r
* marshaller = new Marshaller( new FileWriter(file) );\r
- * \r
+ *\r
* marshaller.setMapping(map); marshaller.marshal(af); } catch (Exception e) {\r
* e.printStackTrace(); } }\r
- * \r
- * \r
+ *\r
+ *\r
*/\r
/**\r
* @return the Vobject bound to Jalview datamodel object\r
}\r
\r
/**\r
- * \r
+ *\r
* @param vobj\r
* @return Jalview datamodel object bound to the vamsas document object\r
*/\r
if (id==null || vobj.getVorbaId()==null)\r
Cache.log.error("Failed to get id for "+(vobj.isRegisterable() ? "registerable" : "unregisterable") +" object "+vobj);\r
}\r
- \r
+\r
if (vobj2jv.containsKey(vobj.getVorbaId()) && !((VorbaId)vobj2jv.get(vobj.getVorbaId())).equals(jvobj)) {\r
Cache.log.debug("Warning? Overwriting existing vamsas id binding for "+vobj.getVorbaId(), new Exception("Overwriting vamsas id binding."));\r
}\r
- else if (jv2vobj.containsKey(jvobj) && !((VorbaId)jv2vobj.get(jvobj)).equals(vobj.getVorbaId())) \r
+ else if (jv2vobj.containsKey(jvobj) && !((VorbaId)jv2vobj.get(jvobj)).equals(vobj.getVorbaId()))\r
{\r
Cache.log.debug("Warning? Overwriting existing jalview object binding for "+jvobj, new Exception("Overwriting jalview object binding."));\r
}\r
// we just update the hash's regardless!\r
vobj2jv.put(vobj.getVorbaId(), jvobj);\r
// JBPNote - better implementing a hybrid invertible hash.\r
- jv2vobj.put(jvobj, vobj.getVorbaId()); \r
+ jv2vobj.put(jvobj, vobj.getVorbaId());\r
}\r
\r
/**\r
* put the alignment viewed by AlignViewport into cdoc.\r
- * \r
+ *\r
* @param av alignViewport to be stored\r
* @param aFtitle title for alignment\r
*/\r
sequence = new Sequence();\r
bindjvvobj(sq, sequence);\r
sq.setVamsasId(sequence.getVorbaId().getId());\r
- sequence.setSequence(sq.getSequence());\r
+ sequence.setSequence(sq.getSequenceAsString());\r
sequence.setDictionary(dict);\r
sequence.setName(jal.getDataset().getSequenceAt(i).getName());\r
sequence.setStart(jal.getDataset().getSequenceAt(i).getStart());\r
// ////////////////////////////////////////////\r
// Save the Alignments\r
\r
- Alignment alignment = (Alignment) getjv2vObj(av); // this is so we can get the alignviewport back \r
+ Alignment alignment = (Alignment) getjv2vObj(av); // this is so we can get the alignviewport back\r
if (alignment == null)\r
{\r
alignment = new Alignment();\r
{\r
alseq = new AlignmentSequence();\r
// TODO: VAMSAS: translate lowercase symbols to annotation ?\r
- alseq.setSequence(jal.getSequenceAt(i).getSequence());\r
+ alseq.setSequence(jal.getSequenceAt(i).getSequenceAsString());\r
alseq.setName(jal.getSequenceAt(i).getName());\r
alseq.setStart(jal.getSequenceAt(i).getStart());\r
alseq.setEnd(jal.getSequenceAt(i).getEnd());\r
an.addProperty(newProperty("jalview:graphType",null,\r
((aa[i].graph==jalview.datamodel.AlignmentAnnotation.BAR_GRAPH) ? "BAR_GRAPH" : "LINE_GRAPH")));\r
\r
- /** and on and on.. \r
+ /** and on and on..\r
vProperty=new Property();\r
vProperty.setName("jalview:graphThreshhold");\r
vProperty.setContent(aa[i].threshold);\r
\r
/**\r
* correctly create a RangeAnnotation from a jalview sequence feature\r
- * \r
+ *\r
* @param dsa\r
* (typically DataSetAnnotations or AlignmentSequenceAnnotation)\r
* @param feature\r
/**\r
* correctly creates provenance for trees calculated on an alignment by\r
* jalview.\r
- * \r
+ *\r
* @param jal\r
* @param tp\r
* @return\r
prov.getEntry(0).getParam(0).setName("treeType");\r
prov.getEntry(0).getParam(0).setType("utf8");\r
prov.getEntry(0).getParam(0).setContent("NJ");\r
- \r
+\r
int ranges[] = tp.getTree().seqData.getVisibleContigs();\r
// VisibleContigs are with respect to alignment coordinates. Still need offsets\r
int start= tp.getTree().seqData.getAlignmentOrigin();\r
}\r
\r
/**\r
- * \r
+ *\r
* @param tp\r
* @return Object[] { AlignmentView, AlignmentI - reference alignment for\r
* input }\r
/**\r
* get start<end range of segment, adjusting for inclusivity flag and\r
* polarity.\r
- * \r
+ *\r
* @param visSeg\r
* @param ensureDirection when true - always ensure start is less than end.\r
* @return int[] { start, end, direction} where direction==1 for range running from end to start.\r
}\r
\r
/**\r
- * \r
+ *\r
* @param annotation\r
* @return true if annotation is not to be stored in document\r
*/\r
}\r
\r
if (dataset.getAlignmentCount()>0) {\r
- // LOAD ALIGNMENTS from DATASET \r
+ // LOAD ALIGNMENTS from DATASET\r
\r
for (int al=0,nal=dataset.getAlignmentCount(); al<nal; al++) {\r
org.vamsas.objects.core.Alignment alignment = dataset.getAlignment(al);\r
AlignViewport av = (AlignViewport) getvObj2jv(alignment);\r
jalview.datamodel.AlignmentI jal=null;\r
if (av!=null)\r
- jal = av.getAlignment(); \r
+ jal = av.getAlignment();\r
iSize = alignment.getAlignmentSequenceCount();\r
boolean newal=(jal==null) ? true : false;\r
Vector newasAnnots=new Vector();\r
valseq.getSequence().replace(valGapchar, gapChar),\r
valseq.getStart(),\r
valseq.getEnd() );\r
- \r
+\r
Vobject datsetseq = (Vobject)valseq.getRefid();\r
if (datsetseq!=null) {\r
alseq.setDatasetSequence((SequenceI)getvObj2jv(datsetseq)); // exceptions if AlignemntSequence reference isn't a simple SequenceI\r
// basically do this:\r
// int se[] = getBounds(vasannot[a]);\r
// asa.update(getjAlignmentAnnotation(jal, vasannot[a])); // update from another annotation object in place.\r
- // asa.createSequenceMapping(alseq, se[0], false); \r
+ // asa.createSequenceMapping(alseq, se[0], false);\r
\r
}\r
}\r
// summary flags saying what we found over the set of annotation rows.\r
boolean[] AeContent = new boolean[] { false, false, false, false, false};\r
int[] rangeMap = getMapping(annotation);\r
- jalview.datamodel.Annotation[][] anot=new jalview.datamodel.Annotation[][] { \r
+ jalview.datamodel.Annotation[][] anot=new jalview.datamodel.Annotation[][] {\r
new jalview.datamodel.Annotation[rangeMap.length],\r
new jalview.datamodel.Annotation[rangeMap.length]\r
};\r
- boolean mergeable=true; //false if 'after positions cant be placed on same annotation row as positions. \r
- \r
+ boolean mergeable=true; //false if 'after positions cant be placed on same annotation row as positions.\r
+\r
if (annotation.getAnnotationElementCount()>0) {\r
AnnotationElement ae[] = annotation.getAnnotationElement();\r
for (int aa = 0; aa < ae.length; aa++)\r
{\r
int pos = ae[aa].getPosition()-1;// pos counts from 1 to (|seg.start-seg.end|+1)\r
- if (pos>=0 && pos<rangeMap.length) { \r
+ if (pos>=0 && pos<rangeMap.length) {\r
int row=ae[aa].getAfter()?1:0;\r
if (anot[row][pos]!=null) {\r
// only time this should happen is if the After flag is set.\r
}\r
if (parsedRangeAnnotation==null) {\r
Cache.log.debug("Inserting empty annotation row elements for a whole-alignment annotation.");\r
- \r
- \r
+\r
+\r
} else {\r
if (parsedRangeAnnotation[3]!=null) {\r
Cache.log.warn("Ignoring 'After' annotation row in "+annotation.getVorbaId());\r
// make tooltip and display char value\r
if (!has[HASDESCSTR]) arow[i].description = arow[i].value + "";\r
if (!has[HASDC]) arow[i].displayCharacter=arow[i].value+"";\r
- } \r
+ }\r
}\r
int type=jalview.datamodel.AlignmentAnnotation.LINE_GRAPH;\r
if (has[HASHPHOB]) {\r
org.vamsas.objects.core.Property[] props=annotation.getProperty();\r
for (int p=0;p<props.length; p++) {\r
if (props[p].getName().equalsIgnoreCase("jalview:graphType")) {\r
- try { \r
+ try {\r
// probably a jalview annotation graph so recover the visualization hints.\r
jan.graph = jalview.datamodel.AlignmentAnnotation.getGraphValueFromString(props[p].getContent());\r
} catch (Exception e) {\r
\r
return jan;\r
\r
- } \r
+ }\r
\r
return null;\r
}\r
posList.add(new Integer(p));\r
}\r
}\r
- } \r
+ }\r
else if (dseta.getPosCount() > 0)\r
{\r
int pos = dseta.getPos(0).getI();\r
}\r
return null;\r
}\r
- /* not needed now. \r
+ /* not needed now.\r
* Provenance getVamsasProvenance(jalview.datamodel.Provenance jprov) {\r
jalview.datamodel.ProvenanceEntry[] entries = null;\r
// TODO: fix App and Action here.\r
}\r
\r
/**\r
- * \r
+ *\r
* @return default initial provenance list for a Jalview created vamsas\r
* object.\r
*/\r
Data inputs[] = new Data[1];\r
Data input= new Data();\r
input.setType("sequence");\r
- input.setContent(AlignSeq.extractGaps("-. ",sequence.getSequence()));\r
+ input.setContent(AlignSeq.extractGaps("-. ",sequence.getSequenceAsString()));\r
inputs[0]=input;\r
\r
WSWUBlastService service = new WSWUBlastServiceLocator();\r
if(sequences!=null && sequences.length>0)\r
{\r
str = jalview.analysis.AlignSeq.extractGaps(\r
- jalview.util.Comparison.GapChars, sequences[0].getSequence());\r
+ jalview.util.Comparison.GapChars,\r
+ sequences[0].getSequenceAsString());\r
\r
textfield.setText(str);\r
}\r
*\r
* @return DOCUMENT ME!\r
*/\r
- public Color findColour(String n)\r
+ public Color findColour(char c)\r
{\r
return Color.red;\r
}\r
*\r
* @return DOCUMENT ME!\r
*/\r
- public Color findColour(String n, int j)\r
+ public Color findColour(char c, int j)\r
{\r
Color currentColour = Color.white;\r
\r
- if ((threshold == 0) || aboveThreshold(n, j))\r
+ if ((threshold == 0) || aboveThreshold(c, j))\r
{\r
if( j<annotation.annotations.length\r
&& annotation.annotations[j]!=null\r
- && !jalview.util.Comparison.isGap(n.charAt(0)))\r
+ && !jalview.util.Comparison.isGap(c))\r
{\r
if( aboveAnnotationThreshold==NO_THRESHOLD\r
|| (annotationThreshold!=null && aboveAnnotationThreshold==ABOVE_THRESHOLD && annotation.annotations[j].value>=annotationThreshold.value)\r
{\r
if(colourScheme!=null)\r
{\r
- currentColour = colourScheme.findColour(n, j);\r
+ currentColour = colourScheme.findColour(c, j);\r
}\r
else if(range!=0)\r
{\r
super();\r
}\r
\r
- public Color findColour(String s, int j)\r
+ public Color findColour(char res, int j)\r
{\r
-\r
- char res = s.charAt(0);\r
if ('a' <= res && res <= 'z' )\r
{\r
// TO UPPERCASE !!!\r
- s = String.valueOf( res -= ('a' - 'A') );\r
+ res -= ('a' - 'A');\r
}\r
\r
if (consensus == null ||\r
j >= consensus.length ||\r
consensus[j] == null ||\r
- (threshold != 0 && !aboveThreshold(s, j)))\r
+ (threshold != 0 && !aboveThreshold(res, j)))\r
{\r
return Color.white;\r
}\r
{\r
String max = (String) consensus[j].get(AAFrequency.MAXRESIDUE);\r
\r
- if (max.indexOf(s) > -1)\r
+ if (max.indexOf(res) > -1)\r
{\r
currentColour = new Color(154, 154, 255);\r
}\r
\r
do\r
{\r
- c += ResidueProperties.getBLOSUM62(max.substring(max_aa,\r
- max_aa + 1), s);\r
+ c += ResidueProperties.getBLOSUM62(\r
+ max.charAt(max_aa), res);\r
}\r
while (++max_aa < n);\r
\r
int res;\r
int i;\r
int j = 0;\r
- String seq;\r
+ char [] seq;\r
\r
while (j < seqs.size())\r
{\r
seq = ( (SequenceI) seqs.elementAt(j)).getSequence();\r
\r
- int end_j = seq.length() - 1;\r
+ int end_j = seq.length - 1;\r
\r
for (i = start; i <= end_j; i++)\r
{\r
- if ( (seq.length() - 1) < i)\r
+ if ( (seq.length - 1) < i)\r
{\r
res = 23;\r
}\r
else\r
{\r
- res = ResidueProperties.aaIndex[seq.charAt(i)];\r
+ res = ResidueProperties.aaIndex[seq[i]];\r
}\r
\r
cons2[i][res]++;\r
ResidueColour[19] = colours[0]; // V\r
}\r
\r
- public Color findColour(String s)\r
+ public Color findColour(char c)\r
{\r
return Color.pink;\r
}\r
\r
- public Color findColour(String s, int j)\r
+ public Color findColour(char c, int j)\r
{\r
Color currentColour;\r
\r
\r
- if ( cons2.length<=j || (threshold != 0 && !aboveThreshold(s, j)))\r
+ if ( cons2.length<=j || (threshold != 0 && !aboveThreshold(c, j)))\r
{\r
return Color.white;\r
}\r
\r
- int i = ResidueProperties.aaIndex[s.charAt(0)];\r
+ int i = ResidueProperties.aaIndex[c];\r
\r
currentColour = Color.white;\r
\r
\r
public interface ColourSchemeI\r
{\r
- public Color findColour(String aa);\r
+ public Color findColour(char c);\r
\r
- public Color findColour(String s, int j);\r
+ public Color findColour(char c, int j);\r
\r
public void setConsensus(java.util.Hashtable [] h);\r
\r
*\r
* @return DOCUMENT ME!\r
*/\r
- public Color findColour(String n)\r
+ public Color findColour(char c)\r
{\r
// System.out.println("called"); log.debug\r
- return colors[ResidueProperties.nucleotideIndex[n.charAt(0)]];\r
+ return colors[ResidueProperties.nucleotideIndex[c]];\r
}\r
\r
/**\r
*\r
* @return DOCUMENT ME!\r
*/\r
- public Color findColour(String n, int j)\r
+ public Color findColour(char c, int j)\r
{\r
Color currentColour;\r
- if ((threshold == 0) || aboveThreshold(n, j))\r
+ if ((threshold == 0) || aboveThreshold(c, j))\r
{\r
try\r
{\r
- currentColour = colors[ ResidueProperties.nucleotideIndex[n.charAt(0)]];\r
+ currentColour = colors[ ResidueProperties.nucleotideIndex[c]];\r
}\r
catch (Exception ex)\r
{\r
this.thresholds = ResidueProperties.pidThresholds;\r
}\r
\r
- public Color findColour(String s, int j)\r
+ public Color findColour(char c, int j)\r
{\r
- char res = s.charAt(0);\r
- if ('a' <= res && res <= 'z')\r
+ if ('a' <= c && c <= 'z')\r
{\r
- s = String.valueOf(res -= ('a' - 'A'));\r
+ c -= ('a' - 'A');\r
}\r
\r
if (consensus == null\r
return Color.white;\r
}\r
\r
- if ( (threshold != 0) && !aboveThreshold(s, j))\r
+ if ( (threshold != 0) && !aboveThreshold(c, j))\r
{\r
return Color.white;\r
}\r
return Color.white;\r
\r
if ( (Integer.parseInt(consensus[j].get(AAFrequency.MAXCOUNT).toString()) != -1) &&\r
- consensus[j].contains(s))\r
+ consensus[j].contains(String.valueOf(c)))\r
{\r
sc = ( (Float) consensus[j].get(ignoreGaps)).floatValue();\r
\r
- if (!jalview.util.Comparison.isGap(res))\r
+ if (!jalview.util.Comparison.isGap(c))\r
{\r
for (int i = 0; i < thresholds.length; i++)\r
{\r
/**\r
* Find a colour without an index in a sequence\r
*/\r
- public Color findColour(String aa)\r
+ public Color findColour(char c)\r
{\r
- return colors[ResidueProperties.aaIndex[aa.charAt(0)]];\r
+ return colors[ResidueProperties.aaIndex[c]];\r
}\r
\r
\r
\r
- public Color findColour(String s, int j)\r
+ public Color findColour(char c, int j)\r
{\r
Color currentColour;\r
- int index = ResidueProperties.aaIndex[s.charAt(0)];\r
\r
- if ((threshold == 0) || aboveThreshold(ResidueProperties.aa[index], j))\r
+ if ((threshold == 0) || aboveThreshold(c, j))\r
{\r
- currentColour = colors[index];\r
+ currentColour = colors[ResidueProperties.aaIndex[c]];\r
}\r
else\r
{\r
*\r
* @return DOCUMENT ME!\r
*/\r
- public boolean aboveThreshold(String s, int j)\r
+ public boolean aboveThreshold(char c, int j)\r
{\r
- char c = s.charAt(0);\r
if ('a' <= c && c <= 'z')\r
{\r
// TO UPPERCASE !!!\r
//Faster than toUpperCase\r
c -= ('a' - 'A');\r
- s = String.valueOf(c);\r
}\r
\r
if (consensus == null || consensus[j] == null)\r
return false;\r
\r
if ( ( ( (Integer) consensus[j].get(AAFrequency.MAXCOUNT)).intValue() != -1) &&\r
- consensus[j].contains(s))\r
+ consensus[j].contains(String.valueOf(c)))\r
{\r
if ( ( (Float) consensus[j].get(ignoreGaps)).floatValue() >= threshold)\r
{\r
return pog;\r
}\r
\r
- public static int getBLOSUM62(String A1, String A2)\r
+ public static int getBLOSUM62(char c1, char c2)\r
{\r
int pog = 0;\r
\r
try\r
{\r
- int a = aaIndex[A1.charAt(0)];\r
- int b = aaIndex[A2.charAt(0)];\r
+ int a = aaIndex[c1];\r
+ int b = aaIndex[c2];\r
\r
pog = ResidueProperties.BLOSUM62[a][b];\r
}\r
*\r
* @return DOCUMENT ME!\r
*/\r
- public Color findColour(String s, int j)\r
+ public Color findColour(char c, int j)\r
{\r
if (threshold > 0)\r
{\r
- if (!aboveThreshold(s, j))\r
+ if (!aboveThreshold(c, j))\r
{\r
return Color.white;\r
}\r
}\r
\r
- char c = s.charAt(0);\r
-\r
if (jalview.util.Comparison.isGap(c))\r
{\r
return Color.white;\r
\r
\r
\r
- public Color findColour(String s, int j)\r
+ public Color findColour(char c, int j)\r
{\r
Color currentColour;\r
- int index = ResidueProperties.aaIndex[s.charAt(0)];\r
+ int index = ResidueProperties.aaIndex[c];\r
\r
- if ((threshold == 0) || aboveThreshold(ResidueProperties.aa[index], j))\r
+ if ((threshold == 0) || aboveThreshold(c, j))\r
{\r
- if(lowerCaseColours!=null && 'a' <= s.charAt(0) && s.charAt(0) <= 'z')\r
+ if(lowerCaseColours!=null && 'a' <= c && c <= 'z')\r
currentColour = lowerCaseColours[index];\r
else\r
currentColour = colors[index];\r
* @param title String
* @param msa boolean
* @param alview AlignmentView
- * @param viewonly if true then the prediction will be made just on the concatenated visible regions
+ * @param viewonly if true then the prediction will be made just on the concatenated visible regions
*/
private void startJPredClient(String title, boolean msa,
jalview.datamodel.AlignmentView alview, AlignFrame parentFrame, boolean viewonly)
int spos=0;
int i=0;
if (viscontigs!=null) {
- // Construct the delMap - mapping from the positions within the input to Jnet to the contigs in the original sequence
-
+ // Construct the delMap - mapping from the positions within the input to Jnet to the contigs in the original sequence
+
delMap = new int[seq.getEnd()-seq.getStart()+1];
int gapMap[] = seq.gapMap();
for (int contig = 0; contig<viscontigs.length; contig += 2)
{
-
+
while (spos<gapMap.length && gapMap[spos]<viscontigs[contig]) {
spos++;
}
int tmap[] = new int[i];
System.arraycopy(delMap, 0, tmap, 0, i);
delMap=tmap;
- }
+ }
}
if (msa && msf.length > 1)
{
-
+
String altitle = "JNet prediction on "+(viewonly?"visible ":"") + seq.getName() +
" using alignment from " + title;
{
aln[i] = msf[i].getSeq('-');
}
-
-
+
+
Hashtable SequenceInfo = jalview.analysis.SeqsetUtils.uniquify(aln, true);
if (viewonly) {
// Remove hidden regions from sequence objects.
String seqs[] = alview.getSequenceStrings('-');
for (int i = 0, j = msf.length; i < j; i++)
- {
+ {
aln[i].setSequence(seqs[i]);
- }
+ }
seq.setSequence(seqs[0]);
- }
+ }
wsInfo.setProgressText("Job details for "+(viewonly?"visible ":"")+"MSA based prediction (" +
title + ") on sequence :\n>" + seq.getName() +
"\n" +
- AlignSeq.extractGaps("-. ", seq.getSequence()) +
+ AlignSeq.extractGaps("-. ", seq.getSequenceAsString()) +
"\n");
JPredThread jthread = new JPredThread(wsInfo, altitle, server,
SequenceInfo, aln, delMap, alview, parentFrame, WsURL);
// Remove hidden regions from input sequence
String seqs[] = alview.getSequenceStrings('-');
seq.setSequence(seqs[0]);
- }
+ }
wsInfo.setProgressText("Job details for prediction on "+(viewonly?"visible ":"")+"sequence :\n>" +
seqname + "\n" +
- AlignSeq.extractGaps("-. ", seq.getSequence()) +
+ AlignSeq.extractGaps("-. ", seq.getSequenceAsString()) +
"\n");
JPredThread jthread = new JPredThread(wsInfo, altitle, server, WsURL,
SequenceInfo, seq, delMap, alview, parentFrame);
wsInfo.setProgressText("Job details for MSA based prediction (" +
title + ") on sequence :\n>" + seq.getName() + "\n" +
- AlignSeq.extractGaps("-. ", seq.getSequence()) +
+ AlignSeq.extractGaps("-. ", seq.getSequenceAsString()) +
"\n");
SequenceI aln[] = new SequenceI[msf.length];
for (int i = 0, j = msf.length; i < j; i++)
}
wsInfo.setProgressText("Job details for prediction on sequence :\n>" +
seq.getName() + "\n" +
- AlignSeq.extractGaps("-. ", seq.getSequence()) +
+ AlignSeq.extractGaps("-. ", seq.getSequenceAsString()) +
"\n");
String altitle = "JNet prediction for sequence " + seq.getName() + " from " +
title;
gc);\r
\r
SequenceI profileseq=al.getSequenceAt(FirstSeq);\r
- profileseq.setSequence(sqs[msaIndex].getSequence());\r
+ profileseq.setSequence(sqs[msaIndex].getSequenceAsString());\r
}\r
\r
if (!jalview.analysis.SeqsetUtils.SeqCharacterUnhash(\r
sb.append(gc);\r
}\r
for (int s=1,ns=al.getHeight(); s<ns; s++) {\r
- String sq = al.getSequenceAt(s).getSequence();\r
+ String sq = al.getSequenceAt(s).getSequenceAsString();\r
int diff=gapMap[r]-sq.length();\r
if (diff>0) {\r
// pad gaps\r
for (int s=0,ns=al.getHeight(); s<ns; s++) {\r
SequenceI sqobj = al.getSequenceAt(s);\r
if (sqobj!=profileseq) {\r
- String sq = al.getSequenceAt(s).getSequence();\r
+ String sq = al.getSequenceAt(s).getSequenceAsString();\r
if (sq.length()<=spos+offset) {\r
// pad sequence\r
int diff=spos+offset-sq.length()-1;\r
sb.append(gc);\r
}\r
for (int s=1,ns=al.getHeight(); s<ns; s++) {\r
- String sq = al.getSequenceAt(s).getSequence();\r
+ String sq = al.getSequenceAt(s).getSequenceAsString();\r
// pad sequence\r
int diff=origseq.getLength()-sq.length();\r
while (diff>0) {\r
{\r
super();\r
this.predMap = delMap;\r
- String sq = AlignSeq.extractGaps(Comparison.GapChars, seq.getSequence());\r
+ String sq = AlignSeq.extractGaps(Comparison.GapChars,\r
+ seq.getSequenceAsString());\r
if (sq.length() >= 20)\r
{\r
this.SequenceInfo = SequenceInfo;\r
{
seqarray[n] = new vamsas.objects.simple.Sequence();
seqarray[n].setId(newname);
- seqarray[n++].setSeq( (submitGaps) ? seqs[i].getSequence()
+ seqarray[n++].setSeq( (submitGaps) ? seqs[i].getSequenceAsString()
: AlignSeq.extractGaps(
jalview.util.Comparison.GapChars, seqs[i]
- .getSequence()));
+ .getSequenceAsString()));
}
else
{
String empty = null;
if (seqs[i].getEnd() >= seqs[i].getStart())
{
- empty = (submitGaps) ? seqs[i].getSequence()
+ empty = (submitGaps) ? seqs[i].getSequenceAsString()
: AlignSeq.extractGaps(
jalview.util.Comparison.GapChars, seqs[i]
- .getSequence());
+ .getSequenceAsString());
}
emptySeqs.add(new String[]
{newname, empty});