int maxj;\r
int[] aseq1;\r
int[] aseq2;\r
- String astr1 = "";\r
- String astr2 = "";\r
+ public String astr1 = "";\r
+ public String astr2 = "";\r
\r
/** DOCUMENT ME!! */\r
public int seq1start;\r
int[][] lookup = ResidueProperties.getBLOSUM62();\r
String[] intToStr = pep;\r
int defInt = 23;\r
- String output = "";\r
+ StringBuffer output = new StringBuffer();\r
String type;\r
Runtime rt;\r
\r
*/\r
public String getOutput()\r
{\r
- return output;\r
+ return output.toString();\r
}\r
\r
/**\r
}\r
else\r
{\r
- output = output + ("Wrong type = dna or pep only");\r
+ output.append("Wrong type = dna or pep only");\r
System.exit(0);\r
}\r
\r
/**\r
* DOCUMENT ME!\r
*/\r
- public void printAlignment()\r
+ public void printAlignment(java.io.PrintStream os)\r
{\r
// Find the biggest id length for formatting purposes\r
int maxid = s1.getName().length();\r
int nochunks = ((aseq1.length - count) / len) + 1;\r
pid = 0;\r
\r
- output = output + ("Score = " + score[maxi][maxj] + "\n");\r
- output = output +\r
- ("Length of alignment = " + (aseq1.length - count) + "\n");\r
- output = output + ("Sequence ");\r
- output = output + (new Format("%" + maxid + "s").form(s1.getName()));\r
- output = output +\r
- (" : " + seq1start + " - " + seq1end + " (Sequence length = " +\r
+ output.append("Score = " + score[maxi][maxj] + "\n");\r
+ output.append("Length of alignment = " + (aseq1.length - count) + "\n");\r
+ output.append("Sequence ");\r
+ output.append(new Format("%" + maxid + "s").form(s1.getName()));\r
+ output.append(" : " + seq1start + " - " + seq1end + " (Sequence length = " +\r
s1str.length() + ")\n");\r
- output = output + ("Sequence ");\r
- output = output + (new Format("%" + maxid + "s").form(s2.getName()));\r
- output = output +\r
- (" : " + seq2start + " - " + seq2end + " (Sequence length = " +\r
+ output .append("Sequence ");\r
+ output.append(new Format("%" + maxid + "s").form(s2.getName()));\r
+ output .append(" : " + seq2start + " - " + seq2end + " (Sequence length = " +\r
s2str.length() + ")\n\n");\r
\r
for (int j = 0; j < nochunks; j++)\r
{\r
// Print the first aligned sequence\r
- output = output +\r
- (new Format("%" + (maxid) + "s").form(s1.getName()) + " ");\r
+ output.append(new Format("%" + (maxid) + "s").form(s1.getName()) + " ");\r
\r
for (int i = 0; i < len; i++)\r
{\r
if ((count + i + (j * len)) < aseq1.length)\r
{\r
- output = output +\r
- (new Format("%s").form(intToStr[aseq1[count + i +\r
+ output.append(new Format("%s").form(intToStr[aseq1[count + i +\r
(j * len)]]));\r
}\r
}\r
\r
- output = output + ("\n");\r
- output = output +\r
- (new Format("%" + (maxid) + "s").form(" ") + " ");\r
+ output.append("\n");\r
+ output.append(new Format("%" + (maxid) + "s").form(" ") + " ");\r
\r
// Print out the matching chars\r
for (int i = 0; i < len; i++)\r
!intToStr[aseq1[count + i + (j * len)]].equals("-"))\r
{\r
pid++;\r
- output = output + ("|");\r
+ output.append("|");\r
}\r
else if (type.equals("pep"))\r
{\r
intToStr[aseq1[count + i + (j * len)]],\r
intToStr[aseq2[count + i + (j * len)]]) > 0)\r
{\r
- output = output + (".");\r
+ output.append(".");\r
}\r
else\r
{\r
- output = output + (" ");\r
+ output.append(" ");\r
}\r
}\r
else\r
{\r
- output = output + (" ");\r
+ output.append(" ");\r
}\r
}\r
}\r
\r
// Now print the second aligned sequence\r
- output = output + ("\n");\r
- output = output +\r
- (new Format("%" + (maxid) + "s").form(s2.getName()) + " ");\r
+ output = output.append("\n");\r
+ output = output.append(new Format("%" + (maxid) + "s").form(s2.getName()) + " ");\r
\r
for (int i = 0; i < len; i++)\r
{\r
if ((count + i + (j * len)) < aseq1.length)\r
{\r
- output = output +\r
- (new Format("%s").form(intToStr[aseq2[count + i +\r
+ output .append(new Format("%s").form(intToStr[aseq2[count + i +\r
(j * len)]]));\r
}\r
}\r
\r
- output = output + ("\n\n");\r
+ output = output .append("\n\n");\r
}\r
\r
pid = pid / (float) (aseq1.length - count) * 100;\r
- output = output + (new Format("Percentage ID = %2.2f\n\n").form(pid));\r
+ output = output.append(new Format("Percentage ID = %2.2f\n\n").form(pid));\r
+\r
+ try{\r
+ os.println(output.toString());\r
+ }catch(Exception ex){}\r
}\r
\r
/**\r
public static String extractGaps(String gapChar, String seq)\r
{\r
StringTokenizer str = new StringTokenizer(seq, gapChar);\r
- String newString = "";\r
+ StringBuffer newString = new StringBuffer();\r
\r
while (str.hasMoreTokens())\r
{\r
- newString = newString + str.nextToken();\r
+ newString.append( str.nextToken() );\r
}\r
\r
- return newString;\r
+ return newString.toString();\r
}\r
\r
/**\r
*/\r
package jalview.analysis;\r
\r
-import java.util.*;\r
-\r
import jalview.datamodel.*;\r
-import jalview.io.*;\r
-import jalview.schemes.*;\r
+\r
+import jalview.io.NewickFile;\r
+\r
+import jalview.schemes.ResidueProperties;\r
+\r
import jalview.util.*;\r
\r
+import java.util.*;\r
+\r
\r
/**\r
* DOCUMENT ME!\r
Object leaves = null;\r
int start;\r
int end;\r
- boolean hasDistances = true; // normal case for jalview trees\r
- boolean hasBootstrap = false; // normal case for jalview trees\r
-\r
- private boolean hasRootDistance = true;\r
\r
/**\r
* Creates a new NJTree object.\r
public NJTree(SequenceI[] seqs, NewickFile treefile)\r
{\r
top = treefile.getTree();\r
-\r
- hasDistances = treefile.HasDistances();\r
- hasBootstrap = treefile.HasBootstrap();\r
- hasRootDistance = treefile.HasRootDistance();\r
-\r
maxheight = findHeight(top);\r
\r
SequenceIdMatcher algnIds = new SequenceIdMatcher(seqs);\r
AlignSeq as = new AlignSeq(sequence[i], sequence[j], "pep");\r
as.calcScoreMatrix();\r
as.traceAlignment();\r
- as.printAlignment();\r
+ as.printAlignment(System.out);\r
distance[i][j] = (float) as.maxscore;\r
\r
if (max < distance[i][j])\r
{\r
return top;\r
}\r
- /**\r
- *\r
- * @return true if tree has real distances\r
- */\r
- public boolean isHasDistances() {\r
- return hasDistances;\r
- }\r
-\r
- /**\r
- *\r
- * @return true if tree has real bootstrap values\r
- */\r
- public boolean isHasBootstrap() {\r
- return hasBootstrap;\r
- }\r
-\r
- public boolean isHasRootDistance()\r
- {\r
- return hasRootDistance;\r
- }\r
-\r
}\r
\r
\r
sqinfo.put("Name", seq.getName());\r
sqinfo.put("Start", new Integer(seq.getStart()));\r
sqinfo.put("End", new Integer(seq.getEnd()));\r
- sqinfo.put("SeqFeatures", seq.getSequenceFeatures());\r
+ sqinfo.put("SeqFeatures", (seq.getSequenceFeatures() !=null) ? seq.getSequenceFeatures() : new Vector());\r
sqinfo.put("PdbId",\r
- (seq.getPDBId() != null) ? seq.getPDBId() : new String(""));\r
-\r
+ (seq.getPDBId() != null) ? seq.getPDBId() : new Vector());\r
+ sqinfo.put("datasetSequence", (seq.getDatasetSequence() !=null) ? seq.getDatasetSequence() : new Sequence("THISISAPLACEHOLDER",""));\r
return sqinfo;\r
}\r
\r
Integer end = (Integer) sqinfo.get("End");\r
java.util.Vector sfeatures = (java.util.Vector) sqinfo.get(\r
"SeqFeatures");\r
- String pdbid = (String) sqinfo.get("PdbId");\r
-\r
+ Vector pdbid = (Vector) sqinfo.get("PdbId");\r
+ Sequence seqds = (Sequence) sqinfo.get("datasetSequence");\r
if (oldname == null)\r
{\r
namePresent = false;\r
sq.setEnd(end.intValue());\r
}\r
\r
- if (sfeatures != null)\r
+ if ((sfeatures != null) && (sfeatures.size()>0))\r
{\r
sq.setSequenceFeatures(sfeatures);\r
}\r
+ if ((seqds!=null) && !(seqds.getName().equals("THISISAPLACEHOLDER") && seqds.getLength()==0)) {\r
+ sq.setDatasetSequence(seqds);\r
+ }\r
\r
return namePresent;\r
}\r