98447...@student.ucc.ie wrote:
Hi All,

I am having a small problem with my if looops. I have
written a small script to parse a file I have

input:

HMU00030        2522    4840            DNA gyrase subunit B
HMU00040        4841    5083            putative membrane protein
HMU00050        5080    5739    c       putative periplasmic C39-family
peptidase
HMU00060 5739 6549 c putative inner membrane protein
Wrote a perl script to convert c in fourth column to - and
if not equal to see then +


use strict;
use warnings;

while(<>){
    ($Gene, $Start, $Stop, $strand, $Product) = split(/\t/,
$_);

    my ($Gene, $Start, $Stop, $strand, $Product) = split(/\t/, $_);

    if ($strand eq "c"){
        print "$Gene\t-\t$Start\t$Stop\t$Product\n";
    }else{
        print "$Gene\t+\t$Start\t$Stop\t$Product\n";
    }
}

unfortunatly output is either all + or all - ?
any ideas?


Check your data. The data you posted had 'c ', that is, a 'c' followed by a space between the tabs.


--
Just my 0.00000002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

My favourite four-letter word is "Done!"

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to