joomanji has asked for the wisdom of the Perl Monks concerning the following question:
I know how to compare the value for each of the variable horizontally, but what if i want to compare something from line 1 and line 2? My current code :scf7180000168636 1 40919 40986 Pseudo TGT 0 + 0 25.93 scf7180000168636 2 28112 28037 Asn GTT 0 + 0 86.57 scf7180000168636 3 27372 27295 Ile GAT 0 + 0 54.85 scf7180000168636 4 27287 27213 Gly TCC 0 + 0 45.71 scf7180000168636 5 839 753 Leu CAG 0 + 0 72.78 scf7180000168667 1 1672 1598 Arg CCT 0 + 0 72.32 scf7180000168683 1 509 584 Met CAT 0 + 0 90.27 scf7180000168700 1 1405 1329 Val GAC 0 + 0 91.08 scf7180000168709 1 11151 11067 Leu CAA 0 + 0 75.09 scf7180000168716 1 481 406 Thr TGT 0 + 0 81.30 scf7180000168723 1 999 923 Val GAC 0 + 0 90.22 scf7180000168736 1 813 888 Val TAC 0 + 0 93.03 scf7180000168736 2 912 988 Asp GTC 0 + 0 95.34 scf7180000168827 1 5375 5451 Val GAC 0 + 0 91.08
I can print out line by line. By how can I print out only $p1 and $p2 if the $seq is the same? Something like "$seq $beg..$end,$beg..$end..." ? Thanks in advanced for helping me...tq!#!/usr/local/bin/perl -w #tRANSCAN-SE_extract die "usage: $0 tRNASCAN-SE.list\n" unless @ARGV ==1; while (<>) { my ($seq, $tRNA_no, $p1, $p2, $amino, $anticodon, $stat1, $stat2, +$percent) = split; $beg = $p1 if $p2 > $p1; $beg = $p2 if $p2 < $p1; $end = $p1 if $p1 > $p2; $end = $p2 if $p1 < $p2; system ("extractseq -sequence=$seq.seq -auto -stdout -separate + -reg=$beg..$end"); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Perl Multiline Regex
by ikegami (Patriarch) on May 29, 2009 at 17:07 UTC | |
by joomanji (Acolyte) on May 29, 2009 at 18:24 UTC | |
by ikegami (Patriarch) on May 29, 2009 at 18:58 UTC | |
by joomanji (Acolyte) on May 29, 2009 at 20:13 UTC | |
Re: Perl Multiline Regex
by MadraghRua (Vicar) on May 29, 2009 at 22:42 UTC | |
Re: Perl Multiline Regex
by locked_user sundialsvc4 (Abbot) on Jun 02, 2009 at 01:21 UTC |