path = "C:\\Program Files\\mafft-win\\mafft.bat";
}
else {
- path = "/home/czmasek/bin/mafft";
- }
- if ( !MsaInferrer.isInstalled( path ) ) {
path = "mafft";
- }
- if ( !MsaInferrer.isInstalled( path ) ) {
- path = "/usr/local/bin/mafft";
+ if ( !MsaInferrer.isInstalled( path ) ) {
+ path = "/usr/bin/mafft";
+ }
+ if ( !MsaInferrer.isInstalled( path ) ) {
+ path = "/usr/local/bin/mafft";
+ }
}
if ( MsaInferrer.isInstalled( path ) ) {
System.out.print( "MAFFT (external program): " );
System.out.println( "failed." );
failed++;
}
+ System.out.print( "phyloXML parsing from URL: " );
+ if ( Test.testPhyloXMLparsingFromURL() ) {
+ System.out.println( "OK." );
+ succeeded++;
+ }
+ else {
+ System.out.println( "failed." );
+ failed++;
+ }
System.out.println();
final Runtime rt = java.lang.Runtime.getRuntime();
final long free_memory = rt.freeMemory() / 1000000;
return true;
}
+ public static final boolean testPhyloXMLparsingFromURL() {
+ try {
+ final String s = "https://sites.google.com/site/cmzmasek/home/software/archaeopteryx/examples/archaeopteryx_a/apaf_bcl2.xml";
+ final URL u = new URL( s );
+ final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
+ final Phylogeny[] phys = factory.create( u.openStream(), PhyloXmlParser.createPhyloXmlParser() );
+ if ( ( phys == null ) || ( phys.length != 2 ) ) {
+ 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";
final URL u = new URL( s );
final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
final Phylogeny[] phys = factory.create( u, new NHXParser() );
- if ( ( phys == null ) || ( phys.length != 1 ) ) {
+ if ( ( phys == null ) || ( phys.length != 5 ) ) {
return false;
}
- if ( !phys[ 0 ].toNewHampshire().equals( "((a,b),c);" ) ) {
+ 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 = factory.create( u.openStream(), new NHXParser() );
- if ( ( phys2 == null ) || ( phys2.length != 1 ) ) {
+ if ( ( phys2 == null ) || ( phys2.length != 5 ) ) {
return false;
}
- if ( !phys2[ 0 ].toNewHampshire().equals( "((a,b),c);" ) ) {
+ if ( !phys2[ 0 ].toNewHampshire().equals( "((((A,B),C),D),(E,F));" ) ) {
System.out.println( phys2[ 0 ].toNewHampshire() );
return false;
}
if ( !p.hasNext() ) {
return false;
}
- if ( !p.next().toNewHampshire().equals( "((a,b),c);" ) ) {
+ if ( !p.next().toNewHampshire().equals( "((((A,B),C),D),(E,F));" ) ) {
return false;
}
- if ( p.hasNext() ) {
- return false;
- }
- if ( p.next() != null ) {
- return false;
- }
- if ( p.hasNext() ) {
- return false;
- }
- if ( p.next() != null ) {
+ if ( !p.hasNext() ) {
return false;
}
p.reset();
if ( !p.hasNext() ) {
return false;
}
- if ( !p.next().toNewHampshire().equals( "((a,b),c);" ) ) {
- return false;
- }
- if ( p.hasNext() ) {
+ if ( !p.next().toNewHampshire().equals( "((((A,B),C),D),(E,F));" ) ) {
return false;
}
- if ( p.next() != null ) {
+ if ( !p.next().toNewHampshire().equals( "((1,2,3),(4,5,6),(7,8,9));" ) ) {
return false;
}
- if ( p.hasNext() ) {
+ p.reset();
+ if ( !p.hasNext() ) {
return false;
}
- if ( p.next() != null ) {
+ if ( !p.next().toNewHampshire().equals( "((((A,B),C),D),(E,F));" ) ) {
return false;
}
- p.reset();
- if ( !p.hasNext() ) {
+ if ( !p.next().toNewHampshire().equals( "((1,2,3),(4,5,6),(7,8,9));" ) ) {
return false;
}
}
private static boolean testMsaQualityMethod() {
try {
- final Sequence s0 = BasicSequence.createAaSequence( "a", "ABAXEFGHIJ" );
- final Sequence s1 = BasicSequence.createAaSequence( "b", "ABBXEFGHIJ" );
- final Sequence s2 = BasicSequence.createAaSequence( "c", "AXCXEFGHIJ" );
- final Sequence s3 = BasicSequence.createAaSequence( "d", "AXDDEFGHIJ" );
+ final Sequence s0 = BasicSequence.createAaSequence( "a", "ABAXEFGHIJJE-" );
+ final Sequence s1 = BasicSequence.createAaSequence( "b", "ABBXEFGHIJJBB" );
+ final Sequence s2 = BasicSequence.createAaSequence( "c", "AXCXEFGHIJJ--" );
+ final Sequence s3 = BasicSequence.createAaSequence( "d", "AXDDEFGHIJ---" );
final List<Sequence> l = new ArrayList<Sequence>();
l.add( s0 );
l.add( s1 );
if ( !isEqual( 0.75, MsaMethods.calculateIdentityRatio( msa, 3 ) ) ) {
return false;
}
+ if ( !isEqual( 0.75, MsaMethods.calculateIdentityRatio( msa, 10 ) ) ) {
+ return false;
+ }
+ if ( !isEqual( 0.25, MsaMethods.calculateIdentityRatio( msa, 11 ) ) ) {
+ return false;
+ }
+ if ( !isEqual( 0.25, MsaMethods.calculateIdentityRatio( msa, 12 ) ) ) {
+ return false;
+ }
}
catch ( final Exception e ) {
e.printStackTrace( System.out );