X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Ftest%2FTest.java;h=22253df3afaa76cae7255bef54be95b88cff6e4f;hb=e6ea1a1dcb0a9b96cad1bc08c3b80a6f876344d2;hp=5ff446f2452baec80b9a46ee6a22ba3323e7b850;hpb=3e0de286efdce95f266e91b2ef5f974041156b19;p=jalview.git diff --git a/forester/java/src/org/forester/test/Test.java b/forester/java/src/org/forester/test/Test.java index 5ff446f..22253df 100644 --- a/forester/java/src/org/forester/test/Test.java +++ b/forester/java/src/org/forester/test/Test.java @@ -2,8 +2,8 @@ // FORESTER -- software libraries and applications // for evolutionary biology research and applications. // -// Copyright (C) 2008-2009 Christian M. Zmasek -// Copyright (C) 2008-2009 Burnham Institute for Medical Research +// Copyright (C) 2014 Christian M. Zmasek +// Copyright (C) 2014 Sanford-Burnham Medical Research Institute // All rights reserved // // This library is free software; you can redistribute it and/or @@ -20,7 +20,6 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA // -// Contact: phylosoft @ gmail . com // WWW: https://sites.google.com/site/cmzmasek/home/software/forester package org.forester.test; @@ -29,6 +28,8 @@ import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; +import java.io.StringWriter; +import java.io.Writer; import java.net.URL; import java.util.ArrayList; import java.util.Date; @@ -40,6 +41,7 @@ import java.util.Set; import java.util.SortedSet; import org.forester.application.support_transfer; +import org.forester.archaeopteryx.AptxUtil; import org.forester.archaeopteryx.TreePanelUtil; import org.forester.archaeopteryx.webservices.WebserviceUtil; import org.forester.development.DevelopmentTools; @@ -62,8 +64,10 @@ import org.forester.io.parsers.util.ParserUtils; import org.forester.io.writers.PhylogenyWriter; import org.forester.io.writers.SequenceWriter; import org.forester.msa.BasicMsa; +import org.forester.msa.DeleteableMsa; import org.forester.msa.Mafft; import org.forester.msa.Msa; +import org.forester.msa.Msa.MSA_FORMAT; import org.forester.msa.MsaInferrer; import org.forester.msa.MsaMethods; import org.forester.pccx.TestPccx; @@ -177,6 +181,15 @@ public final class Test { System.exit( -1 ); } final long start_time = new Date().getTime(); + System.out.print( "MSA entropy: " ); + if ( Test.testMsaEntropy() ) { + System.out.println( "OK." ); + succeeded++; + } + else { + System.out.println( "failed." ); + failed++; + } System.out.print( "Basic node methods: " ); if ( Test.testBasicNodeMethods() ) { System.out.println( "OK." ); @@ -900,6 +913,15 @@ public final class Test { System.out.println( "failed." ); failed++; } + System.out.print( "Deleteable MSA: " ); + if ( Test.testDeleteableMsa() ) { + System.out.println( "OK." ); + succeeded++; + } + else { + System.out.println( "failed." ); + failed++; + } if ( PERFORM_DB_TESTS ) { System.out.print( "Uniprot Entry Retrieval: " ); if ( Test.testUniprotEntryRetrieval() ) { @@ -949,6 +971,15 @@ public final class Test { System.out.println( "failed." ); failed++; } + System.out.print( "NHX parsing from URL 2: " ); + if ( Test.testNHXparsingFromURL2() ) { + System.out.println( "OK." ); + succeeded++; + } + else { + System.out.println( "failed." ); + failed++; + } System.out.print( "phyloXML parsing from URL: " ); if ( Test.testPhyloXMLparsingFromURL() ) { System.out.println( "OK." ); @@ -1116,6 +1147,72 @@ public final class Test { return true; } + public static final boolean testNHXparsingFromURL2() { + try { + final String s = "https://sites.google.com/site/cmzmasek/home/software/archaeopteryx/examples/simple/simple_1.nh"; + final Phylogeny phys[] = AptxUtil.readPhylogeniesFromUrl( new URL( s ), + false, + false, + false, + TAXONOMY_EXTRACTION.NO, + false ); + if ( ( phys == null ) || ( phys.length != 5 ) ) { + return false; + } + if ( !phys[ 0 ].toNewHampshire().equals( "((((A,B),C),D),(E,F));" ) ) { + System.out.println( phys[ 0 ].toNewHampshire() ); + return false; + } + if ( !phys[ 1 ].toNewHampshire().equals( "((1,2,3),(4,5,6),(7,8,9));" ) ) { + System.out.println( phys[ 1 ].toNewHampshire() ); + return false; + } + final Phylogeny phys2[] = AptxUtil.readPhylogeniesFromUrl( new URL( s ), + false, + false, + false, + TAXONOMY_EXTRACTION.NO, + false ); + if ( ( phys2 == null ) || ( phys2.length != 5 ) ) { + return false; + } + if ( !phys2[ 0 ].toNewHampshire().equals( "((((A,B),C),D),(E,F));" ) ) { + System.out.println( phys2[ 0 ].toNewHampshire() ); + return false; + } + if ( !phys2[ 1 ].toNewHampshire().equals( "((1,2,3),(4,5,6),(7,8,9));" ) ) { + System.out.println( phys2[ 1 ].toNewHampshire() ); + return false; + } + final Phylogeny phys3[] = AptxUtil.readPhylogeniesFromUrl( new URL( "http://swisstree.vital-it.ch:80/" + + "SwissTree/ST001/consensus_tree.nhx" ), false, false, false, TAXONOMY_EXTRACTION.NO, false ); + if ( ( phys3 == null ) || ( phys3.length != 1 ) ) { + return false; + } + if ( !phys3[ 0 ] + .toNewHampshire() + .equals( "((((POP23a_CIOIN_ENSCING00000016202,POP23b_CIOIN_ENSCING00000016169),POP23_CIOSA_ENSCSAVG00000000248),((POP23a_BRAFL_C3ZMF1,POP23b_BRAFL_121417),(((POP3_ORYLA_ENSORLG00000019669,POP3_GASAC_ENSGACG00000014023,POP3_DANRE_Q6JWW1),(POP3_XENTR_B1H1F6,(POP3_CHICK_Q9DG25,(POP3_ORNAN_ENSOANG00000004179,POP3_MONDO_ENSMODG00000018033,((POP3_MOUSE_Q9ES81,POP3_RAT_Q3BCU3),POP3_RABIT_ENSOCUG00000025973,POP3_MACMU_ENSMMUG00000014473,POP3_HUMAN_Q9HBV1))))),(((POP2_GASAC_ENSGACG00000001420,POP2_ORYLA_ENSORLG00000008627,POP2_TAKRU_ENSTRUG00000015933),POP2_DANRE_ENSDARG00000069922),POP2_XENTR_ENSXETG00000018064,(((POP2_TAEGU_ENSTGUG00000013383,POP2_CHICK_Q6T9Z5),POP2_ANOCA_ENSACAG00000003557),((POP2_MACEU_ENSMEUG00000015825,POP2_MONDO_ENSMODG00000018205),((POP2_RABIT_ENSOCUG00000009515,(POP2_RAT_Q6P722,POP2_MOUSE_Q9ES82)),(POP2_MACMU_ENSMMUG00000000905,POP2_HUMAN_Q9HBU9)))))))),((POP1_CIOSA_ENSCSAVG00000000247,POP1_CIOIN_ENSCING00000000496),((POP1_DANRE_Q5PQZ7,(POP1_ORYLA_ENSORLG00000019663,POP1_GASAC_ENSGACG00000014015,POP1_TAKRU_ENSORLG00000019663)),(POP1_XENTR_B1H1G2,(POP1_ANOCA_ENSACAG00000003910,(POP1_TAEGU_ENSTGUG00000012218,POP1_CHICK_Q9DG23)),POP1_ORNAN_ENSOANG00000004180,POP1_MONDO_ENSMODG00000018034,(POP1_RABIT_ENSOCUG00000016944,(POP1_RAT_Q3BCU4,POP1_MOUSE_Q9ES83),(POP1_HUMAN_Q8NE79,POP1_MACMU_ENSMMUG00000014471))))));" ) ) { + System.out.println( phys3[ 0 ].toNewHampshire() ); + return false; + } + final Phylogeny phys4[] = AptxUtil.readPhylogeniesFromUrl( new URL( "http://swisstree.vital-it.ch:80/" + + "SwissTree/ST001/consensus_tree.nhx" ), false, false, false, TAXONOMY_EXTRACTION.NO, false ); + if ( ( phys4 == null ) || ( phys4.length != 1 ) ) { + return false; + } + if ( !phys4[ 0 ] + .toNewHampshire() + .equals( "((((POP23a_CIOIN_ENSCING00000016202,POP23b_CIOIN_ENSCING00000016169),POP23_CIOSA_ENSCSAVG00000000248),((POP23a_BRAFL_C3ZMF1,POP23b_BRAFL_121417),(((POP3_ORYLA_ENSORLG00000019669,POP3_GASAC_ENSGACG00000014023,POP3_DANRE_Q6JWW1),(POP3_XENTR_B1H1F6,(POP3_CHICK_Q9DG25,(POP3_ORNAN_ENSOANG00000004179,POP3_MONDO_ENSMODG00000018033,((POP3_MOUSE_Q9ES81,POP3_RAT_Q3BCU3),POP3_RABIT_ENSOCUG00000025973,POP3_MACMU_ENSMMUG00000014473,POP3_HUMAN_Q9HBV1))))),(((POP2_GASAC_ENSGACG00000001420,POP2_ORYLA_ENSORLG00000008627,POP2_TAKRU_ENSTRUG00000015933),POP2_DANRE_ENSDARG00000069922),POP2_XENTR_ENSXETG00000018064,(((POP2_TAEGU_ENSTGUG00000013383,POP2_CHICK_Q6T9Z5),POP2_ANOCA_ENSACAG00000003557),((POP2_MACEU_ENSMEUG00000015825,POP2_MONDO_ENSMODG00000018205),((POP2_RABIT_ENSOCUG00000009515,(POP2_RAT_Q6P722,POP2_MOUSE_Q9ES82)),(POP2_MACMU_ENSMMUG00000000905,POP2_HUMAN_Q9HBU9)))))))),((POP1_CIOSA_ENSCSAVG00000000247,POP1_CIOIN_ENSCING00000000496),((POP1_DANRE_Q5PQZ7,(POP1_ORYLA_ENSORLG00000019663,POP1_GASAC_ENSGACG00000014015,POP1_TAKRU_ENSORLG00000019663)),(POP1_XENTR_B1H1G2,(POP1_ANOCA_ENSACAG00000003910,(POP1_TAEGU_ENSTGUG00000012218,POP1_CHICK_Q9DG23)),POP1_ORNAN_ENSOANG00000004180,POP1_MONDO_ENSMODG00000018034,(POP1_RABIT_ENSOCUG00000016944,(POP1_RAT_Q3BCU4,POP1_MOUSE_Q9ES83),(POP1_HUMAN_Q8NE79,POP1_MACMU_ENSMMUG00000014471))))));" ) ) { + System.out.println( phys4[ 0 ].toNewHampshire() ); + return false; + } + } + catch ( final Exception e ) { + e.printStackTrace(); + } + return true; + } + public static final boolean testNHXparsingFromURL() { try { final String s = "https://sites.google.com/site/cmzmasek/home/software/archaeopteryx/examples/simple/simple_1.nh"; @@ -6076,6 +6173,228 @@ public final class Test { return true; } + private static boolean testMsaEntropy() { + try { + final Sequence s0 = BasicSequence.createAaSequence( "a", "AAAAAAA" ); + final Sequence s1 = BasicSequence.createAaSequence( "b", "AAAIACC" ); + final Sequence s2 = BasicSequence.createAaSequence( "c", "AAIIIIF" ); + final Sequence s3 = BasicSequence.createAaSequence( "d", "AIIIVVW" ); + final List l = new ArrayList(); + l.add( s0 ); + l.add( s1 ); + l.add( s2 ); + l.add( s3 ); + final Msa msa = BasicMsa.createInstance( l ); + System.out.println( MsaMethods.calcNormalizedShannonsEntropy( 20, msa, 0 ) ); + System.out.println( MsaMethods.calcNormalizedShannonsEntropy( 20, msa, 1 ) ); + System.out.println( MsaMethods.calcNormalizedShannonsEntropy( 20, msa, 2 ) ); + System.out.println( MsaMethods.calcNormalizedShannonsEntropy( 20, msa, 3 ) ); + System.out.println( MsaMethods.calcNormalizedShannonsEntropy( 20, msa, 4 ) ); + System.out.println( MsaMethods.calcNormalizedShannonsEntropy( 20, msa, 5 ) ); + System.out.println( MsaMethods.calcNormalizedShannonsEntropy( 20, msa, 6 ) ); + System.out.println(); + System.out.println( MsaMethods.calcNormalizedShannonsEntropy( 6, msa, 0 ) ); + System.out.println( MsaMethods.calcNormalizedShannonsEntropy( 6, msa, 1 ) ); + System.out.println( MsaMethods.calcNormalizedShannonsEntropy( 6, msa, 2 ) ); + System.out.println( MsaMethods.calcNormalizedShannonsEntropy( 6, msa, 3 ) ); + System.out.println( MsaMethods.calcNormalizedShannonsEntropy( 6, msa, 4 ) ); + System.out.println( MsaMethods.calcNormalizedShannonsEntropy( 6, msa, 5 ) ); + System.out.println( MsaMethods.calcNormalizedShannonsEntropy( 6, msa, 6 ) ); + final List l2 = new ArrayList(); + l2.add( BasicSequence.createAaSequence( "1", "AAAAAAA" ) ); + l2.add( BasicSequence.createAaSequence( "2", "AAAIACC" ) ); + l2.add( BasicSequence.createAaSequence( "3", "AAIIIIF" ) ); + l2.add( BasicSequence.createAaSequence( "4", "AIIIVVW" ) ); + l2.add( BasicSequence.createAaSequence( "5", "AAAAAAA" ) ); + l2.add( BasicSequence.createAaSequence( "6", "AAAIACC" ) ); + l2.add( BasicSequence.createAaSequence( "7", "AAIIIIF" ) ); + l2.add( BasicSequence.createAaSequence( "8", "AIIIVVW" ) ); + l2.add( BasicSequence.createAaSequence( "9", "AAAAAAA" ) ); + l2.add( BasicSequence.createAaSequence( "10", "AAAIACC" ) ); + l2.add( BasicSequence.createAaSequence( "11", "AAIIIIF" ) ); + l2.add( BasicSequence.createAaSequence( "12", "AIIIVVW" ) ); + l2.add( BasicSequence.createAaSequence( "13", "AAIIIIF" ) ); + l2.add( BasicSequence.createAaSequence( "14", "AIIIVVW" ) ); + l2.add( BasicSequence.createAaSequence( "15", "AAAAAAA" ) ); + l2.add( BasicSequence.createAaSequence( "16", "AAAIACC" ) ); + l2.add( BasicSequence.createAaSequence( "17", "AAIIIIF" ) ); + l2.add( BasicSequence.createAaSequence( "18", "AIIIVVW" ) ); + l2.add( BasicSequence.createAaSequence( "19", "AAAAAAA" ) ); + l2.add( BasicSequence.createAaSequence( "20", "AAAIACC" ) ); + l2.add( BasicSequence.createAaSequence( "21", "AAIIIIF" ) ); + l2.add( BasicSequence.createAaSequence( "22", "AIIIVVW" ) ); + final Msa msa2 = BasicMsa.createInstance( l2 ); + System.out.println(); + System.out.println( MsaMethods.calcNormalizedShannonsEntropy( 20, msa2, 0 ) ); + System.out.println( MsaMethods.calcNormalizedShannonsEntropy( 20, msa2, 1 ) ); + System.out.println( MsaMethods.calcNormalizedShannonsEntropy( 20, msa2, 2 ) ); + } + catch ( final Exception e ) { + e.printStackTrace( System.out ); + return false; + } + return true; + } + + private static boolean testDeleteableMsa() { + try { + final Sequence s0 = BasicSequence.createAaSequence( "a", "AAAA" ); + final Sequence s1 = BasicSequence.createAaSequence( "b", "BAAA" ); + final Sequence s2 = BasicSequence.createAaSequence( "c", "CAAA" ); + final Sequence s3 = BasicSequence.createAaSequence( "d", "DAAA" ); + final Sequence s4 = BasicSequence.createAaSequence( "e", "EAAA" ); + final Sequence s5 = BasicSequence.createAaSequence( "f", "FAAA" ); + final List l0 = new ArrayList(); + l0.add( s0 ); + l0.add( s1 ); + l0.add( s2 ); + l0.add( s3 ); + l0.add( s4 ); + l0.add( s5 ); + final DeleteableMsa dmsa0 = DeleteableMsa.createInstance( l0 ); + dmsa0.deleteRow( "b", false ); + if ( !dmsa0.getIdentifier( 1 ).equals( "c" ) ) { + return false; + } + dmsa0.deleteRow( "e", false ); + dmsa0.deleteRow( "a", false ); + dmsa0.deleteRow( "f", false ); + if ( dmsa0.getLength() != 4 ) { + return false; + } + if ( dmsa0.getNumberOfSequences() != 2 ) { + return false; + } + if ( !dmsa0.getIdentifier( 0 ).equals( "c" ) ) { + return false; + } + if ( !dmsa0.getIdentifier( 1 ).equals( "d" ) ) { + return false; + } + if ( dmsa0.getResidueAt( 0, 0 ) != 'C' ) { + return false; + } + if ( !dmsa0.getSequenceAsString( 0 ).toString().equals( "CAAA" ) ) { + return false; + } + if ( dmsa0.getColumnAt( 0 ).size() != 2 ) { + return false; + } + dmsa0.deleteRow( "c", false ); + dmsa0.deleteRow( "d", false ); + if ( dmsa0.getNumberOfSequences() != 0 ) { + return false; + } + // + final Sequence s_0 = BasicSequence.createAaSequence( "a", "--A---B-C--X----" ); + final Sequence s_1 = BasicSequence.createAaSequence( "b", "--B-----C-------" ); + final Sequence s_2 = BasicSequence.createAaSequence( "c", "--C--AB-C------Z" ); + final Sequence s_3 = BasicSequence.createAaSequence( "d", "--D--AA-C-------" ); + final Sequence s_4 = BasicSequence.createAaSequence( "e", "--E--AA-C-------" ); + final Sequence s_5 = BasicSequence.createAaSequence( "f", "--F--AB-CD--Y---" ); + final List l1 = new ArrayList(); + l1.add( s_0 ); + l1.add( s_1 ); + l1.add( s_2 ); + l1.add( s_3 ); + l1.add( s_4 ); + l1.add( s_5 ); + final DeleteableMsa dmsa1 = DeleteableMsa.createInstance( l1 ); + dmsa1.deleteGapOnlyColumns(); + dmsa1.deleteRow( "a", false ); + dmsa1.deleteRow( "f", false ); + dmsa1.deleteRow( "d", false ); + dmsa1.deleteGapOnlyColumns(); + if ( !dmsa1.getSequenceAsString( 0 ).toString().equals( "B--C-" ) ) { + return false; + } + if ( !dmsa1.getSequenceAsString( 1 ).toString().equals( "CABCZ" ) ) { + return false; + } + if ( !dmsa1.getSequenceAsString( 2 ).toString().equals( "EAAC-" ) ) { + return false; + } + dmsa1.deleteRow( "c", false ); + dmsa1.deleteGapOnlyColumns(); + final Writer w0 = new StringWriter(); + dmsa1.write( w0, MSA_FORMAT.FASTA ); + final Writer w1 = new StringWriter(); + dmsa1.write( w1, MSA_FORMAT.PHYLIP ); + if ( !dmsa1.getSequenceAsString( 0 ).toString().equals( "B--C" ) ) { + return false; + } + if ( !dmsa1.getSequenceAsString( 1 ).toString().equals( "EAAC" ) ) { + return false; + } + // + final Sequence s__0 = BasicSequence.createAaSequence( "a", "A------" ); + final Sequence s__1 = BasicSequence.createAaSequence( "b", "BB-----" ); + final Sequence s__2 = BasicSequence.createAaSequence( "c", "CCC----" ); + final Sequence s__3 = BasicSequence.createAaSequence( "d", "DDDD---" ); + final Sequence s__4 = BasicSequence.createAaSequence( "e", "EEEEE--" ); + final Sequence s__5 = BasicSequence.createAaSequence( "f", "FFFFFF-" ); + final List l2 = new ArrayList(); + l2.add( s__0 ); + l2.add( s__1 ); + l2.add( s__2 ); + l2.add( s__3 ); + l2.add( s__4 ); + l2.add( s__5 ); + final DeleteableMsa dmsa2 = DeleteableMsa.createInstance( l2 ); + dmsa2.deleteGapColumns( 0.5 ); + if ( !dmsa2.getSequenceAsString( 0 ).toString().equals( "A---" ) ) { + return false; + } + if ( !dmsa2.getSequenceAsString( 1 ).toString().equals( "BB--" ) ) { + return false; + } + if ( !dmsa2.getSequenceAsString( 2 ).toString().equals( "CCC-" ) ) { + return false; + } + dmsa2.deleteGapColumns( 0.2 ); + if ( !dmsa2.getSequenceAsString( 0 ).toString().equals( "A-" ) ) { + return false; + } + if ( !dmsa2.getSequenceAsString( 1 ).toString().equals( "BB" ) ) { + return false; + } + if ( !dmsa2.getSequenceAsString( 2 ).toString().equals( "CC" ) ) { + return false; + } + dmsa2.deleteGapColumns( 0 ); + dmsa2.deleteRow( "a", false ); + dmsa2.deleteRow( "b", false ); + dmsa2.deleteRow( "f", false ); + dmsa2.deleteRow( "e", false ); + dmsa2.setIdentifier( 0, "new_c" ); + dmsa2.setIdentifier( 1, "new_d" ); + dmsa2.setResidueAt( 0, 0, 'x' ); + final Sequence s = dmsa2.deleteRow( "new_d", true ); + if ( !s.getMolecularSequenceAsString().equals( "D" ) ) { + return false; + } + final Writer w = new StringWriter(); + dmsa2.write( w, MSA_FORMAT.PHYLIP ); + final String phylip = w.toString(); + if ( !phylip.equals( "1 1" + ForesterUtil.LINE_SEPARATOR + "new_c x" + ForesterUtil.LINE_SEPARATOR ) ) { + System.out.println( phylip ); + return false; + } + final Writer w2 = new StringWriter(); + dmsa2.write( w2, MSA_FORMAT.FASTA ); + final String fasta = w2.toString(); + if ( !fasta.equals( ">new_c" + ForesterUtil.LINE_SEPARATOR + "x" + ForesterUtil.LINE_SEPARATOR ) ) { + System.out.println( fasta ); + return false; + } + } + catch ( final Exception e ) { + e.printStackTrace( System.out ); + return false; + } + return true; + } + private static boolean testNextNodeWithCollapsing() { try { final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance(); @@ -11005,7 +11324,6 @@ public final class Test { } return false; } - // id = SequenceAccessionTools.parseAccessorFromString( "segmented worms|gb_ADF31344" ); if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getSource() ) || !id.getValue().equals( "ADF31344" ) || !id.getSource().equals( "ncbi" ) ) { @@ -11015,7 +11333,6 @@ public final class Test { } return false; } - // id = SequenceAccessionTools.parseAccessorFromString( "segmented worms gb_ADF31344 and more" ); if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getSource() ) || !id.getValue().equals( "ADF31344" ) || !id.getSource().equals( "ncbi" ) ) { @@ -11025,7 +11342,6 @@ public final class Test { } return false; } - // id = SequenceAccessionTools.parseAccessorFromString( "gb_AAA96518_1" ); if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getSource() ) || !id.getValue().equals( "AAA96518" ) || !id.getSource().equals( "ncbi" ) ) { @@ -11035,7 +11351,6 @@ public final class Test { } return false; } - // id = SequenceAccessionTools.parseAccessorFromString( "gb_EHB07727_1_rodents_" ); if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getSource() ) || !id.getValue().equals( "EHB07727" ) || !id.getSource().equals( "ncbi" ) ) { @@ -11045,7 +11360,6 @@ public final class Test { } return false; } - // id = SequenceAccessionTools.parseAccessorFromString( "dbj_BAF37827_1_turtles_" ); if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getSource() ) || !id.getValue().equals( "BAF37827" ) || !id.getSource().equals( "ncbi" ) ) { @@ -11055,7 +11369,6 @@ public final class Test { } return false; } - // id = SequenceAccessionTools.parseAccessorFromString( "emb_CAA73223_1_primates_" ); if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getSource() ) || !id.getValue().equals( "CAA73223" ) || !id.getSource().equals( "ncbi" ) ) { @@ -11065,7 +11378,6 @@ public final class Test { } return false; } - // id = SequenceAccessionTools.parseAccessorFromString( "mites|ref_XP_002434188_1" ); if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getSource() ) || !id.getValue().equals( "XP_002434188" ) || !id.getSource().equals( "refseq" ) ) { @@ -11075,7 +11387,6 @@ public final class Test { } return false; } - // id = SequenceAccessionTools.parseAccessorFromString( "mites_ref_XP_002434188_1_bla_XP_12345" ); if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getSource() ) || !id.getValue().equals( "XP_002434188" ) || !id.getSource().equals( "refseq" ) ) { @@ -11085,7 +11396,6 @@ public final class Test { } return false; } - // id = SequenceAccessionTools.parseAccessorFromString( "P4A123" ); if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getSource() ) || !id.getValue().equals( "P4A123" ) || !id.getSource().equals( "uniprot" ) ) { @@ -11101,6 +11411,40 @@ public final class Test { System.out.println( "provider=" + id.getSource() ); return false; } + // + id = SequenceAccessionTools.parseAccessorFromString( "N3B004Z009" ); + if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getSource() ) + || !id.getValue().equals( "N3B004Z009" ) || !id.getSource().equals( "uniprot" ) ) { + if ( id != null ) { + System.out.println( "value =" + id.getValue() ); + System.out.println( "provider=" + id.getSource() ); + } + return false; + } + id = SequenceAccessionTools.parseAccessorFromString( "A4CAA4ZBB9" ); + if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getSource() ) + || !id.getValue().equals( "A4CAA4ZBB9" ) || !id.getSource().equals( "uniprot" ) ) { + if ( id != null ) { + System.out.println( "value =" + id.getValue() ); + System.out.println( "provider=" + id.getSource() ); + } + return false; + } + id = SequenceAccessionTools.parseAccessorFromString( "ecoli_A4CAA4ZBB9_rt" ); + if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getSource() ) + || !id.getValue().equals( "A4CAA4ZBB9" ) || !id.getSource().equals( "uniprot" ) ) { + if ( id != null ) { + System.out.println( "value =" + id.getValue() ); + System.out.println( "provider=" + id.getSource() ); + } + return false; + } + id = SequenceAccessionTools.parseAccessorFromString( "Q4CAA4ZBB9" ); + if ( id != null ) { + System.out.println( "value =" + id.getValue() ); + System.out.println( "provider=" + id.getSource() ); + return false; + } } catch ( final Exception e ) { e.printStackTrace( System.out );