CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
HELP! he cant find my word?!



Oct 26, 2012, 11:42 AM

Post #1 of 3 (4339 views)
HELP! he cant find my word?! Can't Post

Hi guys :)

so i have another question for you ... im doing another script ...

sub WriteFasta {

my $hash_string = $_[0]; my $outfile = $_[1]; my $dna = ""; my $sp = ""; my $id = "";

open (OUTFILE , ">>$outfile") or die ("Cannot open outfile fasta: $outfile. $!\n");
foreach my $string (keys $hash_string) {
if ($string =~ m/LOCUS (\s+)((\D+)\_(\d+)).+/o){
$id = $2;
if ($string =~ m/\tORGANISM(.+)/o) {
print $2;
# $sp = $3;

if ($string =~ m/^ORIGIN/) {
print "x";
while ($string =~ (/.+/)) {
my $dna .= $string;

print $dna;
$dna =~ s/[\s0-9]//g;

print OUTFILE ">" , $id , ' ' , "[", $sp , "]", "\n" , $dna;


close OUTFILE;

this only one of my subroutine the other its only for read the file and its working ... i check it! and the problem its the first if ... he cant find that match or word ORGANISM ... i checked if is write correctly .. it is ... i dont know ... the for loop in back is working! And file input is from genbank file (teste.gbk)

Thanks :)

(This post was edited by andreiareis on Oct 26, 2012, 6:20 PM)
Attachments: teste.gbk (32.7 KB)


Oct 27, 2012, 3:47 AM

Post #2 of 3 (4330 views)
Re: [andreiareis] HELP! he cant find my word?! [In reply to] Can't Post

do u know there is a bio perl module that can shorten ur code and do the dirty wrk for ya as well as phraseing the file in to a perl data structure.... search for bio perl or someone will post a link.


Oct 30, 2012, 2:11 AM

Post #3 of 3 (4305 views)
Re: [andreiareis] HELP! he cant find my word?! [In reply to] Can't Post

Did you verify that ORGANISM in your input indeed is preceeded by a tab, and followed by at least one non-newline character?

BTW, you don't need the 'o' flag with this regexp, since no variables are interpolated.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives