Perl 在字符串eq&;中使用未初始化值$e2;查找:警告:

Perl 在字符串eq&;中使用未初始化值$e2;查找:警告:,perl,ubuntu,Perl,Ubuntu,希望你能帮助一位科学家破译我试图运行的代码的错误之处,以清理一些结果。Perl文件本身来自,尽管我在下面发布代码以供参考。包中的其他Perl文件工作得很好,虽然我已经建立了使用linux终端的传递能力,但Perl有点超出我的能力 我使用的linux终端目前正在运行:Ubuntu 16.04.6 LTS 这是我试图在linux上按照GitHub页面的指示,使用以下命令行运行的Perl代码: perl clean_htseq.pl ./ c c2 __ 我遇到的第一个错误是找不到_clean_ht

希望你能帮助一位科学家破译我试图运行的代码的错误之处,以清理一些结果。Perl文件本身来自,尽管我在下面发布代码以供参考。包中的其他Perl文件工作得很好,虽然我已经建立了使用linux终端的传递能力,但Perl有点超出我的能力

我使用的linux终端目前正在运行:Ubuntu 16.04.6 LTS

这是我试图在linux上按照GitHub页面的指示,使用以下命令行运行的Perl代码:

perl clean_htseq.pl ./ c c2 __
我遇到的第一个错误是找不到_clean_htseq.pl(第30行,已更改为解决方案),我通过在其前面添加
/
并授予软件使用脚本文件的权限来解决该问题

我当前的代码/命令行问题是以下错误:

Use of uninitialized value $e2 in string eq at ./clean_htseq.pl line 18.
find: warning: Unix filenames usually don't contain slashes (though pathnames do).  That means that '-name ‘*./SRR7251667.c’' will probably evaluate to false all the time on this system.  You might find the '-wholename' test more useful, or perhaps '-samefile'.  Alternatively, if you are using GNU grep, you could use 'find ... -print0 | grep -FzZ ‘*./SRR7251667.c’'.
Use of uninitialized value $stop in concatenation (.) or string at clean_htseq.pl line 30.
./clean_htseq.pl  ./SRR7251667.c > ./SRR7251667.c2
Use of uninitialized value $e1 in string eq at ./clean_htseq.pl line 18.
Use of uninitialized value $e2 in string eq at ./clean_htseq.pl line 18.
Use of uninitialized value $e1 in concatenation (.) or string at ./clean_htseq.pl line 18.
Use of uninitialized value $e2 in concatenation (.) or string at ./clean_htseq.pl line 18.
 eq  at ./clean_htseq.pl line 18.
这已被跟踪到命令行末尾的“_u”,但我确信这对脚本来说意味着什么,我将其删除并导致以下错误:

Use of uninitialized value $e2 in string eq at ./clean_htseq.pl line 18.
find: warning: Unix filenames usually don't contain slashes (though pathnames do).  That means that '-name ‘*./SRR7251667.c’' will probably evaluate to false all the time on this system.  You might find the '-wholename' test more useful, or perhaps '-samefile'.  Alternatively, if you are using GNU grep, you could use 'find ... -print0 | grep -FzZ ‘*./SRR7251667.c’'.
Use of uninitialized value $stop in concatenation (.) or string at clean_htseq.pl line 30.
./clean_htseq.pl  ./SRR7251667.c > ./SRR7251667.c2
Use of uninitialized value $e1 in string eq at ./clean_htseq.pl line 18.
Use of uninitialized value $e2 in string eq at ./clean_htseq.pl line 18.
Use of uninitialized value $e1 in concatenation (.) or string at ./clean_htseq.pl line 18.
Use of uninitialized value $e2 in concatenation (.) or string at ./clean_htseq.pl line 18.
 eq  at ./clean_htseq.pl line 18.

当我删除“.”from./”时也会发生错误,但返回时会出现一个错误,即找不到工作目录中的_clean_htseq.pl u文件。

您的问题似乎在这里:

my $dir = shift;
my $e1 = shift;
my $e2 = shift;
my $stop = shift;
在子例程之外,shift处理
@ARGV
——保存命令行参数的数组。按住shift键四次,因此需要四个参数:

perl clean_htseq.pl ./ c c2 __
您似乎只给了它两个,并且
$stop
没有任何值(因此您给它的值少于两个):

你不能只是消除争论,然后希望事情仍然顺利。您可能需要查看源代码以了解这些内容的含义(这将促使您作为一名科学家使用好的变量名和文档代码)

第一步可能是设置默认值。这一点在这里做得很好:

use v5.10;

my $dir  = shift // 'default_dir';
my $e1   = shift // 'default_value';
my $e2   = shift // 'default_value';
my $stop = shift // 'default_value';
或者,如果没有足够的理由,你可以放弃。标量上下文中的数组提供数组中元素的数量(尽管它不能保证它们的值):


还有许多其他的改进可以帮助这个脚本,其中一些我在中的“安全编程技术”一章中介绍过。获取未经检查的用户输入并将其传递给另一个程序通常不是一个好主意。

脚本似乎需要4个参数,但代码仅使用2、$stop和$f运行。它应该如何工作?我在论文或其补充信息中很难找到答案。据我所知,它应该对下一代测序数据进行一些特征后计数清理。它正在处理的文件包含一个大约63k基因的列表,其中包含序列与相邻区域对齐的次数。根据基因表达的高度,这个计数可以从0到几千。我想知道这些下划线是否用于“填充空白”的意义。未知,在他们的github页面上,他们将命令列为:“clean_htseq.pl./output/cellular c c2__“所以看来他们可能是有意的,我建议给作者发电子邮件。请注意,该脚本是在2015年编写的,但只有一个(!)问题-不确定现在开发此代码的积极程度。感谢您的深入解释(以及对原始帖子的语法编辑),我现在对代码出现故障的位置/原因有了更好的理解。
die "Need four arguments!\n" unless @ARGV == 4;