lecb has asked for the wisdom of the Perl Monks concerning the following question:
Hi again, I'm back.. much further in my program - but stuck again - 8 hours of solid playing around and still nothing.
my ($left_of_boundary, $intron_from_boundary, $new_left, $seq, $col7, +$col_alt, $matchID); my $i = 0; open (INTRONS_five, '>fasta_introns_five_non'); open (INTRONS_three, '>fasta_introns_three_non'); foreach $col7(@col7) { ##50bp seq in var file $seq = ''; $col7[$i] =~ s/\[[ACTG]\]/$col_ref[$i]/i; if ($intron_from_boundary[$i] =~ m/\-/) { &three_prime; } elsif ($intron_from_boundary[$i] =~ m/\+/) { &five_prime; } my $length = length($seq); if ($length == 9) { print INTRONS_five (">" . "$match{$col_NM[$i]}" . "\n", lc +($seq),"\n"); } elsif ($length != '') { print INTRONS_three (">" . "$col_NM[$i]" . "\n", lc($seq), +"\n"); } ++$i; } close (INTRONS_five); close (INTRONS_three); sub three_prime { if ($strands{$ID[$i]} =~ m/\+/) { ## !!!PROBLEM!!! - $seq prints to file INTRONS_three when $strands{$ID[$i]} = + or - ### ### BUT if I print out $ID[$i] here, it only pulls out + (shows the hash is working) ### $left_of_boundary = 20; ##$right_of_boundary = 3; $left_of_boundary = $left_of_boundary + $intron_from_bound +ary[$i]; $new_left = 51 - $left_of_boundary; $seq = substr( $col7[$i], $new_left, 23); } elsif ($strands{$ID[$i]} =~ m/\-/) { if ($intron_from_boundary[$i] >= -6) { $left_of_boundary = 3; #$right_of_boundary = 6; $left_of_boundary = $left_of_boundary - $intron_from_bound +ary[$i]; $new_left = 51 - $left_of_boundary; $seq = substr( $col7[$i], $new_left, 9); $matchID = $ID[$i] . "\t" . $intron_from_boundary[$i] +. "\t" . "on the negative strand"; } } }
I know this is a lot of code (and not all of it), but I have commented out "problem" where the issue lies. My %strands works, but when I open the INTRONS_three file it is printing out sequences for both when $ID[$i] is + or -. I thought maybe it was to do with when I am calling my variables i.e. my $seq? I've tried using/not using a subroutine, data::dumping, hitting the keyboard, prayer.. but still to no avail...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: error calling variables? Going insane...
by toolic (Bishop) on Jun 25, 2014 at 21:06 UTC | |
by lecb (Acolyte) on Jun 25, 2014 at 21:14 UTC | |
by jeffa (Bishop) on Jun 25, 2014 at 22:02 UTC | |
by lecb (Acolyte) on Jun 25, 2014 at 22:28 UTC | |
by SuicideJunkie (Vicar) on Jun 25, 2014 at 21:46 UTC | |
by lecb (Acolyte) on Jun 25, 2014 at 22:22 UTC | |
by poj (Abbot) on Jun 25, 2014 at 21:58 UTC | |
by lecb (Acolyte) on Jun 25, 2014 at 22:24 UTC |