props.getEmbossEnvironmentArray());
}
*/
+ private Hashtable uniquify(SequenceI[] sequences) {
+ // Generate a safely named sequence set and a hash to recover the sequence names
+ Hashtable map = new Hashtable();
+ for (int i=0; i<sequences.length; i++) {
+ String safename = new String("Sequence"+i);
+ map.put(safename, sequences[i].getName());
+ sequences[i].setName(safename);
+ }
+ return map;
+ }
+
+ private boolean deuniquify(Hashtable map, SequenceI[] sequences) {
+ // recover unsafe sequence names for a sequence set
+ boolean allfound=true;
+ for (int i=0; i<sequences.length; i++) {
+ if (map.containsKey(sequences[i].getName())) {
+ String unsafename = (String) map.get(sequences[i].getName());
+ sequences[i].setName(unsafename);
+ } else {
+ allfound=false;
+ }
+ }
+ return allfound;
+ }
public SequenceI[] clustalW(SequenceI[] sequences)
{
Hashtable filesToMove = new Hashtable();
String embossCommand = "emma -sequence jalseqs.fasta -auto";
+ // Duplicate
+ SequenceI[] myseq = new SequenceI[sequences.length];
+ for (int i=0; i<sequences.length; i++) {
+ myseq[i] = new Sequence(sequences[i]);
+ }
+ // Uniqueify, and
+ Hashtable namemap = uniquify(myseq);
// Load sequence file into hash
+
filesToMove.put("jalseqs.fasta",
- jalview.io.FastaFile.print(sequences,124,false).getBytes());
+ jalview.io.FastaFile.print(myseq,124,false).getBytes());
if(vamsas_server.getUseAuth() == true)
if(vamsas_server.getServiceUserName() == null)
if (alignment == null)
System.out.println("jalview.Jemboss: Couldn't read response:\n"
+ alfile + "\n---EOF\n");
- else
+ else {
+ if (!deuniquify(namemap, alignment)) {
+ System.out.println("jalview.Jemboss: Warning: Some of the "
+ +"original sequence names have not been recovered!\n");
+ }
return alignment;
+ }
}
}