X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FStockholmFile.java;h=3a7a739858b90919e2690eddd3dd20def6bbe4d8;hb=797df64fa2a0a30773d0f48f5494d4155e5a8be3;hp=2e0fea70b8b375b2ae1c74651f012cba8c097ccb;hpb=323a457c9d0643be2406b6661246e8e988c0d0f6;p=jalview.git diff --git a/src/jalview/io/StockholmFile.java b/src/jalview/io/StockholmFile.java index 2e0fea7..3a7a739 100644 --- a/src/jalview/io/StockholmFile.java +++ b/src/jalview/io/StockholmFile.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6) - * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) + * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle * * This file is part of Jalview. * @@ -149,12 +149,16 @@ public class StockholmFile extends AlignFile int start = 1; int end = -1; String sid = acc; - // Retrieve hash of annotations for this accession + /* + * Retrieve hash of annotations for this accession + * Associate Annotation with accession + */ Hashtable accAnnotations = null; if (seqAnn != null && seqAnn.containsKey(acc)) { accAnnotations = (Hashtable) seqAnn.remove(acc); + //TODO: add structures to sequence } // Split accession in id and from/to @@ -184,7 +188,19 @@ public class StockholmFile extends AlignFile jalview.util.DBRefUtils.parseToDbRef(seqO, src, "0", acn); // seqO.addDBRef(dbref); } + } + if (accAnnotations != null && accAnnotations.containsKey("SS")) + { + Vector v = (Vector) accAnnotations.get("SS"); + + for (int i = 0; i < v.size(); i++) + { + AlignmentAnnotation an = (AlignmentAnnotation) v.elementAt(i); + seqO.addAlignmentAnnotation(an); + //annotations.add(an); + } } + Hashtable features = null; // We need to adjust the positions of all features to account for gaps try @@ -426,7 +442,7 @@ public class StockholmFile extends AlignFile ann = new Hashtable(); seqAnn.put(acc, ann); } - + //TODO test structure, call parseAnnotationRow with vector from hashtable for specific sequence Hashtable features; // Get an object with all the content for an annotation if (ann.containsKey("features")) @@ -461,6 +477,24 @@ public class StockholmFile extends AlignFile } ns += seq; content.put(description, ns); + + if(type.equals("SS")){ + Hashtable strucAnn; + if (seqAnn.containsKey(acc)) + { + strucAnn = (Hashtable) seqAnn.get(acc); + } + else + { + strucAnn = new Hashtable(); + } + + Vector newStruc=new Vector(); + parseAnnotationRow(newStruc, type,ns); + + strucAnn.put(type, newStruc); + seqAnn.put(acc, strucAnn); + } } else { @@ -566,6 +600,7 @@ public class StockholmFile extends AlignFile annot.annotations.length); System.arraycopy(els, 0, anns, annot.annotations.length, els.length); annot.annotations = anns; + //System.out.println("else: "); } return annot; }