+ public static String extractRefSeqAccessorAccessor( final PhylogenyNode node ) {
+ String v = null;
+ if ( node.getNodeData().isHasSequence() ) {
+ final Sequence seq = node.getNodeData().getSequence();
+ if ( !isEmpty( seq.getSymbol() ) ) {
+ v = SequenceIdParser.parseRefSeqAccessor( seq.getSymbol() );
+ }
+ if ( isEmpty( v ) && !isEmpty( seq.getName() ) ) {
+ v = SequenceIdParser.parseRefSeqAccessor( seq.getName() );
+ }
+ if ( isEmpty( v ) && ( node.getNodeData().getSequence().getAccession() != null )
+ && !isEmpty( seq.getAccession().getValue() ) ) {
+ v = SequenceIdParser.parseRefSeqAccessor( seq.getAccession().getValue() );
+ }
+ }
+ if ( isEmpty( v ) && !isEmpty( node.getName() ) ) {
+ v = SequenceIdParser.parseRefSeqAccessor( node.getName() );
+ }
+ return v;
+ }
+
+ public static String extractGenbankAccessor( final PhylogenyNode node ) {
+ String v = null;
+ if ( node.getNodeData().isHasSequence() ) {
+ final Sequence seq = node.getNodeData().getSequence();
+ if ( !isEmpty( seq.getSymbol() ) ) {
+ v = SequenceIdParser.parseGenbankAccessor( seq.getSymbol() );
+ }
+ if ( isEmpty( v ) && !isEmpty( seq.getName() ) ) {
+ v = SequenceIdParser.parseGenbankAccessor( seq.getName() );
+ }
+ if ( isEmpty( v ) && ( node.getNodeData().getSequence().getAccession() != null )
+ && !isEmpty( seq.getAccession().getValue() ) ) {
+ v = SequenceIdParser.parseGenbankAccessor( seq.getAccession().getValue() );
+ }
+ }
+ if ( isEmpty( v ) && !isEmpty( node.getName() ) ) {
+ v = SequenceIdParser.parseGenbankAccessor( node.getName() );
+ }
+ return v;
+ }
+
+ public static String extractGInumber( final PhylogenyNode node ) {
+ String v = null;
+ if ( node.getNodeData().isHasSequence() ) {
+ final Sequence seq = node.getNodeData().getSequence();
+ if ( isEmpty( v ) && !isEmpty( seq.getName() ) ) {
+ v = SequenceIdParser.parseGInumber( seq.getName() );
+ }
+ if ( isEmpty( v ) && ( node.getNodeData().getSequence().getAccession() != null )
+ && !isEmpty( seq.getAccession().getValue() ) ) {
+ v = SequenceIdParser.parseGInumber( seq.getAccession().getValue() );
+ }
+ }
+ if ( isEmpty( v ) && !isEmpty( node.getName() ) ) {
+ v = SequenceIdParser.parseGInumber( node.getName() );
+ }
+ return v;
+ }
+
+ public static String extractUniProtKbProteinSeqIdentifier( final PhylogenyNode node ) {
+ String upkb = null;
+ if ( node.getNodeData().isHasSequence() ) {
+ final Sequence seq = node.getNodeData().getSequence();
+ Matcher m;
+ if ( !isEmpty( seq.getSymbol() ) ) {
+ m = UNIPROT_KB_PATTERN_1.matcher( seq.getSymbol() );
+ if ( m.find() ) {
+ upkb = m.group( 1 );
+ }
+ else {
+ m = UNIPROT_KB_PATTERN_2.matcher( seq.getSymbol() );
+ if ( m.find() ) {
+ upkb = m.group();
+ }
+ }
+ }
+ if ( isEmpty( upkb ) && !isEmpty( seq.getName() ) ) {
+ m = UNIPROT_KB_PATTERN_1.matcher( seq.getName() );
+ if ( m.find() ) {
+ upkb = m.group( 1 );
+ }
+ else {
+ m = UNIPROT_KB_PATTERN_2.matcher( seq.getName() );
+ if ( m.find() ) {
+ upkb = m.group();
+ }
+ }
+ }
+ if ( isEmpty( upkb ) && ( node.getNodeData().getSequence().getAccession() != null )
+ && !isEmpty( seq.getAccession().getValue() ) ) {
+ m = UNIPROT_KB_PATTERN_1.matcher( seq.getAccession().getValue() );
+ if ( m.find() ) {
+ upkb = m.group( 1 );
+ }
+ else {
+ m = UNIPROT_KB_PATTERN_2.matcher( seq.getAccession().getValue() );
+ if ( m.find() ) {
+ upkb = m.group();
+ }
+ }
+ }
+ }
+ if ( isEmpty( upkb ) && !isEmpty( node.getName() ) ) {
+ final Matcher m1 = UNIPROT_KB_PATTERN_1.matcher( node.getName() );
+ if ( m1.find() ) {
+ upkb = m1.group( 1 );
+ }
+ else {
+ final Matcher m2 = UNIPROT_KB_PATTERN_2.matcher( node.getName() );
+ if ( m2.find() ) {
+ upkb = m2.group();
+ }
+ }
+ }
+ return upkb;
+ }
+