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
JAL-2790 provide a cancel button for JABAWS and AACon jobs
[jalview.git]
/
src
/
jalview
/
io
/
FeaturesFile.java
diff --git
a/src/jalview/io/FeaturesFile.java
b/src/jalview/io/FeaturesFile.java
index
afc00ee
..
d2282b1
100755
(executable)
--- a/
src/jalview/io/FeaturesFile.java
+++ b/
src/jalview/io/FeaturesFile.java
@@
-45,7
+45,6
@@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@
-77,19
+76,6
@@
public class FeaturesFile extends AlignFile implements FeaturesSourceI
protected static final String GFF_VERSION = "##gff-version";
protected static final String GFF_VERSION = "##gff-version";
- private static final Comparator<String> SORT_NULL_LAST = new Comparator<String>()
- {
- @Override
- public int compare(String o1, String o2)
- {
- if (o1 == null)
- {
- return o2 == null ? 0 : 1;
- }
- return (o2 == null ? -1 : o1.compareTo(o2));
- }
- };
-
private AlignmentI lastmatchedAl = null;
private SequenceIdMatcher matcher = null;
private AlignmentI lastmatchedAl = null;
private SequenceIdMatcher matcher = null;
@@
-108,14
+94,14
@@
public class FeaturesFile extends AlignFile implements FeaturesSourceI
/**
* Constructor which does not parse the file immediately
*
/**
* Constructor which does not parse the file immediately
*
- * @param inFile
+ * @param file
* @param paste
* @throws IOException
*/
* @param paste
* @throws IOException
*/
- public FeaturesFile(String inFile, DataSourceType paste)
+ public FeaturesFile(String file, DataSourceType paste)
throws IOException
{
throws IOException
{
- super(false, inFile, paste);
+ super(false, file, paste);
}
/**
}
/**
@@
-131,15
+117,14
@@
public class FeaturesFile extends AlignFile implements FeaturesSourceI
* Constructor that optionally parses the file immediately
*
* @param parseImmediately
* Constructor that optionally parses the file immediately
*
* @param parseImmediately
- * @param inFile
+ * @param file
* @param type
* @throws IOException
*/
* @param type
* @throws IOException
*/
- public FeaturesFile(boolean parseImmediately, String inFile,
- DataSourceType type)
- throws IOException
+ public FeaturesFile(boolean parseImmediately, String file,
+ DataSourceType type) throws IOException
{
{
- super(parseImmediately, inFile, type);
+ super(parseImmediately, file, type);
}
/**
}
/**
@@
-319,7
+304,8
@@
public class FeaturesFile extends AlignFile implements FeaturesSourceI
*/
protected boolean parseJalviewFeature(String line, String[] gffColumns,
AlignmentI alignment, Map<String, FeatureColourI> featureColours,
*/
protected boolean parseJalviewFeature(String line, String[] gffColumns,
AlignmentI alignment, Map<String, FeatureColourI> featureColours,
- boolean removeHTML, boolean relaxedIdMatching, String featureGroup)
+ boolean removeHTML, boolean relaxedIdMatching,
+ String featureGroup)
{
/*
* tokens: description seqid seqIndex start end type [score]
{
/*
* tokens: description seqid seqIndex start end type [score]
@@
-373,20
+359,23
@@
public class FeaturesFile extends AlignFile implements FeaturesSourceI
Color colour = ColorUtils.createColourFromName(ft);
featureColours.put(ft, new FeatureColour(colour));
}
Color colour = ColorUtils.createColourFromName(ft);
featureColours.put(ft, new FeatureColour(colour));
}
- SequenceFeature sf = new SequenceFeature(ft, desc, "", startPos,
- endPos, featureGroup);
+ SequenceFeature sf = null;
if (gffColumns.length > 6)
{
float score = Float.NaN;
try
{
score = new Float(gffColumns[6]).floatValue();
if (gffColumns.length > 6)
{
float score = Float.NaN;
try
{
score = new Float(gffColumns[6]).floatValue();
- // update colourgradient bounds if allowed to
} catch (NumberFormatException ex)
{
} catch (NumberFormatException ex)
{
- // leave as NaN
+ sf = new SequenceFeature(ft, desc, startPos, endPos, featureGroup);
}
}
- sf.setScore(score);
+ sf = new SequenceFeature(ft, desc, startPos, endPos, score,
+ featureGroup);
+ }
+ else
+ {
+ sf = new SequenceFeature(ft, desc, startPos, endPos, featureGroup);
}
parseDescriptionHTML(sf, removeHTML);
}
parseDescriptionHTML(sf, removeHTML);
@@
-542,12
+531,15
@@
public class FeaturesFile extends AlignFile implements FeaturesSourceI
.toArray(new String[visible.keySet().size()]);
/*
.toArray(new String[visible.keySet().size()]);
/*
- * sort groups alphabetically, and ensure that null group is output last
+ * sort groups alphabetically, and ensure that features with a
+ * null or empty group are output after those in named groups
*/
List<String> sortedGroups = new ArrayList<String>(visibleFeatureGroups);
sortedGroups.remove(null);
*/
List<String> sortedGroups = new ArrayList<String>(visibleFeatureGroups);
sortedGroups.remove(null);
+ sortedGroups.remove("");
Collections.sort(sortedGroups);
sortedGroups.add(null);
Collections.sort(sortedGroups);
sortedGroups.add(null);
+ sortedGroups.add("");
boolean foundSome = false;
boolean foundSome = false;
@@
-570,7
+562,8
@@
public class FeaturesFile extends AlignFile implements FeaturesSourceI
for (String group : sortedGroups)
{
for (String group : sortedGroups)
{
- if (group != null)
+ boolean isNamedGroup = (group != null && !"".equals(group));
+ if (isNamedGroup)
{
out.append(newline);
out.append("STARTGROUP").append(TAB);
{
out.append(newline);
out.append("STARTGROUP").append(TAB);
@@
-598,7
+591,7
@@
public class FeaturesFile extends AlignFile implements FeaturesSourceI
}
}
}
}
- if (group != null)
+ if (isNamedGroup)
{
out.append("ENDGROUP").append(TAB);
out.append(group);
{
out.append("ENDGROUP").append(TAB);
out.append(group);
@@
-869,8
+862,8
@@
public class FeaturesFile extends AlignFile implements FeaturesSourceI
fromCount = Integer.parseInt(tokens[2]);
} catch (NumberFormatException nfe)
{
fromCount = Integer.parseInt(tokens[2]);
} catch (NumberFormatException nfe)
{
- throw new IOException("Invalid number in Align field: "
- + nfe.getMessage());
+ throw new IOException(
+ "Invalid number in Align field: " + nfe.getMessage());
}
/*
}
/*
@@
-1091,9
+1084,8
@@
public class FeaturesFile extends AlignFile implements FeaturesSourceI
* @param newseqs
* @throws IOException
*/
* @param newseqs
* @throws IOException
*/
- protected void processGffPragma(String line,
- Map<String, String> gffProps, AlignmentI align,
- List<SequenceI> newseqs) throws IOException
+ protected void processGffPragma(String line, Map<String, String> gffProps,
+ AlignmentI align, List<SequenceI> newseqs) throws IOException
{
line = line.trim();
if ("###".equals(line))
{
line = line.trim();
if ("###".equals(line))