@Override public PhylogenyData copy() { final Annotation ann = new Annotation( getRefSource(), getRefValue() ); if ( getConfidence() != null ) { ann.setConfidence( ( Confidence ) getConfidence().copy() ); } else { ann.setConfidence( null ); } ann.setType( getType() ); ann.setDesc( getDesc() ); ann.setEvidence( getEvidence() ); ann.setSource( new String( getSource() ) ); if ( getProperties() != null ) { ann.setProperties( ( PropertiesMap ) getProperties().copy() ); } else { ann.setProperties( null ); } if ( getUris() != null ) { ann.setUris( new ArrayList<Uri>() ); for( final Uri uri : getUris() ) { if ( uri != null ) { ann.getUris().add( uri ); } } } return ann; }
@Override public String toString() { return asText().toString(); }
@Override public void toPhyloXML( final Writer writer, final int level, final String indentation ) throws IOException { if ( ( getConfidence() != null ) || ( getProperties() != null ) || ( ( getUris() != null ) && !getUris().isEmpty() ) || !ForesterUtil.isEmpty( getDesc() ) ) { writer.write( ForesterUtil.LINE_SEPARATOR ); writer.write( indentation ); PhyloXmlMapping.ANNOTATION, PhyloXmlMapping.ANNOTATION_REF_ATTR, getRef(), PhyloXmlMapping.ANNOTATION_EVIDENCE_ATTR, getEvidence(), PhyloXmlMapping.ANNOTATION_TYPE_ATTR, getType(), PhyloXmlMapping.ANNOTATION_SOURCE_ATTR, getSource() ); if ( !ForesterUtil.isEmpty( getDesc() ) ) { PhylogenyDataUtil.appendElement( writer, PhyloXmlMapping.ANNOTATION_DESC, getDesc(), indentation ); if ( getConfidence() != null ) { getConfidence().toPhyloXML( writer, level, indentation + PhylogenyWriter.PHYLO_XML_INTENDATION_BASE ); if ( getProperties() != null ) { getProperties().toPhyloXML( writer, level, indentation ); if ( getUris() != null ) { for( final Uri uri : getUris() ) { if ( uri != null ) { uri.toPhyloXML( writer, level, indentation );
final Annotation annotation; if ( element.isHasAttribute( PhyloXmlMapping.ANNOTATION_REF_ATTR ) ) { annotation = new Annotation( element.getAttribute( PhyloXmlMapping.ANNOTATION_REF_ATTR ) ); annotation = new Annotation(); annotation.setType( element.getAttribute( PhyloXmlMapping.ANNOTATION_TYPE_ATTR ) ); annotation.setEvidence( element.getAttribute( PhyloXmlMapping.ANNOTATION_EVIDENCE_ATTR ) ); annotation.setSource( element.getAttribute( PhyloXmlMapping.ANNOTATION_SOURCE_ATTR ) ); annotation.setDesc( child_element.getValueAsString() ); annotation.setConfidence( ( Confidence ) ConfidenceParser.getInstance().parse( child_element ) ); annotation.addUri( ( Uri ) UriParser.getInstance().parse( child_element ) ); if ( annotation.getProperties() == null ) { annotation.setProperties( new PropertiesMap() ); annotation.getProperties() .addProperty( ( Property ) PropertyParser.getInstance().parse( child_element ) );
private static void addAnnotation( final DefaultMutableTreeNode top, final Annotation ann, final String name ) { DefaultMutableTreeNode category; category = new DefaultMutableTreeNode( name ); top.add( category ); addSubelement( category, "Source", ann.getSource() ); addSubelement( category, "Type", ann.getType() ); addSubelement( category, "Evidence", ann.getEvidence() ); if ( ann.getConfidence() != null ) { addSubelement( category, CONFIDENCE, ann.getConfidence().asText().toString() ); } if ( ann.getProperties() != null ) { addProperties( category, ann.getProperties(), PROP ); } }
for( final PhylogenyNode n : nodes ) { ForesterUtil.ensurePresenceOfSequence( n ); final Annotation ann = ForesterUtil.isEmpty( ref ) ? new Annotation() : new Annotation( ref ); if ( !ForesterUtil.isEmpty( desc ) ) { ann.setDesc( desc );
final static String createAnnotationString( final SortedSet<Annotation> annotations, final boolean show_ref_sources ) { final SortedMap<String, List<Annotation>> m = new TreeMap<String, List<Annotation>>(); for( final Annotation an : annotations ) { final String ref_source = ForesterUtil.isEmpty( an.getRefSource() ) ? "?" : an.getRefSource(); if ( !m.containsKey( ref_source ) ) { m.put( ref_source, new ArrayList<Annotation>() ); if ( !ForesterUtil.isEmpty( an.getRefValue() ) ) { sb.append( an.getRefValue() ); sb.append( " " ); if ( !ForesterUtil.isEmpty( an.getDesc() ) ) { sb.append( an.getDesc() );
final private Color calculateColorForAnnotation( final SortedSet<Annotation> ann ) { Color c = getTreeColorSet().getAnnotationColor(); if ( getControlPanel().isColorAccordingToAnnotation() && ( getControlPanel().getAnnotationColors() != null ) ) { final StringBuilder sb = new StringBuilder(); for( final Annotation a : ann ) { sb.append( !ForesterUtil.isEmpty( a.getRefValue() ) ? a.getRefValue() : a.getDesc() ); } final String ann_str = sb.toString(); if ( !ForesterUtil.isEmpty( ann_str ) ) { c = getControlPanel().getAnnotationColors().get( ann_str ); if ( c == null ) { c = AptxUtil.calculateColorFromString( ann_str, false ); getControlPanel().getAnnotationColors().put( ann_str, c ); } if ( c == null ) { c = getTreeColorSet().getAnnotationColor(); } } } return c; }
return false; if ( !entry.getAnnotations().first().getRefValue().equals( "3.2.1.33" ) ) { System.out.println( entry.getAnnotations().first().getRefValue() ); return false; if ( !entry.getAnnotations().first().getRefSource().equals( "EC" ) ) { System.out.println( entry.getAnnotations().first().getRefSource() ); return false;
final SortedSet<Annotation> a = n.getNodeData().getSequence().getAnnotations(); for( int i = 0; i < a.size(); ++i ) { data.add( n.getNodeData().getSequence().getAnnotation( i ).toString() ); for( int i = 0; i < a.size(); ++i ) { final Annotation ann = n.getNodeData().getSequence().getAnnotation( i ); final String ref = ann.getRef(); if ( ref.toUpperCase().startsWith( "GO:" ) ) { data.add( ref );
final Matcher ec = ec_PATTERN.matcher( line ); if ( ec.find() ) { e.addAnnotation( new Annotation( "EC", ec.group( 1 ) ) );
if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getDesc() .equals( "apoptosis" ) ) { return false; if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getRef() .equals( "GO:0006915" ) ) { return false; if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getSource() .equals( "UniProtKB" ) ) { return false; if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getEvidence() .equals( "experimental" ) ) { return false; if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getType() .equals( "function" ) ) { return false; if ( ( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getConfidence() .getValue() != 1 ) { return false; if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getConfidence() .getType().equals( "ml" ) ) { return false; if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getDesc()
@Override public StringBuffer asText() { final StringBuffer sb = new StringBuffer(); if ( !ForesterUtil.isEmpty( getDesc() ) && !ForesterUtil.isEmpty( getRef() ) ) { sb.append( getDesc() ); sb.append( " (" ); sb.append( getRef() ); sb.append( ")" ); } else if ( !ForesterUtil.isEmpty( getDesc() ) ) { sb.append( getDesc() ); } else if ( !ForesterUtil.isEmpty( getRef() ) ) { sb.append( getRef() ); } return sb; }
final Annotation ann = new Annotation(); ann.setDesc( new_values.get( TP_SEQ_ANNOTATION_DESC ) ); node.getNodeData().getSequence().addAnnotation( ann ); final Annotation ann = new Annotation( new_values.get( TP_SEQ_ANNOTATION_REF ) ); node.getNodeData().getSequence().addAnnotation( ann );
private static void processNode( final PhylogenyNode node, final BasicTable<String> t ) throws Exception { final String node_seq = node.getNodeData().getSequence().getMolecularSequence().toUpperCase(); boolean found = false; String found_row = ""; String found_protein_name = ""; String found_species = ""; for( int row = 0; row < t.getNumberOfRows(); ++row ) { final String table_seq = t.getValueAsString( SEQ_COLUMN, row ).toUpperCase(); if ( table_seq.contains( node_seq ) ) { if ( found ) { if ( !found_protein_name.equals( t.getValueAsString( SEQ_NAME_COLUMN, row ) ) || !found_species.equals( t.getValueAsString( SPECIES_COLUMN, row ) ) ) { throw new Exception( "Sequence from node " + node + " is not unique: " + node_seq + "\n" + "Already found in row " + found_row ); } } else { found = true; found_row = t.getRowAsString( row, ", " ); found_protein_name = t.getValueAsString( SEQ_NAME_COLUMN, row ); found_species = t.getValueAsString( SPECIES_COLUMN, row ); } final Annotation annotation = new Annotation( "target", t.getValueAsString( TARGET_COLUMN, row ) ); node.getNodeData().getSequence().addAnnotation( annotation ); System.out.println( node + "->" + annotation ); } } }
if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getDesc() .equals( "apoptosis" ) ) { return false; if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getRef() .equals( "GO:0006915" ) ) { return false; if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getSource() .equals( "UniProtKB" ) ) { return false; if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getEvidence() .equals( "experimental" ) ) { return false; if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getType() .equals( "function" ) ) { return false; if ( ( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getConfidence() .getValue() != 1 ) { return false; if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getConfidence() .getType().equals( "ml" ) ) { return false; if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getDesc()
&& ( node.getNodeData().getSequence().getAnnotations() != null ) ) { for( final Annotation ann : node.getNodeData().getSequence().getAnnotations() ) { if ( match( ann.getDesc(), query, case_sensitive, partial, false ) ) { match = true; break; if ( match( ann.getRef(), query, case_sensitive, partial, false ) ) { match = true; break;