Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Example1: perl -e 'while(<>) {if($_=~/^>/) {print $_;} else {$_=~tr/ATCG/TAGC/; +print $_;}}' FILE Example2: perl -e 'while(<>) {if($_=~/^P00520/) {print $_;}}' FILE Example3: perl -e '$count=0; while(<>) {$count++; if($count<=250) {print $_;}}' +FILE Example4: perl -e '$count=0; while(<>) {if($_=~/^>/) {$count++; print ">$count\n +";} else {print $_;}}' FILE Example 5: perl -e 'while(<>) {my $line=$_; if($line!~/^\s+/) {chomp $line; my @s +plit_line=split(/\s+/, $_); my $wanted_pos=$#split_line-1; print "$sp +lit_line[0]\t$split_line[$wanted_pos]\n";}}' FILE Example6: perl -e 'my $count_serines=0; my $count_positives=0; while(<>) {my $li +ne=$_; $count_serines++; if($line!~/^\s+/) {chomp $line; my @split_li +ne=split(/\s+/, $_); my $wanted_pos=$#split_line-1; if($split_line[$w +anted_pos] eq "*S*") {$count_positives++;}}} print "TOTAL_SERINES: ". +$count_serines."\t"."POSITIVE_PREDICTIONTS: ".$count_positives."\n";' + FILE
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can you help me with these one-liners?
by BrowserUk (Patriarch) on Apr 22, 2014 at 15:20 UTC | |
|
Re: Can you help me with these one-liners?
by Corion (Patriarch) on Apr 22, 2014 at 14:31 UTC | |
|
Re: Can you help me with these one-liners?
by 2teez (Vicar) on Apr 22, 2014 at 14:49 UTC | |
by Anonymous Monk on Apr 22, 2014 at 14:52 UTC |