git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix for JAL-2509 - don’t replace all bracket types with ()
[jalview.git]
/
src
/
jalview
/
io
/
StockholmFile.java
diff --git
a/src/jalview/io/StockholmFile.java
b/src/jalview/io/StockholmFile.java
index
3be78f4
..
a47e1ea
100644
(file)
--- a/
src/jalview/io/StockholmFile.java
+++ b/
src/jalview/io/StockholmFile.java
@@
-1,6
+1,6
@@
/*
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b2)
- * Copyright (C) 2015 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
*
* This file is part of Jalview.
*
@@
-97,7
+97,8
@@
public class StockholmFile extends AlignFile
this.al = al;
}
this.al = al;
}
- public StockholmFile(String inFile, String type) throws IOException
+ public StockholmFile(String inFile, DataSourceType type)
+ throws IOException
{
super(inFile, type);
}
{
super(inFile, type);
}
@@
-799,9
+800,9
@@
public class StockholmFile extends AlignFile
{
String convert1, convert2 = null;
{
String convert1, convert2 = null;
- convert1 = OPEN_PAREN.replaceAll(annots);
- convert2 = CLOSE_PAREN.replaceAll(convert1);
- annots = convert2;
+ // convert1 = OPEN_PAREN.replaceAll(annots);
+ // convert2 = CLOSE_PAREN.replaceAll(convert1);
+ // annots = convert2;
String type = label;
if (label.contains("_cons"))
String type = label;
if (label.contains("_cons"))
@@
-880,8
+881,13
@@
public class StockholmFile extends AlignFile
return annot;
}
return annot;
}
- public String print(SequenceI[] s)
+ @Override
+ public String print(SequenceI[] s, boolean jvSuffix)
{
{
+ out = new StringBuffer();
+ out.append("# STOCKHOLM 1.0");
+ out.append(newline);
+
// find max length of id
int max = 0;
int maxid = 0;
// find max length of id
int max = 0;
int maxid = 0;
@@
-889,7
+895,7
@@
public class StockholmFile extends AlignFile
Hashtable dataRef = null;
while ((in < s.length) && (s[in] != null))
{
Hashtable dataRef = null;
while ((in < s.length) && (s[in] != null))
{
- String tmp = printId(s[in]);
+ String tmp = printId(s[in], jvSuffix);
if (s[in].getSequence().length > max)
{
max = s[in].getSequence().length;
if (s[in].getSequence().length > max)
{
max = s[in].getSequence().length;
@@
-972,23
+978,26
@@
public class StockholmFile extends AlignFile
{
for (int j = 0; j < alAnot.length; j++)
{
{
for (int j = 0; j < alAnot.length; j++)
{
- if (ds.getSequenceFeatures() != null)
+
+ String key = type2id(alAnot[j].label);
+ boolean isrna = alAnot[j].isValidStruc();
+
+ if (isrna)
{
{
- feature = ds.getSequenceFeatures()[0].type;
+ // hardwire to secondary structure if there is RNA secondary
+ // structure on the annotation
+ key = "SS";
}
}
- // ?bug - feature may still have previous loop value
- String key = type2id(feature);
-
if (key == null)
{
if (key == null)
{
+
continue;
}
// out.append("#=GR ");
out.append(new Format("%-" + maxid + "s").form("#=GR "
continue;
}
// out.append("#=GR ");
out.append(new Format("%-" + maxid + "s").form("#=GR "
- + printId(s[i]) + " " + key + " "));
+ + printId(s[i], jvSuffix) + " " + key + " "));
ann = alAnot[j].annotations;
ann = alAnot[j].annotations;
- boolean isrna = alAnot[j].isValidStruc();
String seq = "";
for (int k = 0; k < ann.length; k++)
{
String seq = "";
for (int k = 0; k < ann.length; k++)
{
@@
-1000,7
+1009,8
@@
public class StockholmFile extends AlignFile
}
}
}
}
- out.append(new Format("%-" + maxid + "s").form(printId(s[i]) + " "));
+ out.append(new Format("%-" + maxid + "s")
+ .form(printId(s[i], jvSuffix) + " "));
out.append(s[i].getSequenceAsString());
out.append(newline);
i++;
out.append(s[i].getSequenceAsString());
out.append(newline);
i++;
@@
-1053,6
+1063,10
@@
public class StockholmFile extends AlignFile
out.append(newline);
}
}
out.append(newline);
}
}
+
+ out.append("//");
+ out.append(newline);
+
return out.toString();
}
return out.toString();
}
@@
-1105,13
+1119,12
@@
public class StockholmFile extends AlignFile
return seq;
}
return seq;
}
- @Override
public String print()
{
out = new StringBuffer();
out.append("# STOCKHOLM 1.0");
out.append(newline);
public String print()
{
out = new StringBuffer();
out.append("# STOCKHOLM 1.0");
out.append(newline);
- print(getSeqsAsArray());
+ print(getSeqsAsArray(), false);
out.append("//");
out.append(newline);
out.append("//");
out.append(newline);