2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
\r
3 * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
5 * This program is free software; you can redistribute it and/or
\r
6 * modify it under the terms of the GNU General Public License
\r
7 * as published by the Free Software Foundation; either version 2
\r
8 * of the License, or (at your option) any later version.
\r
10 * This program is distributed in the hope that it will be useful,
\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 * GNU General Public License for more details.
\r
15 * You should have received a copy of the GNU General Public License
\r
16 * along with this program; if not, write to the Free Software
\r
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
25 import jalview.analysis.*;
\r
26 import jalview.datamodel.*;
\r
27 import jalview.schemes.*;
\r
29 public class AnnotationFile
\r
31 StringBuffer text = new StringBuffer("JALVIEW_ANNOTATION\n"
\r
32 + "# Created: " + new java.util.Date() + "\n\n");
\r
35 * convenience method for pre-2.4 feature files which have no view, hidden
\r
36 * columns or hidden row keywords.
\r
38 * @param annotations
\r
41 * @return feature file as a string.
\r
43 public String printAnnotations(AlignmentAnnotation[] annotations,
\r
44 Vector groups, Hashtable properties)
\r
46 return printAnnotations(annotations, groups, properties, null);
\r
51 * hold all the information about a particular view definition read from or
\r
52 * written out in an annotations file.
\r
54 public class ViewDef
\r
56 public String viewname;
\r
58 public HiddenSequences hidseqs;
\r
60 public ColumnSelection hiddencols;
\r
62 public Vector visibleGroups;
\r
64 public ViewDef(String viewname, HiddenSequences hidseqs,
\r
65 ColumnSelection hiddencols)
\r
67 this.viewname = viewname;
\r
68 this.hidseqs = hidseqs;
\r
69 this.hiddencols = hiddencols;
\r
73 public String printAnnotations(AlignmentAnnotation[] annotations,
\r
74 Vector groups, Hashtable properties, ViewDef[] views)
\r
76 if (annotations != null)
\r
78 boolean oneColour = true;
\r
79 AlignmentAnnotation row;
\r
81 SequenceI refSeq = null;
\r
83 StringBuffer colours = new StringBuffer();
\r
84 StringBuffer graphLine = new StringBuffer();
\r
86 Hashtable graphGroup = new Hashtable();
\r
88 java.awt.Color color;
\r
90 for (int i = 0; i < annotations.length; i++)
\r
92 row = annotations[i];
\r
94 if (!row.visible && !row.hasScore())
\r
102 if (row.sequenceRef == null)
\r
104 if (refSeq != null)
\r
106 text.append("\nSEQUENCE_REF\tALIGNMENT\n");
\r
112 else if (refSeq == null || refSeq != row.sequenceRef)
\r
114 refSeq = row.sequenceRef;
\r
115 text.append("\nSEQUENCE_REF\t" + refSeq.getName() + "\n");
\r
118 if (row.graph == AlignmentAnnotation.NO_GRAPH)
\r
120 text.append("NO_GRAPH\t");
\r
124 if (row.graph == AlignmentAnnotation.BAR_GRAPH)
\r
126 text.append("BAR_GRAPH\t");
\r
128 else if (row.graph == AlignmentAnnotation.LINE_GRAPH)
\r
130 text.append("LINE_GRAPH\t");
\r
133 if (row.getThreshold() != null)
\r
136 .append("GRAPHLINE\t"
\r
139 + row.getThreshold().value
\r
141 + row.getThreshold().label
\r
143 + jalview.util.Format.getHexString(row
\r
144 .getThreshold().colour) + "\n");
\r
147 if (row.graphGroup > -1)
\r
149 String key = String.valueOf(row.graphGroup);
\r
150 if (graphGroup.containsKey(key))
\r
152 graphGroup.put(key, graphGroup.get(key) + "\t" + row.label);
\r
156 graphGroup.put(key, row.label);
\r
161 text.append(row.label + "\t");
\r
162 if (row.description != null)
\r
164 text.append(row.description + "\t");
\r
167 for (int j = 0; row.annotations != null
\r
168 && j < row.annotations.length; j++)
\r
171 && jalview.util.Comparison.isGap(refSeq.getCharAt(j)))
\r
176 if (row.annotations[j] != null)
\r
179 if (row.annotations[j].secondaryStructure != ' ')
\r
181 text.append(comma + row.annotations[j].secondaryStructure);
\r
184 if (row.annotations[j].displayCharacter != null
\r
185 && row.annotations[j].displayCharacter.length() > 0
\r
186 && !row.annotations[j].displayCharacter.equals(" "))
\r
188 text.append(comma + row.annotations[j].displayCharacter);
\r
192 if (row.annotations[j] != null)
\r
194 if (color != null && !color.equals(row.annotations[j].colour))
\r
199 color = row.annotations[j].colour;
\r
200 if (row.annotations[j].value != 0f
\r
201 && row.annotations[j].value != Float.NaN)
\r
203 text.append(comma + row.annotations[j].value);
\r
207 if (row.annotations[j].colour != null
\r
208 && row.annotations[j].colour != java.awt.Color.black)
\r
212 + jalview.util.Format
\r
213 .getHexString(row.annotations[j].colour)
\r
220 if (row.hasScore())
\r
221 text.append("\t" + row.score);
\r
225 if (color != null && color != java.awt.Color.black && oneColour)
\r
227 colours.append("COLOUR\t" + row.label + "\t"
\r
228 + jalview.util.Format.getHexString(color) + "\n");
\r
235 text.append(colours.toString());
\r
236 text.append(graphLine.toString());
\r
237 if (graphGroup.size() > 0)
\r
239 text.append("COMBINE\t");
\r
240 Enumeration en = graphGroup.elements();
\r
241 while (en.hasMoreElements())
\r
243 text.append(en.nextElement() + "\n");
\r
248 if (groups != null)
\r
250 printGroups(groups);
\r
253 if (properties != null)
\r
255 text.append("\n\nALIGNMENT");
\r
256 Enumeration en = properties.keys();
\r
257 while (en.hasMoreElements())
\r
259 String key = en.nextElement().toString();
\r
260 text.append("\t" + key + "=" + properties.get(key));
\r
265 return text.toString();
\r
268 public void printGroups(Vector sequenceGroups)
\r
271 for (int i = 0; i < sequenceGroups.size(); i++)
\r
273 sg = (SequenceGroup) sequenceGroups.elementAt(i);
\r
274 text.append("SEQUENCE_GROUP\t" + sg.getName() + "\t"
\r
275 + (sg.getStartRes() + 1) + "\t" + (sg.getEndRes() + 1) + "\t"
\r
277 for (int s = 0; s < sg.getSize(); s++)
\r
279 text.append(sg.getSequenceAt(s).getName() + "\t");
\r
282 text.append("\nPROPERTIES\t" + sg.getName() + "\t");
\r
284 if (sg.getDescription() != null)
\r
286 text.append("description=" + sg.getDescription() + "\t");
\r
290 text.append("colour=" + ColourSchemeProperty.getColourName(sg.cs)
\r
292 if (sg.cs.getThreshold() != 0)
\r
294 text.append("pidThreshold=" + sg.cs.getThreshold());
\r
296 if (sg.cs.conservationApplied())
\r
298 text.append("consThreshold=" + sg.cs.getConservationInc() + "\t");
\r
301 text.append("outlineColour="
\r
302 + jalview.util.Format.getHexString(sg.getOutlineColour())
\r
305 text.append("displayBoxes=" + sg.getDisplayBoxes() + "\t");
\r
306 text.append("displayText=" + sg.getDisplayText() + "\t");
\r
307 text.append("colourText=" + sg.getColourText() + "\t");
\r
309 if (sg.textColour != java.awt.Color.black)
\r
311 text.append("textCol1="
\r
312 + jalview.util.Format.getHexString(sg.textColour) + "\t");
\r
314 if (sg.textColour2 != java.awt.Color.white)
\r
316 text.append("textCol2="
\r
317 + jalview.util.Format.getHexString(sg.textColour2) + "\t");
\r
319 if (sg.thresholdTextColour != 0)
\r
321 text.append("textColThreshold=" + sg.thresholdTextColour);
\r
323 if (sg.idColour != null)
\r
325 text.append("idColour="
\r
326 + jalview.util.Format.getHexString(sg.idColour) + "\t");
\r
329 text.append("\n\n");
\r
334 SequenceI refSeq = null;
\r
336 String refSeqId = null;
\r
338 public boolean readAnnotationFile(AlignmentI al, String file,
\r
343 BufferedReader in = null;
\r
344 if (protocol.equals(AppletFormatAdapter.FILE))
\r
346 in = new BufferedReader(new FileReader(file));
\r
348 else if (protocol.equals(AppletFormatAdapter.URL))
\r
350 URL url = new URL(file);
\r
351 in = new BufferedReader(new InputStreamReader(url.openStream()));
\r
353 else if (protocol.equals(AppletFormatAdapter.PASTE))
\r
355 in = new BufferedReader(new StringReader(file));
\r
357 else if (protocol.equals(AppletFormatAdapter.CLASSLOADER))
\r
359 java.io.InputStream is = getClass().getResourceAsStream("/" + file);
\r
362 in = new BufferedReader(new java.io.InputStreamReader(is));
\r
366 String line, label, description, token;
\r
367 int graphStyle, index;
\r
368 int refSeqIndex = 1;
\r
369 int existingAnnotations = 0;
\r
370 if (al.getAlignmentAnnotation() != null)
\r
372 existingAnnotations = al.getAlignmentAnnotation().length;
\r
375 int alWidth = al.getWidth();
\r
377 StringTokenizer st;
\r
378 Annotation[] annotations;
\r
379 AlignmentAnnotation annotation = null;
\r
381 // First confirm this is an Annotation file
\r
382 boolean jvAnnotationFile = false;
\r
383 while ((line = in.readLine()) != null)
\r
385 if (line.indexOf("#") == 0)
\r
390 if (line.indexOf("JALVIEW_ANNOTATION") > -1)
\r
392 jvAnnotationFile = true;
\r
397 if (!jvAnnotationFile)
\r
403 while ((line = in.readLine()) != null)
\r
405 if (line.indexOf("#") == 0
\r
406 || line.indexOf("JALVIEW_ANNOTATION") > -1
\r
407 || line.length() == 0)
\r
412 st = new StringTokenizer(line, "\t");
\r
413 token = st.nextToken();
\r
414 if (token.equalsIgnoreCase("COLOUR"))
\r
416 colourAnnotations(al, st.nextToken(), st.nextToken());
\r
420 else if (token.equalsIgnoreCase("COMBINE"))
\r
422 combineAnnotations(al, st);
\r
426 else if (token.equalsIgnoreCase("GRAPHLINE"))
\r
432 else if (token.equalsIgnoreCase("SEQUENCE_REF"))
\r
434 if (st.hasMoreTokens())
\r
436 refSeq = al.findName(refSeqId = st.nextToken());
\r
437 if (refSeq == null)
\r
443 refSeqIndex = Integer.parseInt(st.nextToken());
\r
444 if (refSeqIndex < 1)
\r
448 .println("WARNING: SEQUENCE_REF index must be > 0 in AnnotationFile");
\r
450 } catch (Exception ex)
\r
463 else if (token.equalsIgnoreCase("SEQUENCE_GROUP"))
\r
469 else if (token.equalsIgnoreCase("PROPERTIES"))
\r
471 addProperties(al, st);
\r
475 else if (token.equalsIgnoreCase("BELOW_ALIGNMENT"))
\r
477 setBelowAlignment(al, st);
\r
480 else if (token.equalsIgnoreCase("ALIGNMENT"))
\r
482 addAlignmentDetails(al, st);
\r
486 graphStyle = AlignmentAnnotation.getGraphValueFromString(token);
\r
487 label = st.nextToken();
\r
490 annotations = new Annotation[alWidth];
\r
491 description = null;
\r
492 float score = Float.NaN;
\r
494 if (st.hasMoreTokens())
\r
496 line = st.nextToken();
\r
498 if (line.indexOf("|") == -1)
\r
500 description = line;
\r
501 if (st.hasMoreTokens())
\r
502 line = st.nextToken();
\r
505 if (st.hasMoreTokens())
\r
507 // This must be the score
\r
508 score = Float.valueOf(st.nextToken()).floatValue();
\r
511 st = new StringTokenizer(line, "|", true);
\r
513 boolean emptyColumn = true;
\r
514 boolean onlyOneElement = (st.countTokens() == 1);
\r
516 while (st.hasMoreElements() && index < alWidth)
\r
518 token = st.nextToken().trim();
\r
520 if (onlyOneElement)
\r
524 score = Float.valueOf(token).floatValue();
\r
526 } catch (NumberFormatException ex)
\r
531 if (token.equals("|"))
\r
538 emptyColumn = true;
\r
542 annotations[index++] = parseAnnotation(token);
\r
543 emptyColumn = false;
\r
549 annotation = new AlignmentAnnotation(label, description,
\r
550 (index == 0) ? null : annotations, 0, 0, graphStyle);
\r
552 annotation.score = score;
\r
554 if (refSeq != null)
\r
556 annotation.belowAlignment = false;
\r
557 // make a copy of refSeq so we can find other matches in the alignment
\r
558 SequenceI referedSeq = refSeq;
\r
561 // copy before we do any mapping business.
\r
562 // TODO: verify that undo/redo with 1:many sequence associated
\r
563 // annotations can be undone correctly
\r
564 AlignmentAnnotation ann = new AlignmentAnnotation(annotation);
\r
565 annotation.createSequenceMapping(referedSeq, refSeqIndex, false);
\r
566 annotation.adjustForAlignment();
\r
567 referedSeq.addAlignmentAnnotation(annotation);
\r
568 al.addAnnotation(annotation);
\r
569 al.setAnnotationIndex(annotation,
\r
570 al.getAlignmentAnnotation().length
\r
571 - existingAnnotations - 1);
\r
572 // and recover our virgin copy to use again if necessary.
\r
575 } while (refSeqId != null
\r
576 && (referedSeq = al.findName(referedSeq, refSeqId, true)) != null);
\r
580 al.addAnnotation(annotation);
\r
581 al.setAnnotationIndex(annotation,
\r
582 al.getAlignmentAnnotation().length - existingAnnotations
\r
587 } catch (Exception ex)
\r
589 ex.printStackTrace();
\r
590 System.out.println("Problem reading annotation file: " + ex);
\r
596 Annotation parseAnnotation(String string)
\r
598 String desc = null, displayChar = null;
\r
599 char ss = ' '; // secondaryStructure
\r
601 boolean parsedValue = false;
\r
603 // find colour here
\r
604 java.awt.Color colour = null;
\r
605 int i = string.indexOf("[");
\r
606 int j = string.indexOf("]");
\r
607 if (i > -1 && j > -1)
\r
609 UserColourScheme ucs = new UserColourScheme();
\r
611 colour = ucs.getColourFromString(string.substring(i + 1, j));
\r
613 string = string.substring(0, i) + string.substring(j + 1);
\r
616 StringTokenizer st = new StringTokenizer(string, ",");
\r
618 while (st.hasMoreTokens())
\r
620 token = st.nextToken().trim();
\r
621 if (token.length() == 0)
\r
630 displayChar = token;
\r
631 value = new Float(token).floatValue();
\r
632 parsedValue = true;
\r
634 } catch (NumberFormatException ex)
\r
639 if (token.equals("H") || token.equals("E"))
\r
641 // Either this character represents a helix or sheet
\r
642 // or an integer which can be displayed
\r
643 ss = token.charAt(0);
\r
644 if (displayChar.equals(token.substring(0, 1)))
\r
649 else if (desc == null)
\r
656 if (displayChar != null && displayChar.length() > 1 && desc != null
\r
657 && desc.length() == 1)
\r
659 String tmp = displayChar;
\r
660 displayChar = desc;
\r
664 * In principle, this code will ensure that the Annotation element generated
\r
665 * is renderable by any of the applet or application rendering code but
\r
666 * instead we check for null strings when the display character is rendered.
\r
667 * if (displayChar==null) { displayChar=""; }
\r
669 Annotation anot = new Annotation(displayChar, desc, ss, value);
\r
671 anot.colour = colour;
\r
676 void colourAnnotations(AlignmentI al, String label, String colour)
\r
678 UserColourScheme ucs = new UserColourScheme(colour);
\r
679 Annotation[] annotations;
\r
680 for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
\r
682 if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(label))
\r
684 annotations = al.getAlignmentAnnotation()[i].annotations;
\r
685 for (int j = 0; j < annotations.length; j++)
\r
687 if (annotations[j] != null)
\r
689 annotations[j].colour = ucs.findColour('A');
\r
696 void combineAnnotations(AlignmentI al, StringTokenizer st)
\r
698 int graphGroup = -1;
\r
699 String group = st.nextToken();
\r
700 // First make sure we are not overwriting the graphIndex
\r
701 for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
\r
703 if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group))
\r
705 graphGroup = al.getAlignmentAnnotation()[i].graphGroup + 1;
\r
706 al.getAlignmentAnnotation()[i].graphGroup = graphGroup;
\r
711 // Now update groups
\r
712 while (st.hasMoreTokens())
\r
714 group = st.nextToken();
\r
715 for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
\r
717 if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group))
\r
719 al.getAlignmentAnnotation()[i].graphGroup = graphGroup;
\r
726 void addLine(AlignmentI al, StringTokenizer st)
\r
728 String group = st.nextToken();
\r
729 AlignmentAnnotation annotation = null;
\r
731 for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
\r
733 if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group))
\r
735 annotation = al.getAlignmentAnnotation()[i];
\r
740 if (annotation == null)
\r
744 float value = new Float(st.nextToken()).floatValue();
\r
745 String label = st.hasMoreTokens() ? st.nextToken() : null;
\r
746 java.awt.Color colour = null;
\r
747 if (st.hasMoreTokens())
\r
749 UserColourScheme ucs = new UserColourScheme(st.nextToken());
\r
750 colour = ucs.findColour('A');
\r
753 annotation.setThreshold(new GraphLine(value, label, colour));
\r
756 void addGroup(AlignmentI al, StringTokenizer st)
\r
758 SequenceGroup sg = new SequenceGroup();
\r
759 sg.setName(st.nextToken());
\r
760 sg.setStartRes(Integer.parseInt(st.nextToken()) - 1);
\r
761 sg.setEndRes(Integer.parseInt(st.nextToken()) - 1);
\r
763 String index = st.nextToken();
\r
764 if (index.equals("-1"))
\r
766 while (st.hasMoreElements())
\r
768 sg.addSequence(al.findName(st.nextToken()), false);
\r
773 StringTokenizer st2 = new StringTokenizer(index, ",");
\r
775 while (st2.hasMoreTokens())
\r
777 String tmp = st2.nextToken();
\r
778 if (tmp.equals("*"))
\r
780 for (int i = 0; i < al.getHeight(); i++)
\r
782 sg.addSequence(al.getSequenceAt(i), false);
\r
785 else if (tmp.indexOf("-") >= 0)
\r
787 StringTokenizer st3 = new StringTokenizer(tmp, "-");
\r
789 int start = (Integer.parseInt(st3.nextToken()));
\r
790 int end = (Integer.parseInt(st3.nextToken()));
\r
794 for (int i = start; i <= end; i++)
\r
796 sg.addSequence(al.getSequenceAt(i - 1), false);
\r
803 .addSequence(al.getSequenceAt(Integer.parseInt(tmp) - 1),
\r
809 if (refSeq != null)
\r
811 sg.setStartRes(refSeq.findIndex(sg.getStartRes() + 1) - 1);
\r
812 sg.setEndRes(refSeq.findIndex(sg.getEndRes() + 1) - 1);
\r
815 if (sg.getSize() > 0)
\r
821 void addProperties(AlignmentI al, StringTokenizer st)
\r
824 // So far we have only added groups to the annotationHash,
\r
825 // the idea is in the future properties can be added to
\r
826 // alignments, other annotations etc
\r
827 if (al.getGroups() == null)
\r
831 SequenceGroup sg = null;
\r
833 String name = st.nextToken();
\r
835 Vector groups = al.getGroups();
\r
836 for (int i = 0; i < groups.size(); i++)
\r
838 sg = (SequenceGroup) groups.elementAt(i);
\r
839 if (sg.getName().equals(name))
\r
851 String keyValue, key, value;
\r
852 ColourSchemeI def = sg.cs;
\r
854 while (st.hasMoreTokens())
\r
856 keyValue = st.nextToken();
\r
857 key = keyValue.substring(0, keyValue.indexOf("="));
\r
858 value = keyValue.substring(keyValue.indexOf("=") + 1);
\r
860 if (key.equalsIgnoreCase("description"))
\r
862 sg.setDescription(value);
\r
864 else if (key.equalsIgnoreCase("colour"))
\r
866 sg.cs = ColourSchemeProperty.getColour(al, value);
\r
868 else if (key.equalsIgnoreCase("pidThreshold"))
\r
870 sg.cs.setThreshold(Integer.parseInt(value), true);
\r
873 else if (key.equalsIgnoreCase("consThreshold"))
\r
875 sg.cs.setConservationInc(Integer.parseInt(value));
\r
876 Conservation c = new Conservation("Group",
\r
877 ResidueProperties.propHash, 3, sg.getSequences(null), sg
\r
878 .getStartRes(), sg.getEndRes() + 1);
\r
881 c.verdict(false, 25);
\r
883 sg.cs.setConservation(c);
\r
886 else if (key.equalsIgnoreCase("outlineColour"))
\r
888 sg.setOutlineColour(new UserColourScheme(value).findColour('A'));
\r
890 else if (key.equalsIgnoreCase("displayBoxes"))
\r
892 sg.setDisplayBoxes(Boolean.valueOf(value).booleanValue());
\r
894 else if (key.equalsIgnoreCase("displayText"))
\r
896 sg.setDisplayText(Boolean.valueOf(value).booleanValue());
\r
898 else if (key.equalsIgnoreCase("colourText"))
\r
900 sg.setColourText(Boolean.valueOf(value).booleanValue());
\r
902 else if (key.equalsIgnoreCase("textCol1"))
\r
904 sg.textColour = new UserColourScheme(value).findColour('A');
\r
906 else if (key.equalsIgnoreCase("textCol2"))
\r
908 sg.textColour2 = new UserColourScheme(value).findColour('A');
\r
910 else if (key.equalsIgnoreCase("textColThreshold"))
\r
912 sg.thresholdTextColour = Integer.parseInt(value);
\r
914 else if (key.equalsIgnoreCase("idColour"))
\r
916 // consider warning if colour doesn't resolve to a real colour
\r
917 sg.setIdColour((def = new UserColourScheme(value))
\r
920 sg.recalcConservation();
\r
929 void setBelowAlignment(AlignmentI al, StringTokenizer st)
\r
932 AlignmentAnnotation aa;
\r
933 while (st.hasMoreTokens())
\r
935 token = st.nextToken();
\r
936 for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
\r
938 aa = al.getAlignmentAnnotation()[i];
\r
939 if (aa.sequenceRef == refSeq && aa.label.equals(token))
\r
941 aa.belowAlignment = true;
\r
947 void addAlignmentDetails(AlignmentI al, StringTokenizer st)
\r
949 String keyValue, key, value;
\r
950 while (st.hasMoreTokens())
\r
952 keyValue = st.nextToken();
\r
953 key = keyValue.substring(0, keyValue.indexOf("="));
\r
954 value = keyValue.substring(keyValue.indexOf("=") + 1);
\r
955 al.setProperty(key, value);
\r
960 * Write annotations as a CSV file of the form 'label, value, value, ...' for
\r
963 * @param annotations
\r
964 * @return CSV file as a string.
\r
966 public String printCSVAnnotations(AlignmentAnnotation[] annotations)
\r
968 StringBuffer sp = new StringBuffer();
\r
969 for (int i = 0; i < annotations.length; i++)
\r
971 String atos = annotations[i].toString();
\r
975 int cp = atos.indexOf("\n", p);
\r
976 sp.append(annotations[i].label);
\r
980 sp.append(atos.substring(p, cp + 1));
\r
984 sp.append(atos.substring(p));
\r
990 return sp.toString();
\r