-1
我是編程中的新手,特別是在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;
某種程度上該肽不在輸出列表中。請幫助指出我哪裏出錯?
感謝
兩件事情:1,始終包括'使用strict'和'使用warnings'每一個腳本的頂部,2.你有點['chomp'](http://perldoc.perl.org/functions/chomp.html) - 很高興。 –
你能編輯你的帖子來修正你的代碼的格式嗎?首先,我認爲你的評論分爲三行。其次,如果您使用一致的縮進,每個人(包括您)都會發現您的代碼更容易閱讀。 –