Ignore the first two lines with ## in perl -
all.
im newbie in programming in perl. skip first 2 lines in dataset.
these codes.
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 ); $pepseq = $data[1]; #print $pepseq."\n"; foreach $header (keys %sequence) { #print "looking $pepseq in $header \n"; if ($sequence{$header} =~ /$pepseq/ ) { print "matched $pepseq in protein $header" if ( $debug ); # $in =<stdin>; if ( $header =~ /(ensgalp\s+)\s.+(ensgalg\s+)/ ) { print "debug: $1 $2 have pep = $pepseq \n\n" if ( $debug); $lprot = $1; $lgene = $2; $gccount{$lgene}++; $pccount{$lprot}++; # print "$1" if($debug); # print "$2" if ($debug); print out "$pepseq,$1,$2\n"; } } } $ngenes = keys %gccount; $nprots = keys %pccount;
somehow peptide not in output list. please point me goes wrong?
thanks
if want skip lines contain ##
anywhere in them:
next if /##/;
if want skip lines start ##
:
next if /^##/;
if want skip first 2 lines, regardless of content:
next if $. < 3;
Comments
Post a Comment