import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.forester.archaeopteryx.Constants;
import org.forester.phylogeny.PhylogenyNode;
import org.forester.phylogeny.data.Distribution;
import org.forester.phylogeny.data.Sequence;
.compile( "(?:\\b|_)(?:sp|tr)[\\.|\\-_=/\\\\]([A-Z][0-9][A-Z0-9]{3}[0-9])(?:\\b|_)" );
public final static Pattern UNIPROT_KB_PATTERN_2 = Pattern
.compile( "\\b(?:[A-Z0-9]{2,5}|(?:[A-Z][0-9][A-Z0-9]{3}[0-9]))_(([A-Z9][A-Z]{2}[A-Z0-9]{2})|RAT|PIG|PEA)\\b" );
+ public static final String NCBI_GI = "http://www.ncbi.nlm.nih.gov/protein/gi:";
static {
final DecimalFormatSymbols dfs = new DecimalFormatSymbols();
dfs.setDecimalSeparator( '.' );
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() ) {
return isReadableFile( new File( s ) );
}
- public static boolean isWindowns() {
- return ForesterUtil.OS_NAME.toLowerCase().indexOf( "win" ) > -1;
+ public final static boolean isWindows() {
+ try {
+ return OS_NAME.toLowerCase().indexOf( "win" ) > -1;
+ }
+ catch ( final Exception e ) {
+ ForesterUtil.printWarningMessage( Constants.PRG_NAME, "minor error: " + e );
+ return false;
+ }
+ }
+
+ public final static boolean isMac() {
+ try {
+ return OS_NAME.toLowerCase().startsWith( "mac" );
+ }
+ catch ( final Exception e ) {
+ ForesterUtil.printWarningMessage( Constants.PRG_NAME, "minor error: " + e );
+ return false;
+ }
}
final public static String isWritableFile( final File f ) {