| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0a86883 commit a74c015
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -283,7 +283,7 @@ private String parse(BufferedReader bufferedReader) { | |||
| 283 | 283 | // new feature! | |
| 284 | 284 | gbFeature = new TextFeature(key, val, key, key); | |
| 285 | 285 | Location l = | |
| 286 | - locationParser.parse(val); | ||
| 286 | + locationParser.parse(val, isCircularSequence); | ||
| 287 | 287 | gbFeature.setLocation((AbstractLocation)l); | |
| 288 | 288 | ||
| 289 | 289 | if (!featureCollection.containsKey(key)) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -135,40 +135,45 @@ public DataSource getDataSource() { | |||
| 135 | 135 | * @return The parsed location | |
| 136 | 136 | * @throws ParserException thrown in the event of any error during parsing | |
| 137 | 137 | */ | |
| 138 | - public Location parse(String locationString) throws ParserException { | ||
| 138 | + public Location parse(String locationString, boolean isSequenceCircular) throws ParserException { | ||
| 139 | 139 | featureGlobalStart = Integer.MAX_VALUE; | |
| 140 | 140 | featureGlobalEnd = 1; | |
| 141 | 141 | ||
| 142 | 142 | Location l; | |
| 143 | - List<Location> ll = parseLocationString(locationString, 1); | ||
| 143 | + List<Location> ll = parseLocationString(locationString, 1, isSequenceCircular); | ||
| 144 | 144 | ||
| 145 | 145 | if (ll.size() == 1) { | |
| 146 | 146 | l = ll.get(0); | |
| 147 | 147 | } else { | |
| 148 | 148 | l = new SimpleLocation( | |
| 149 | - featureGlobalStart, | ||
| 150 | - featureGlobalEnd, | ||
| 149 | + new SimplePoint(featureGlobalStart), | ||
| 150 | + new SimplePoint(featureGlobalEnd), | ||
| 151 | 151 | Strand.UNDEFINED, | |
| 152 | + isSequenceCircular, | ||
| 152 | 153 | ll); | |
| 153 | 154 | } | |
| 154 | 155 | return l; | |
| 155 | 156 | } | |
| 156 | 157 | ||
| 157 | - /** | ||
| 158 | - * Reader based version of the parse methods. | ||
| 159 | - * | ||
| 160 | - * @param reader The source of the data; assumes that end of the reader | ||
| 161 | - * stream is the end of the location string to parse | ||
| 162 | - * @return The parsed location | ||
| 163 | - * @throws IOException Thrown with any reader error | ||
| 164 | - * @throws ParserException Thrown with any error with parsing locations | ||
| 165 | - */ | ||
| 158 | + public Location parse(String locationString) throws ParserException { | ||
| 159 | + return parse(locationString, false); | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + /** | ||
| 163 | + * Reader based version of the parse methods. | ||
| 164 | + * | ||
| 165 | + * @param reader The source of the data; assumes that end of the reader | ||
| 166 | + * stream is the end of the location string to parse | ||
| 167 | + * @return The parsed location | ||
| 168 | + * @throws IOException Thrown with any reader error | ||
| 169 | + * @throws ParserException Thrown with any error with parsing locations | ||
| 170 | + */ | ||
| 166 | 171 | public List<AbstractLocation> parse(Reader reader) throws IOException, ParserException { | |
| 167 | 172 | // use parse(String s) instead! | |
| 168 | 173 | return null; | |
| 169 | 174 | } | |
| 170 | 175 | ||
| 171 | - private List<Location> parseLocationString(String string, int versus) throws ParserException { | ||
| 176 | + private List<Location> parseLocationString(String string, int versus, boolean isSequenceCircular) throws ParserException { | ||
| 172 | 177 | Matcher m; | |
| 173 | 178 | List<Location> boundedLocationsCollection = new ArrayList<Location>(); | |
| 174 | 179 | ||
@@ -186,7 +191,8 @@ private List<Location> parseLocationString(String string, int versus) throws Par | |||
| 186 | 191 | if (!splitQualifier.isEmpty()) { | |
| 187 | 192 | //recursive case | |
| 188 | 193 | int localVersus = splitQualifier.equalsIgnoreCase("complement") ? -1 : 1; | |
| 189 | - List<Location> subLocations = parseLocationString(splitString, versus * localVersus); | ||
| 194 | + List<Location> subLocations = parseLocationString( | ||
| 195 | + splitString, versus * localVersus, isSequenceCircular); | ||
| 190 | 196 | ||
| 191 | 197 | switch (complexFeaturesAppendMode) { | |
| 192 | 198 | case FLATTEN: | |
@@ -228,8 +234,8 @@ private List<Location> parseLocationString(String string, int versus) throws Par | |||
| 228 | 234 | ||
| 229 | 235 | String accession = m.group(1); | |
| 230 | 236 | Strand s = versus == 1 ? Strand.POSITIVE : Strand.NEGATIVE; | |
| 231 | - int start = Integer.parseInt(m.group(3)); | ||
| 232 | - int end = m.group(6) == null ? start : new Integer(m.group(6)); | ||
| 237 | + int start = Integer.valueOf(m.group(3)); | ||
| 238 | + int end = m.group(6) == null ? start : Integer.valueOf(m.group(6)); | ||
| 233 | 239 | ||
| 234 | 240 | if (featureGlobalStart > start) { | |
| 235 | 241 | featureGlobalStart = start; | |
@@ -239,8 +245,8 @@ private List<Location> parseLocationString(String string, int versus) throws Par | |||
| 239 | 245 | } | |
| 240 | 246 | ||
| 241 | 247 | AbstractLocation l = new SimpleLocation( | |
| 242 | - start, | ||
| 243 | - end, | ||
| 248 | + new SimplePoint(start), | ||
| 249 | + new SimplePoint(end), | ||
| 244 | 250 | s | |
| 245 | 251 | ); | |
| 246 | 252 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments