From 551b3a8e53ff6b43f9d0bce08759e46f49373bed Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Thu, 16 Sep 2021 10:17:51 +0100 Subject: [PATCH] JAL-3761 listToArray became rangeListToArray --- src/jalview/io/EmblFlatFile.java | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/jalview/io/EmblFlatFile.java b/src/jalview/io/EmblFlatFile.java index ff18a34..92af0df 100644 --- a/src/jalview/io/EmblFlatFile.java +++ b/src/jalview/io/EmblFlatFile.java @@ -50,10 +50,11 @@ public class EmblFlatFile extends AlignFile // FileParse private static final String DOUBLED_QUOTE = QUOTE + QUOTE; /** - * when true, interpret the mol_type 'source' feature attribute - * and generate an RNA sequence from the DNA record + * when true, interpret the mol_type 'source' feature attribute and generate + * an RNA sequence from the DNA record */ - private boolean produceRna=true; + private boolean produceRna = true; + /** * A data bean class to hold values parsed from one CDS Feature (FT) */ @@ -91,7 +92,8 @@ public class EmblFlatFile extends AlignFile // FileParse private List dbrefs; // from DR - private boolean sequenceStringIsRNA=false; + private boolean sequenceStringIsRNA = false; + private String sequenceString; // from SQ lines /* @@ -323,11 +325,12 @@ public class EmblFlatFile extends AlignFile // FileParse String parseFT(String line) throws IOException { String[] tokens = line.split(WHITESPACE); - if (tokens.length < 3 || (!"CDS".equals(tokens[1]) && !"source".equals(tokens[1]))) + if (tokens.length < 3 + || (!"CDS".equals(tokens[1]) && !"source".equals(tokens[1]))) { return nextLine(); } - + if (tokens[1].equals("source")) { return parseSourceQualifiers(tokens); @@ -432,8 +435,9 @@ public class EmblFlatFile extends AlignFile // FileParse } /** - * process attributes for 'source' until the next FT feature entry - * only interested in 'mol_type' + * process attributes for 'source' until the next FT feature entry only + * interested in 'mol_type' + * * @param tokens * @return * @throws IOException @@ -461,7 +465,7 @@ public class EmblFlatFile extends AlignFile // FileParse int p = line.indexOf("\\mol_type"); int qs = line.indexOf("\"", p); int qe = line.indexOf("\"", qs + 1); - String qualifier=line.substring(qs,qe).toLowerCase(); + String qualifier = line.substring(qs, qe).toLowerCase(); if (qualifier.indexOf("rna") > -1) { sequenceStringIsRNA = true; @@ -470,7 +474,7 @@ public class EmblFlatFile extends AlignFile // FileParse { sequenceStringIsRNA = false; } - line=parseFeatureQualifier(sb, "source"); + line = parseFeatureQualifier(sb, "source"); } return line; } @@ -485,7 +489,7 @@ public class EmblFlatFile extends AlignFile // FileParse */ static String removeQuotes(String value) { - if (value == null) + if (value == null) { return null; } @@ -582,12 +586,12 @@ public class EmblFlatFile extends AlignFile // FileParse { name = this.sourceDb + "|" + name; } - + if (produceRna && sequenceStringIsRNA) { sequenceString = sequenceString.replace('T', 'U').replace('t', 'u'); } - + SequenceI seq = new Sequence(name, this.sequenceString); seq.setDescription(this.description); @@ -861,7 +865,7 @@ public class EmblFlatFile extends AlignFile // FileParse try { List ranges = DnaUtils.parseLocation(location); - return MappingUtils.listToArray(ranges); + return MappingUtils.rangeListToArray(ranges); } catch (ParseException e) { Cache.log.warn( -- 1.7.10.2