无法捕获程序的输出。所有流重定向均不起作用

无法捕获程序的输出。所有流重定向均不起作用

我想保存多个嵌套采样日志文件的分析结果。我按以下方式进行分析:

applauncher NSLogAnalyser -noposterior -N 76 -log .\run_4_partition_IIIA_Gs_sky_strict_date_NW-_NS_?.log |& tee .\partition_IIIA_Gs_sky_strict_date_NW-_run_4_76p.NSA.log

NSLogAnalyser 是一个 Java 应用程序。我使用 Windows PowerShell。我的目标是获取边际似然及其标准差。

控制台内容:


...\experiments\temp_sign\partition_IIIA\beast2_NW-\date\strict>REM Check whether the JRE is included

...\experiments\temp_sign\partition_IIIA\beast2_NW-\date\strict>IF EXIST ...\BEAST\BEAST.v2.6.6.Windows\BEAST\bat\\..\jre (
REM for BEAST version that includes JRE
 ...\BEAST\BEAST.v2.6.6.Windows\BEAST\bat\\..\jre\bin\java -cp ...\BEAST\BEAST.v2.6.6.Windows\BEAST\bat\\..\lib\launcher.jar beast.app.tools.AppLauncherLauncher NSLogAnalyser -noposterior -N 76 -log .\run_4_partition_IIIA_Gs_sky_strict_date_NW-_NS_?.log
)  ELSE (
REM for version that does not include JRE
 java -cp ...\BEAST\BEAST.v2.6.6.Windows\BEAST\bat\\..\lib\launcher.jar beast.app.tools.AppLauncherLauncher NSLogAnalyser -noposterior -N 76 -log .\run_4_partition_IIIA_Gs_sky_strict_date_NW-_NS_?.log
)
Loading package BEAST v2.6.7
Loading package BEASTLabs v1.9.7
Loading package BICEPS v1.0.1
Loading package MODEL_SELECTION v1.5.3
Loading package NS v1.1.0
Loading package BEAST v2.6.7
About to invoke beast.util.NSLogAnalyser public static void beast.util.NSLogAnalyser.main(java.lang.String[])
Args:[-noposterior, -N, 76, -log, run_4_partition_IIIA_Gs_sky_strict_date_NW-_NS_1.log, run_4_partition_IIIA_Gs_sky_strict_date_NW-_NS_2.log]

Loading run_4_partition_IIIA_Gs_sky_strict_date_NW-_NS_1.log, burnin 0%, skipping 0 log lines

|---------|---------|---------|---------|---------|---------|---------|---------|
********

Loading run_4_partition_IIIA_Gs_sky_strict_date_NW-_NS_2.log, burnin 0%, skipping 0 log lines

|---------|---------|---------|---------|---------|---------|---------|---------|
*******

Marginal likelihood: -4689.446902860894 sqrt(H/N)=(1.2326409465818016)=?=SD=(1.2159829119072592) Information: 230.94936288489217
Max ESS: 4462.598654579816

Calculating statistics

|---------|---------|---------|---------|---------|---------|---------|---------|
********************************************************************************

#Particles = 152
item                mean     stddev
posterior           -4757.17 30.55285
likelihood          -4458.50 7.057705
prior               -298.670 31.77836
treeLikelihood.2C   -2702.76 6.848746
treeLikelihood.VP1  -1755.74 6.583983
Tree.height         128.0197 16.84248
Tree.treeLength     1487.305 173.9854
clockRate.2C        0.000372 3.91E-5
clockRate.VP1       0.000382 4.31E-5
gammaShape.2C       0.164084 0.028543
gammaShape.VP1      0.205071 0.045742
freqParameter.2C.1  0.33452  0.017602
freqParameter.2C.2  0.124232 0.010946
freqParameter.2C.3  0.216865 0.015503
freqParameter.2C.4  0.324383 0.016896
freqParameter.VP1.1 0.314777 0.021272
freqParameter.VP1.2 0.150253 0.01573
freqParameter.VP1.3 0.224333 0.018902Done!

Done invoking beast.util.NSLogAnalyser
freqParameter.VP1.4 0.310638 0.020935
rateAC.2C           0.042376 0.015552
rateAC.VP1          0.033954 0.020136
rateAG.2C           0.267031 0.051583
rateAG.VP1          0.381143 0.087502
rateAT.2C           0.019338 0.006724
rateAT.VP1          0.028033 0.011584
rateCG.2C           0.010948 0.010908
rateCG.VP1          0.049077 0.029066
rateGT.2C           0.011119 0.006169
rateGT.VP1          0.007628 0.010346
BICEPS              -333.061 7.185956
PopSizes.1          683.1846 328.8325
PopSizes.2          467.6285 246.6916
PopSizes.3          481.8982 240.2775
PopSizes.4          367.6638 173.4929
PopSizes.5          200.1692 92.16058
PopSizes.6          139.0394 66.13879
PopSizes.7          165.5506 72.72370
PopSizes.8          87.49585 36.33355
GroupSizes.1        7        NaN
GroupSizes.2        6        8.39E-7
GroupSizes.3        6        8.39E-7
GroupSizes.4        6        8.39E-7
GroupSizes.5        6        8.39E-7
GroupSizes.6        6        8.39E-7
GroupSizes.7        6        8.39E-7
GroupSizes.8        6        8.39E-7
MeanPopSizes.1      18.19283 20.92613
MeanPopSizes.2      469.6374 163.8802
MeanPopSizes.3      482.6139 144.6517
MeanPopSizes.4      363.5833 91.81279
MeanPopSizes.5      200.6822 51.27011
MeanPopSizes.6      139.4026 36.87506
MeanPopSizes.7      165.6512 30.75553
MeanPopSizes.8      87.04626 13.22817
BICEPSPopSize       18.19283 20.92613

