所有
我是编程新手,特别是在perl中。我想跳过数据集中的前两行。
这些是我的代码。
while (<PEPTIDELIST>) {
next if $_ !=~ "##";
chomp $_;
@data = split /\t/;
chomp $_;
next if /Sequence/;
chomp $_;
$npeptides++;
# print "debug: 0: $data[0] 1: $data[1] 2: $data[2] 3:
$data[3]
\n" if ( $debug );
my $pepseq = $data[1];
#print $pepseq."\n";
foreach my $header (keys %sequence) {
#print "looking for $pepseq in $header \n";
if ($sequence{$header} =~ /$pepseq/ ) {
print "matched $pepseq in protein $header" if ( $debug );
# my $in =<STDIN>;
if ( $header =~ /(ENSGALP\S+)\s.+(ENSGALG\S+)/ ) {
print "debug: $1 $2 have the pep = $pepseq \n\n" if (
$debug);
my $lprot = $1;
my $lgene = $2;
$gccount{$lgene}++;
$pccount{$lprot}++;
# print "$1" if($debug);
# print "$2" if ($debug);
print OUT "$pepseq,$1,$2\n";
}
}
}
my $ngenes = keys %gccount;
my $nprots = keys %pccount;
不知何故,肽不在输出列表中。请帮我指出哪里出错了?
感谢
答案 0 :(得分:1)
如果您想跳过其中任何位置包含##
的行:
next if /##/;
如果您只想跳过使用##
开始的行:
next if /^##/;
如果你总是想跳过前两行,不管内容如何:
next if $. < 3;
答案 1 :(得分:0)
next if $_ !=~ "##";
必须为next if $_ =~ "##";
如果$_
匹配##