1 /* Copyright (c) 2009 Peter Troshin
\r
3 * Jalview Web Services @version: 2.0
\r
5 * This library is free software; you can redistribute it and/or modify it under the terms of the
\r
6 * Apache License version 2 as published by the Apache Software Foundation
\r
8 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
\r
9 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache
\r
10 * License for more details.
\r
12 * A copy of the license is in apache_license.txt. It is also available here:
\r
13 * @see: http://www.apache.org/licenses/LICENSE-2.0.txt
\r
15 * Any republication or derived work distributed in source code form
\r
16 * must include this copyright and license notice.
\r
18 package compbio.runner._impl;
\r
20 import static compbio.runner._impl.BlastParameters.parAlView;
\r
21 import static compbio.runner._impl.BlastParameters.parDatabase;
\r
22 import static compbio.runner._impl.BlastParameters.parDel;
\r
23 import static compbio.runner._impl.BlastParameters.parEvalue;
\r
24 import static compbio.runner._impl.BlastParameters.parInput;
\r
25 import static compbio.runner._impl.BlastParameters.parOutput;
\r
27 import java.io.File;
\r
28 import java.util.Arrays;
\r
29 import java.util.List;
\r
31 import compbio.runner._SkeletalCommandBuilder;
\r
34 * TODO look at how a command can be build with an argument list
\r
36 public class PSIBlast extends _SkeletalCommandBuilder {
\r
38 private static final String command = "blastpgp";
\r
41 blastp, tbastn, blastn
\r
48 static double default_evalue = 0.001d;
\r
49 static final String parBlastType = "-p";
\r
51 private final String workDirectory;
\r
53 public PSIBlast(String workDirectory) {
\r
54 this.workDirectory = workDirectory;
\r
57 // Resulting command:
\r
58 // TODO lease note that the location seem to be different for 64 bit nodes
\r
59 // fc_gpfs/gjb_lab/www-refine/bin/blast_32bit/blast-2.2.17/bin/blastpgp -i
\r
60 // $input -d $dbnam -o $output_dir/$outfile.psiblastout.$clus -j $iterations
\r
61 // -Q $output_dir/$outfile.PSImatrix.$clus -m $mo
\r
64 // //fc_gpfs/gjb_lab/www-refine/bin/blast_32bit/blast-2.2.17/bin/blastall -p
\r
65 // blastp -i $input -d $dbnam -e $evalue -m 9 -o $outfile
\r
67 String getCommand(blastType btype, dataBase database, String input,
\r
69 return Environment.getBlastBinDir() + command + parDel + parBlastType
\r
70 + blastType.blastp + parDel + parInput + input + parDel
\r
71 + parDatabase + Environment.getBlastDatabasesDir() + database
\r
72 + parDel + parEvalue + default_evalue + parAlView + parOutput
\r
76 String getFullTestCommand(String test_input, String test_outfile) {
\r
77 return Environment.getBlastBinDir() + command + parDel + parBlastType
\r
78 + blastType.blastp + parDel + parInput + test_input + parDel
\r
79 + parDatabase + Environment.getBlastDatabasesDir()
\r
80 + dataBase.pdb + parDel + parEvalue + default_evalue
\r
81 + parAlView + parOutput + test_outfile;
\r
84 static String getTestCommand() {
\r
85 return Environment.getBlastBinDir() + command;
\r
88 static List<String> getTestArgs() {
\r
90 .asList(new String[] {
\r
91 parBlastType + blastType.blastp,
\r
92 parDatabase + Environment.getBlastDatabasesDir()
\r
93 + dataBase.pdb, parEvalue + default_evalue,
\r
97 public boolean removeOutput(String outfile) {
\r
98 File out = new File(outfile);
\r
100 if (out.canWrite()) {
\r
101 return out.delete();
\r
107 public String getCommand(ExecProvider provider) {
\r
108 return Environment.getBlastBinDir() + command;
\r
111 public String getCommandName() {
\r
116 public List<String> getCreatedFiles() {
\r
117 // TODO Auto-generated method stub
\r
122 public String getInput() {
\r
123 // TODO Auto-generated method stub
\r