public final static boolean ALLOW_DDBJ_BLAST = false;
public final static String PRG_NAME = "Archaeopteryx";
final static String VERSION = "0.974";
- final static String PRG_DATE = "121003";
+ final static String PRG_DATE = "121005";
final static String DEFAULT_CONFIGURATION_FILE_NAME = "_aptx_configuration_file";
final static String[] DEFAULT_FONT_CHOICES = { "Verdana", "Tahoma",
"Arial", "Helvetica", "Dialog", "Lucida Sans", "SansSerif", "Sans-serif", "Sans" };
JOptionPane.WARNING_MESSAGE );
return;
}
- if ( node.getNodeData().isHasSequence() ) {
+ if ( node.getNodeData().isHasSequence() || !ForesterUtil.isEmpty( node.getName() ) ) {
final String query = Blast.obtainQueryForBlast( node );
+ System.out.println( "query for BLAST is: " + query );
boolean nucleotide = false;
- if ( !ForesterUtil.isEmpty( node.getNodeData().getSequence().getType() ) ) {
- if ( !node.getNodeData().getSequence().getType().toLowerCase().equals( PhyloXmlUtil.SEQ_TYPE_PROTEIN ) ) {
- nucleotide = true;
- }
- }
- else if ( !ForesterUtil.isEmpty( node.getNodeData().getSequence().getMolecularSequence() ) ) {
- nucleotide = !ForesterUtil.seqIsLikelyToBeAa( node.getNodeData().getSequence().getMolecularSequence() );
- }
if ( !ForesterUtil.isEmpty( query ) ) {
+ if ( node.getNodeData().isHasSequence() ) {
+ if ( !ForesterUtil.isEmpty( node.getNodeData().getSequence().getType() ) ) {
+ if ( !node.getNodeData().getSequence().getType().toLowerCase()
+ .equals( PhyloXmlUtil.SEQ_TYPE_PROTEIN ) ) {
+ nucleotide = true;
+ }
+ }
+ else if ( !ForesterUtil.isEmpty( node.getNodeData().getSequence().getMolecularSequence() ) ) {
+ nucleotide = !ForesterUtil.seqIsLikelyToBeAa( node.getNodeData().getSequence()
+ .getMolecularSequence() );
+ }
+ }
JApplet applet = null;
if ( isApplet() ) {
applet = obtainApplet();
}
final private boolean isCanBlast( final PhylogenyNode node ) {
- return ( node.getNodeData().isHasSequence()
- && ( ( ( node.getNodeData().getSequence().getAccession() != null ) && !ForesterUtil.isEmpty( node
- .getNodeData().getSequence().getAccession().getValue() ) )
- || !ForesterUtil.isEmpty( node.getNodeData().getSequence().getName() ) || !ForesterUtil
- .isEmpty( node.getNodeData().getSequence().getMolecularSequence() ) ) && Blast
- .isContainsQueryForBlast( node ) );
+ return ( ( node.getNodeData().isHasSequence() && ( ( ( node.getNodeData().getSequence().getAccession() != null ) && !ForesterUtil
+ .isEmpty( node.getNodeData().getSequence().getAccession().getValue() ) )
+ || !ForesterUtil.isEmpty( node.getNodeData().getSequence().getName() ) || !ForesterUtil.isEmpty( node
+ .getNodeData().getSequence().getMolecularSequence() ) ) ) || ( ( !ForesterUtil.isEmpty( node.getName() ) ) && Blast
+ .isContainsQueryForBlast( node ) ) );
}
final boolean isCanCollapse() {
import org.forester.archaeopteryx.TreePanel;
import org.forester.phylogeny.PhylogenyNode;
import org.forester.phylogeny.data.Accession;
+import org.forester.phylogeny.data.Identifier;
import org.forester.util.ForesterUtil;
+import org.forester.util.SequenceIdParser;
import org.forester.ws.wabi.RestUtil;
public final class Blast {
final public static String obtainQueryForBlast( final PhylogenyNode node ) {
String query = "";
- if ( !ForesterUtil.isEmpty( node.getNodeData().getSequence().getMolecularSequence() ) ) {
- query = node.getNodeData().getSequence().getMolecularSequence();
- }
- else if ( ( node.getNodeData().getSequence().getAccession() != null )
- && !ForesterUtil.isEmpty( node.getNodeData().getSequence().getAccession().getValue() ) ) {
- if ( !ForesterUtil.isEmpty( node.getNodeData().getSequence().getAccession().getSource() ) ) {
- query = node.getNodeData().getSequence().getAccession().getSource() + "%7C";
+ if ( node.getNodeData().isHasSequence() ) {
+ if ( !ForesterUtil.isEmpty( node.getNodeData().getSequence().getMolecularSequence() ) ) {
+ query = node.getNodeData().getSequence().getMolecularSequence();
+ }
+ else if ( ( node.getNodeData().getSequence().getAccession() != null )
+ && !ForesterUtil.isEmpty( node.getNodeData().getSequence().getAccession().getValue() ) ) {
+ if ( !ForesterUtil.isEmpty( node.getNodeData().getSequence().getAccession().getSource() ) ) {
+ query = node.getNodeData().getSequence().getAccession().getSource() + "%7C";
+ }
+ query += node.getNodeData().getSequence().getAccession().getValue();
+ }
+ else if ( !ForesterUtil.isEmpty( node.getNodeData().getSequence().getName() ) ) {
+ final Accession acc = AptxUtil.obtainSequenceAccessionFromName( node.getNodeData().getSequence()
+ .getName() );
+ if ( acc != null ) {
+ query = acc.getSource() + "%7C" + acc.getValue();
+ }
}
- query += node.getNodeData().getSequence().getAccession().getValue();
}
- else if ( !ForesterUtil.isEmpty( node.getNodeData().getSequence().getName() ) ) {
- final Accession acc = AptxUtil.obtainSequenceAccessionFromName( node.getNodeData().getSequence().getName() );
+ else if ( !ForesterUtil.isEmpty( node.getName() ) ) {
+ final Accession acc = AptxUtil.obtainSequenceAccessionFromName( node.getName() );
if ( acc != null ) {
query = acc.getSource() + "%7C" + acc.getValue();
}
+ else {
+ final Identifier id = SequenceIdParser.parse( node.getName() );
+ if ( id != null ) {
+ query = id.getValue();
+ }
+ }
}
return query;
}
return null;\r
}\r
\r
+ public static boolean isProtein( final String query ) {\r
+ return GENBANK_PROTEIN_AC_PATTERN.matcher( query ).lookingAt();\r
+ }\r
+\r
/**\r
* Returns null if no match.\r
* \r