我对这个旧程序有疑问。我以前有linux版本谁运作良好,但我需要一些原因的Windows版本,从来没有工作过。虽然它基于java,但只有起始脚本似乎有所不同,基于软件创建者所说的内容 首先,我遇到了
的问题ECHO -mode Wise2 running mode [wing|global|both]
带来了"'全球'不是公认的内部命令或程序"。 所以我看了一下它并将其改为字符串作为管道似乎运作良好。
但是现在它根本没有启动,而在最后有一个运行%和一些输出文件之前。 我想到了 SET SHARKHOME =%~p0 和%~dp0到位,但没有运气。
我改变了类路径硬编码部分中斜杠的方向(\ to / /那是回复%sharkhome%给我回来的东西,完成了最后的斜杠c:/ user / 我再没有运气,但试图压制%sharkhome%和硬编码目录之间的斜线(所以%sharkhome%java而不是%sharkhome%/ java或%sharkhome%\ java)但没有运气。
我坚持这个。为什么这不起作用,拜托?
@ECHO OFF
REM #############################
REM SHARKhunt execution script #
REM Windows version 28/2/06 #
REM #############################
SETLOCAL
REM get SHARKHOME from path of batch file
SET SHARKHOME=%~p0
REM # set classpath
SET CLASSPATH=%SHARKHOME%\java\sharkhunt1.0_win32.jar:%SHARKHOME%\java\jdom.jar:%SHARKHOME%\java\jakarta-regexp-1.2.jar
REM ############################################
REM # default directories
SET TMP=%CD%
SET PROFILES="%SHARKHOME%\priam_06_win32"
SET VER="priam_06"
SET BLASTHOME="%SHARKHOME%\blast"
SET WISEHOME="%SHARKHOME%\wise2"
SET OUTPUT=%CD%
REM # default options
SET EUK=true
SET BLASTCUT=1.0
SET LEEWAY=2000
SET MAXREGIONS=5
SET MODE=both
SET FINALCUT=0.1
SET XMX=2048M
REM ############################################
REM # check user options
IF NOT DEFINED %2 GOTO HELP
IF %1 == "-h" GOTO HELP
IF %1 == "--help" GOTO HELP
IF %1 == "-help" GOTO HELP
:LOOP
IF %1 == "-euk" (
SET EUK="%2"
SHIFT
SHIFT
GOTO LOOP
)
IF %1 == "-blastcut" (
SET BLASTCUT="%2"
SHIFT
SHIFT
GOTO LOOP
)
IF %1 == "-leeway" (
SET LEEWAY="%2"
SHIFT
SHIFT
GOTO LOOP
)
IF %1 == "-maxregions" (
SET MAXREGIONS="%2"
SHIFT
SHIFT
GOTO LOOP
)
IF %1 == "-mode" (
SET MODE="%2"
SHIFT
SHIFT
GOTO LOOP
)
IF %1 == "-finalcut" (
SET FINALCUT="%2"
SHIFT
SHIFT
GOTO LOOP
)
IF %1 == "-out" (
SET OUTPUT="%2"
SHIFT
SHIFT
GOTO LOOP
)
IF %1 == "-tmp" (
SET TMP="%2"
SHIFT
SHIFT
GOTO LOOP
)
IF %1 == "--profiles" (
SET PROFILES="%2"
SHIFT
SHIFT
GOTO LOOP
)
IF %1 == "--blasthome"
SET BLASTHOME="%2"
SHIFT
SHIFT
GOTO LOOP
)
IF %1 == "--wisehome" (
SET WISEHOME="%2"
SHIFT
SHIFT
GOTO LOOP
)
IF %1 == "--Xmx" (
SET XMX="%2"
SHIFT
SHIFT
GOTO LOOP
)
SET DATA=%1
SET GENOME=%2
IF %EUK% == "f" SET EUK=false
IF %EUK% == "F" SET EUK=false
IF %EUK% == "FALSE" SET EUK=false
IF %EUK% == "t" SET EUK=true
IF %EUK% == "T" SET EUK=true
IF %EUK% == "TRUE" SET EUK=true
SET BLASTMAT="%BLASTHOME%\data"
REM # run SharkHunt
START java -Xmx$XMX -cp %CLASSPATH% -Dshark.tempdir=%TMP% -Dshark.eukaryote=%EUK% -Dshark.genomepath=%DATA% -Dshark.profiles=%PROFILES% -Dshark.blasthome=%BLASTHOME% -Dshark.wisehome=%WISEHOME% -Dshark.output=%OUTPUT% -Dshark.maxregions=%MAXREGIONS% -Dshark.wisemode=%MODE% -Dshark.cutoff=%BLASTCUT% -Dshark.maxsig=%FINALCUT% -Dshark.leeway=%LEEWAY% -Dshark.wisemode=%MODE% -Dshark.profiles_version=%VER% sharkhunt.SharkHunt %GENOME%
PAUSE
ENDLOCAL
EXIT
:HELP
ECHO usage: $progname [options] genome_path genome_id
ECHO
ECHO options:
ECHO -euk Eukaryotic genome [T/F]
ECHO " (default=%EUK%)"
ECHO -leeway No. of bases to extract each side of BLAST hit [integer]
ECHO " (default=%LEEWAY%)"
ECHO -blastcut Cutoff E-value for initial BLAST search [real]
ECHO " (default=%BLASTCUT%)"
ECHO -maxregions No. of best BLAST regions to take forward to Wise2 search [integer]
ECHO " (default=%MAXREGIONS%)"
ECHO -mode Wise2 running mode [String]
ECHO " (default=%MODE%)"
ECHO -finalcut Final E-value cutoff [real]
ECHO " (default=%FINALCUT%)"
ECHO -tmp Directory for working files [string]
ECHO " (default=%TMP%)"
ECHO -out Output directory [string]
ECHO " (default=%OUTPUT%)"
ECHO
ECHO advanced options:
ECHO --profiles Specify profile directory [String]
ECHO " (default=%PROFILES%)"
ECHO --blasthome Specify BLAST directory [String]
ECHO " (default=%BLASTHOME%)"
ECHO --wisehome Specify Wise2 directory [String]
ECHO " (default=%WISEHOME%)"
ECHO --Xmx Specify JVM size [String]
ECHO " (default=%XMX%)"
答案 0 :(得分:2)
只有一些评论和提示:
cmd
poisonous characters使用^
一般转义字符:ECHO [wing^|global^|both]
"
双引号如下:SET "PROFILES=%SHARKHOME%\priam_06_win32"
echo "%PROFILES%"
echo(
显示空行而不是ECHO is off
消息SET "BLASTMAT=%BLASTHOME%\data"
然后使用-Dshark.blasthome="%BLASTHOME%"
而不是SET BLASTMAT="%BLASTHOME%\data"
,然后使用-Dshark.blasthome=%BLASTHOME%
(注意并考虑双引号位置)IF "%~2"=="" GOTO HELP
代替IF NOT DEFINED %2 GOTO HELP
作为最后一种表示法可能导致测试变量%GOTO%
存在:if not defined GOTO help
,请参阅if /?
IF
command更改某些测试,例如IF /I "%~1" == "-h" GOTO HELP
代码段示例:
IF /I "%~1" == "-help" GOTO HELP
:LOOP
IF /I "%~1" == "-euk" (
SET "EUK=%~2"
SHIFT
SHIFT
GOTO LOOP
)
另一个代码段示例(请注意,操作start
command仅由echo
显示以用于调试目的;保持˙echo˙直到调试;另请注意""
中的start "" something
不是一个错误):
SET "DATA=%~1"
SET "GENOME=%~2"
SET "EUK=true"
IF /I "%EUK%" == "f" SET EUK=false
IF /I "%EUK%" == "FALSE" SET EUK=false
SET "BLASTMAT=%BLASTHOME%\data"
REM # run SharkHunt
echo START "" java -Xmx %XMX% -cp %CLASSPATH% -Dshark.tempdir="%TMP%" -Dshark.eukaryote=%EUK% -Dshark.genomepath=%DATA% -Dshark.profiles=%PROFILES% -Dshark.blasthome=%BLASTHOME% -Dshark.wisehome=%WISEHOME% -Dshark.output=%OUTPUT% -Dshark.maxregions=%MAXREGIONS% -Dshark.wisemode=%MODE% -Dshark.cutoff=%BLASTCUT% -Dshark.maxsig=%FINALCUT% -Dshark.leeway=%LEEWAY% -Dshark.wisemode=%MODE% -Dshark.profiles_version=%VER% sharkhunt.SharkHunt %GENOME%
PAUSE
最后,请注意我的回答仅涉及批处理脚本实践,而不是 java !