/* Copyright (c) 2011 Peter Troshin * * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0 * * This library is free software; you can redistribute it and/or modify it under the terms of the * Apache License version 2 as published by the Apache Software Foundation * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache * License for more details. * * A copy of the license is in apache_license.txt. It is also available here: * @see: http://www.apache.org/licenses/LICENSE-2.0.txt * * Any republication or derived work distributed in source code form * must include this copyright and license notice. */ package compbio.runner._impl; import static compbio.runner._impl.BlastParameters.parAlView; import static compbio.runner._impl.BlastParameters.parDatabase; import static compbio.runner._impl.BlastParameters.parDel; import static compbio.runner._impl.BlastParameters.parEvalue; import static compbio.runner._impl.BlastParameters.parInput; import static compbio.runner._impl.BlastParameters.parOutput; import java.io.File; import java.util.Arrays; import java.util.List; import compbio.runner._SkeletalCommandBuilder; /* * TODO look at how a command can be build with an argument list */ public class PSIBlast extends _SkeletalCommandBuilder { private static final String command = "blastpgp"; enum blastType { blastp, tbastn, blastn } enum dataBase { pdb } static double default_evalue = 0.001d; static final String parBlastType = "-p"; private final String workDirectory; public PSIBlast(String workDirectory) { this.workDirectory = workDirectory; } // Resulting command: // TODO lease note that the location seem to be different for 64 bit nodes // fc_gpfs/gjb_lab/www-refine/bin/blast_32bit/blast-2.2.17/bin/blastpgp -i // $input -d $dbnam -o $output_dir/$outfile.psiblastout.$clus -j $iterations // -Q $output_dir/$outfile.PSImatrix.$clus -m $mo // BlastAll // //fc_gpfs/gjb_lab/www-refine/bin/blast_32bit/blast-2.2.17/bin/blastall -p // blastp -i $input -d $dbnam -e $evalue -m 9 -o $outfile String getCommand(blastType btype, dataBase database, String input, String output) { return Environment.getBlastBinDir() + command + parDel + parBlastType + blastType.blastp + parDel + parInput + input + parDel + parDatabase + Environment.getBlastDatabasesDir() + database + parDel + parEvalue + default_evalue + parAlView + parOutput + output; } String getFullTestCommand(String test_input, String test_outfile) { return Environment.getBlastBinDir() + command + parDel + parBlastType + blastType.blastp + parDel + parInput + test_input + parDel + parDatabase + Environment.getBlastDatabasesDir() + dataBase.pdb + parDel + parEvalue + default_evalue + parAlView + parOutput + test_outfile; } static String getTestCommand() { return Environment.getBlastBinDir() + command; } static List getTestArgs() { return Arrays .asList(new String[] { parBlastType + blastType.blastp, parDatabase + Environment.getBlastDatabasesDir() + dataBase.pdb, parEvalue + default_evalue, parAlView }); } public boolean removeOutput(String outfile) { File out = new File(outfile); if (out.exists()) { if (out.canWrite()) { return out.delete(); } } return false; } public String getCommand(ExecProvider provider) { return Environment.getBlastBinDir() + command; } public String getCommandName() { return command; } @Override public List getCreatedFiles() { // TODO Auto-generated method stub return null; } @Override public String getInput() { // TODO Auto-generated method stub return null; } }