[Biojava-l] QBlast in BioJava3
Matthew Busse
science.translator at gmail.com
Wed Dec 29 21:01:33 UTC 2010
Hello Sylvain, et al.,
I think I may have found another similar issue.
Here's my program:
package com.multiBLAST.model;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Set;
import org.biojava3.ws.alignment.qblast.NCBIQBlastAlignmentProperties;
import org.biojava3.ws.alignment.qblast.NCBIQBlastOutputFormat;
import org.biojava3.ws.alignment.qblast.NCBIQBlastOutputProperties;
import org.biojava3.ws.alignment.qblast.NCBIQBlastService;
public class BLASTExample {
public static void main(String [] args) {
NCBIQBlastService blaster;
NCBIQBlastOutputProperties outputProperties;
InputStream is;
String request = "";
final String TESTSEQUENCE = "MAQGTLIRVTPEQPTHAVCV";
String rid = new String();
try {
blaster = new NCBIQBlastService();
NCBIQBlastAlignmentProperties alignmentProperties = new
NCBIQBlastAlignmentProperties();
alignmentProperties.setBlastProgram("blastp");
alignmentProperties.setBlastDatabase("nr");
request = blaster.sendAlignmentRequest(TESTSEQUENCE,
alignmentProperties);
System.out.println("Trying to get BLAST results for RID " +
rid);
boolean wasBlasted = false;
while (!wasBlasted) {
wasBlasted = blaster.isReady(rid,
System.currentTimeMillis());
}
outputProperties = new NCBIQBlastOutputProperties();
outputProperties.setOutputFormat(NCBIQBlastOutputFormat.TEXT);
outputProperties.setAlignmentOutputFormat(NCBIQBlastOutputFormat.PAIRWISE);
outputProperties.setDescriptionNumber(10);
outputProperties.setAlignmentNumber(10);
//to show that output options were followed
Set<String> test = outputProperties.getOutputOptions();
for(String str : test) {
System.out.println(str);
}
is = blaster.getAlignmentResults(request, outputProperties);
BufferedReader br = new BufferedReader(new
InputStreamReader(is));
String line = null;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
When I run it, it throws an exception:
java.lang.Exception: The key named PROGRAM is not set in this
RemoteQBlastOutputProperties object
at
org.biojava3.ws.alignment.qblast.NCBIQBlastAlignmentProperties.getAlignmentOption(NCBIQBlastAlignmentProperties.java:173)
at
org.biojava3.ws.alignment.qblast.NCBIQBlastService.sendActualAlignementRequest(NCBIQBlastService.java:132)
at
org.biojava3.ws.alignment.qblast.NCBIQBlastService.sendAlignmentRequest(NCBIQBlastService.java:210)
at com.multiBLAST.model.BLASTExample.main(BLASTExample.java:30)
Because RemoteQBlastOutputProperties is the terminology used in the pre-BJ3
APIs, I'm guessing this is another conversion problem? Or am I missing
something else?
Many thanks for all your help.
Best,
Matthew
On Wed, Dec 29, 2010 at 9:58 AM, Andreas Prlic <andreas at sdsc.edu> wrote:
> Thanks Sylvain,
>
> Matthew, a workaround until we have a fix for this is to add the
> http://biojava.org/download/maven/org/biojava/core/1.8/core-1.8.jar
> from the biojava-legacy project to your classpath. This should allow
> your example to work...
>
> Andreas
>
>
> On Wed, Dec 29, 2010 at 9:22 AM, Sylvain Foisy Ph. D.
> <sylvain.foisy at diploide.net> wrote:
> > Hi,
> >
> > I am the author/main culprit for the QBlast code in BJ. I have to fix the
> problem that you found ASAP to remove the dependency on the old BJ
> architecture about representing Sequence objects. I'll work on this early
> next week, as soon as I'll have finish with my grading... I am more of a
> teacher than a coder nowadays.
> >
> > Best regards
> >
> > Sylvain
> >
> >
> >
> > _______________________________________________
> > Biojava-l mailing list - Biojava-l at lists.open-bio.org
> > http://lists.open-bio.org/mailman/listinfo/biojava-l
> >
>
More information about the Biojava-l
mailing list