X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FFeaturesFile.java;h=71fc659c9d178d9a7ff2a4f215126535c79f6bb5;hb=08c7bee16c16563cc7cec7ea4d336b3e0c4c937a;hp=a8a3746af0940f1fb3f1f934214878dbde37f8d7;hpb=9135cbb74bbff06ea60485540194515ebcc018b0;p=jalview.git diff --git a/src/jalview/io/FeaturesFile.java b/src/jalview/io/FeaturesFile.java index a8a3746..71fc659 100755 --- a/src/jalview/io/FeaturesFile.java +++ b/src/jalview/io/FeaturesFile.java @@ -20,6 +20,20 @@ */ package jalview.io; +import java.util.Locale; + +import java.awt.Color; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.TreeMap; + import jalview.analysis.AlignmentUtils; import jalview.analysis.SequenceIdMatcher; import jalview.api.AlignViewportI; @@ -44,18 +58,6 @@ import jalview.util.MapList; import jalview.util.ParseHtmlBodyAndLinks; import jalview.util.StringUtils; -import java.awt.Color; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.TreeMap; - /** * Parses and writes features files, which may be in Jalview, GFF2 or GFF3 * format. These are tab-delimited formats but with differences in the use of @@ -108,11 +110,11 @@ public class FeaturesFile extends AlignFile implements FeaturesSourceI /** * Constructor which does not parse the file immediately * - * @param file + * @param file File or String filename * @param paste * @throws IOException */ - public FeaturesFile(String file, DataSourceType paste) + public FeaturesFile(Object file, DataSourceType paste) throws IOException { super(false, file, paste); @@ -135,7 +137,7 @@ public class FeaturesFile extends AlignFile implements FeaturesSourceI * @param type * @throws IOException */ - public FeaturesFile(boolean parseImmediately, String file, + public FeaturesFile(boolean parseImmediately, Object file, DataSourceType type) throws IOException { super(parseImmediately, file, type); @@ -234,7 +236,7 @@ public class FeaturesFile extends AlignFile implements FeaturesSourceI // skip comments/process pragmas if (line.length() == 0 || line.startsWith("#")) { - if (line.toLowerCase().startsWith("##")) + if (line.toLowerCase(Locale.ROOT).startsWith("##")) { processGffPragma(line, gffProps, align, newseqs); } @@ -346,7 +348,7 @@ public class FeaturesFile extends AlignFile implements FeaturesSourceI String line; while ((line = nextLine()) != null) { - if (line.toUpperCase().startsWith(ENDFILTERS)) + if (line.toUpperCase(Locale.ROOT).startsWith(ENDFILTERS)) { return; } @@ -736,7 +738,6 @@ public class FeaturesFile extends AlignFile implements FeaturesSourceI if (mf != null) { - MapList mapping = mf.mapping.getMap(); for (SequenceFeature sf : mf.features) { /* @@ -752,9 +753,7 @@ public class FeaturesFile extends AlignFile implements FeaturesSourceI found.add(sf); int begin = sf.getBegin(); int end = sf.getEnd(); - int[] range = mf.mapping.getTo() == seq.getDatasetSequence() - ? mapping.locateInTo(begin, end) - : mapping.locateInFrom(begin, end); + int[] range = mf.getMappedPositions(begin, end); SequenceFeature sf2 = new SequenceFeature(sf, range[0], range[1], group, sf.getScore()); complementary.add(sf2); @@ -1394,7 +1393,9 @@ public class FeaturesFile extends AlignFile implements FeaturesSourceI } catch (IOException q) { } - FastaFile parser = new FastaFile(this); + // Opening a FastaFile object with the remainder of this object's dataIn. + // Tell the constructor to NOT close the dataIn when finished. + FastaFile parser = new FastaFile(this, false); List includedseqs = parser.getSeqs(); SequenceIdMatcher smatcher = new SequenceIdMatcher(newseqs);