的内容分区_IIIA_Gs_sky_strict_date_NW-_run_4_76p.NSA.log


...\experiments\temp_sign\partition_IIIA\beast2_NW-\date\strict>REM Check whether the JRE is included 

...\experiments\temp_sign\partition_IIIA\beast2_NW-\date\strict>IF EXIST ...\BEAST\BEAST.v2.6.6.Windows\BEAST\bat\\..\jre (
REM for BEAST version that includes JRE  
 ...\BEAST\BEAST.v2.6.6.Windows\BEAST\bat\\..\jre\bin\java -cp ...\BEAST\BEAST.v2.6.6.Windows\BEAST\bat\\..\lib\launcher.jar beast.app.tools.AppLauncherLauncher NSLogAnalyser -noposterior -N 76 -log .\run_4_partition_IIIA_Gs_sky_strict_date_NW-_NS_?.log 
)  ELSE (
REM for version that does not include JRE  
 java -cp ...\BEAST\BEAST.v2.6.6.Windows\BEAST\bat\\..\lib\launcher.jar beast.app.tools.AppLauncherLauncher NSLogAnalyser -noposterior -N 76 -log .\run_4_partition_IIIA_Gs_sky_strict_date_NW-_NS_?.log 
) 
#Particles = 152
item                mean     stddev   
posterior           -4757.12 30.56250
likelihood          -4458.48 7.045904
prior               -298.639 31.79423
treeLikelihood.2C   -2702.75 6.842643
treeLikelihood.VP1  -1755.73 6.580639
Tree.height         128.0058 16.82583
Tree.treeLength     1487.135 173.8040
clockRate.2C        0.000372 3.92E-5 
clockRate.VP1       0.000382 4.31E-5 
gammaShape.2C       0.16406  0.028511
gammaShape.VP1      0.205079 0.045717
freqParameter.2C.1  0.33454  0.017596
freqParameter.2C.2  0.124223 0.010939
freqParameter.2C.3  0.216875 0.015476
freqParameter.2C.4  0.324362 0.016889
freqParameter.VP1.1 0.314784 0.021287
freqParameter.VP1.2 0.150252 0.015735
freqParameter.VP1.3 0.224335 0.018898
freqParameter.VP1.4 0.310629 0.020923
rateAC.2C           0.042361 0.015549
rateAC.VP1          0.034    0.020154
rateAG.2C           0.266982 0.051538
rateAG.VP1          0.38111  0.087502
rateAT.2C           0.019332 0.006716
rateAT.VP1          0.028042 0.011595
rateCG.2C           0.010964 0.010912
rateCG.VP1          0.049108 0.029111
rateGT.2C           0.011121 0.006164
rateGT.VP1          0.007618 0.010342
BICEPS              -333.061 7.181747
PopSizes.1          682.8320 328.6201
PopSizes.2          467.7127 246.5944
PopSizes.3          481.9348 240.6832
PopSizes.4          367.3583 173.2230
PopSizes.5          200.2012 92.21736
PopSizes.6          138.9932 65.99995
PopSizes.7          165.4691 72.63744
PopSizes.8          87.53192 36.38104
GroupSizes.1        7        NaN     
GroupSizes.2        6        NaN     
GroupSizes.3        6        NaN     
GroupSizes.4        6        NaN     
GroupSizes.5        6        NaN     
GroupSizes.6        6        NaN     
GroupSizes.7        6        NaN     
GroupSizes.8        6        NaN     
MeanPopSizes.1      18.14910 20.76164
MeanPopSizes.2      469.6689 163.7710
MeanPopSizes.3      482.5855 144.6700
MeanPopSizes.4      363.4197 91.70417
MeanPopSizes.5      200.6514 51.20661
MeanPopSizes.6      139.3017 36.83754
MeanPopSizes.7      165.7013 30.75118
MeanPopSizes.8      87.05698 13.22471
BICEPSPopSize       18.14910 20.76164

我认为原因是程序将输出放入任何非标准文件流(从 3 到 8)。因此我尝试了下一个命令:

applauncher NSLogAnalyser -noposterior -N 76 -log .\run_4_partition_IIIA_Gs_sky_strict_date_NW-_NS_?.log 3> stream3.txt 4> stream4.txt 5> stream5.txt 6> stream6.txt 7> stream7.txt 8> stream8.txt |& tee .\partition_IIIA_Gs_sky_strict_date_NW-_run_4_76p.NSA.log

但所有文件都为空。我怎样才能捕获控制台程序的所有输出?

答案1

要重定向所有流,您可以使用新的语法:

command *>&1 | tee logfile

您使用了,|&这意味着只有标准错误和标准输出都通过管道连接到命令的标准输入;它是 的简写2>&1 |

相关内容