X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FFeaturesFile.java;h=498226b17bf783271e9f6d26e1d0192af8c73d69;hb=4d7f98a6dd54d9863ba449ec79dcd95d25ed863d;hp=fbe871b67a7af8130062988385817d11b3d15850;hpb=619cc880371f3228e6a1fb33c6bfb6e7a7e2622c;p=jalview.git diff --git a/src/jalview/io/FeaturesFile.java b/src/jalview/io/FeaturesFile.java index fbe871b..498226b 100755 --- a/src/jalview/io/FeaturesFile.java +++ b/src/jalview/io/FeaturesFile.java @@ -214,7 +214,8 @@ public class FeaturesFile extends AlignFile { SequenceI seq = null; /** - * keep track of any sequences we try to create from the data if it is a GFF3 file + * keep track of any sequences we try to create from the data if it is a + * GFF3 file */ ArrayList newseqs = new ArrayList(); String type, desc, token = null; @@ -833,18 +834,19 @@ public class FeaturesFile extends AlignFile * @return true if sf was actually added to the sequence, false if it was * processed in another way */ - public boolean processOrAddSeqFeature(AlignmentI align, List newseqs, SequenceI seq, SequenceFeature sf, + public boolean processOrAddSeqFeature(AlignmentI align, + List newseqs, SequenceI seq, SequenceFeature sf, boolean gFFFile, boolean relaxedIdMatching) { String attr = (String) sf.getValue("ATTRIBUTES"); boolean add = true; if (gFFFile && attr != null) { - int nattr=8; + int nattr = 8; for (String attset : attr.split("\t")) { - if (attset==null || attset.trim().length()==0) + if (attset == null || attset.trim().length() == 0) { continue; } @@ -860,22 +862,25 @@ public class FeaturesFile extends AlignFile continue; } - // expect either space seperated (gff2) or '=' separated (gff3) + // expect either space seperated (gff2) or '=' separated (gff3) // key/value pairs here - int eqpos = pair.indexOf('='),sppos = pair.indexOf(' '); + int eqpos = pair.indexOf('='), sppos = pair.indexOf(' '); String key = null, value = null; if (sppos > -1 && (eqpos == -1 || sppos < eqpos)) { key = pair.substring(0, sppos); value = pair.substring(sppos + 1); - } else { + } + else + { if (eqpos > -1 && (sppos == -1 || eqpos < sppos)) { key = pair.substring(0, eqpos); value = pair.substring(eqpos + 1); - } else + } + else { key = pair; } @@ -898,8 +903,8 @@ public class FeaturesFile extends AlignFile { add &= processGffKey(set, nattr, seq, sf, align, newseqs, relaxedIdMatching); // process decides if - // feature is actually - // added + // feature is actually + // added } catch (InvalidGFF3FieldException ivfe) { System.err.println(ivfe); @@ -948,20 +953,20 @@ public class FeaturesFile extends AlignFile { int strand = sf.getStrand(); // exonerate cdna/protein map - // look for fields + // look for fields List querySeq = findNames(align, newseqs, - relaxedIdMatching, set.get(attr="Query")); - if (querySeq==null || querySeq.size()!=1) + relaxedIdMatching, set.get(attr = "Query")); + if (querySeq == null || querySeq.size() != 1) { - throw new InvalidGFF3FieldException( attr, set, + throw new InvalidGFF3FieldException(attr, set, "Expecting exactly one sequence in Query field (got " + set.get(attr) + ")"); } - if (set.containsKey(attr="Align")) + if (set.containsKey(attr = "Align")) { // process the align maps and create cdna/protein maps // ideally, the query sequences are in the alignment, but maybe not... - + AlignedCodonFrame alco = new AlignedCodonFrame(); MapList codonmapping = constructCodonMappingFromAlign(set, attr, strand); @@ -979,8 +984,8 @@ public class FeaturesFile extends AlignFile } private MapList constructCodonMappingFromAlign( - Map> set, - String attr, int strand) throws InvalidGFF3FieldException + Map> set, String attr, int strand) + throws InvalidGFF3FieldException { if (strand == 0) { @@ -1134,21 +1139,21 @@ public class FeaturesFile extends AlignFile } } } - + } - if (match==null && newseqs!=null) + if (match == null && newseqs != null) { match = new SequenceDummy(seqId); if (relaxedIdMatching) { - matcher.addAll(Arrays.asList(new SequenceI[] - { match })); + matcher.addAll(Arrays.asList(new SequenceI[] { match })); } // add dummy sequence to the newseqs list newseqs.add(match); } return match; } + public void parseDescriptionHTML(SequenceFeature sf, boolean removeHTML) { if (sf.getDescription() == null) @@ -1176,7 +1181,8 @@ public class FeaturesFile extends AlignFile * hash of feature types and colours * @return features file contents */ - public String printJalviewFormat(SequenceI[] seqs, Map visible) + public String printJalviewFormat(SequenceI[] seqs, + Map visible) { return printJalviewFormat(seqs, visible, true, true); } @@ -1424,13 +1430,13 @@ public class FeaturesFile extends AlignFile * @param visible * @return */ - public String printGFFFormat(SequenceI[] seqs, Map visible) + public String printGFFFormat(SequenceI[] seqs, Map visible) { return printGFFFormat(seqs, visible, true, true); } - public String printGFFFormat(SequenceI[] seqs, Map visible, - boolean visOnly, boolean nonpos) + public String printGFFFormat(SequenceI[] seqs, + Map visible, boolean visOnly, boolean nonpos) { StringBuffer out = new StringBuffer(); SequenceFeature[] next;