
acpguedes
Novice
Oct 16, 2011, 10:20 AM
Post #1 of 7
(15964 views)
|
[HELP] regexp that covers the whole text
|
Can't Post
|
|
I have problem with this script:
#!/usr/bin/perl use strict; use warnings; print "Write input arquive name\n\t"; my $input = <STDIN>; print "Write max energy. Like: -28\n\t"; my $min = <STDIN>; print "Write min energy. Like: -30\n\t"; my $max = <STDIN>; print "Write output arquive name\n\t"; my $output = <STDIN>; open IN, $input or die "cannot open input"; open OUT,">". $output or die usage (); while(<IN>){ if($_ =~ m/(mfe:s+(-?d.*.?d.*?)s+kcal/mol)/gi){ if($2 <= $min && $2 >= $max){ print OUT " $1.$/ "; } } } I need a regex that covers the whole text below as it is repeated several times and I want to get all of the text according to the value of "mfe:"
---------------------------------------------------------------- miRNA: hsa-miR-92b* #variable is here! Start here Hybrid: mfe: -29.5 kcal/mol #variable is here! this is the important value position 29 #variable is here! target 5' U A A U C 3' #variable is here! GCUG ACUGC UUCC UCCC #variable is here! UGAC UGGCG AGGG AGGG #variable is here! miRNA 3' G G C C A 5' #variable is here! Miranda: Position: 29 #variable is here! Query: 3' guGACGUGGCGCAGGGCAGGGa 5' #variable is here! ||| ||:|| |:|| |||| #variable is here! Ref: 5' tgCTGAACTGCATTCCTTCCCc 3' #variable is here! Energy: -24.110001 kCal/Mol #variable is here! Rybrid vs miRanda: OK #Finish here ---------------------------------------------------------------- miRNA: hsa-miR-4689 #variable is here! Hybrid: mfe: -34.0 kcal/mol #variable is here! position 3 #variable is here! target 5' U G ACCC U U 3' #variable is here! GU CCCACCAUG UC UCCUCA #variable is here! CG GGGUGGUAC AG AGGAGU #variable is here! miRNA 3' C G U 5' #variable is here! Miranda: Position: 3 #variable is here! Query: 3' ccggGGGUGGUAC----A-GAGGAGUu 5' #variable is here! ||||||||| | :|||||| #variable is here! Ref: 5' tgtgCCCACCATGACCCTCTTCCTCAt 3' #variable is here! Energy: -29.650000 kCal/Mol #variable is here! Rybrid vs miRanda: OK I did a search regexp that the value of "mfe:" but I wanted the output file would leave all text
/(mfe:s+(-?d.*.?d.*?)s+kcal/mol)/ -------------------------------------- I'm looking for one that represents the entire regexp text above in order to say "Here begins the text, here are some lines with text, text in that part of the value should be in the range request, the text ends here" like: /(miRNA:)....(mfe:s+(-?d.*.?d.*?)s+kcal/mol)......((Rybrid)s+(vs)s+(miRanda)s+(OK)) ^this is a eg -------------------------------------- I'm wating some help tanks
(This post was edited by acpguedes on Oct 16, 2011, 10:41 AM)
|