thanks for the program... but then, i m not able to remove the duplicate values even after nulling the array... where should i do it? my input file is:
read.txt >s1 A G C T G G G G A C T T T A G C >s2 A G C T G G G G A C T T T A G C >s3 A G C T G G G G A C T T T A G C and num.txt is >s1 34 23 43 45 34 43 45 7 45 43 12 34 32 56 43 >s2 34 23 43 45 34 43 45 7 45 43 12 34 32 56 43 >s3 34 23 43 45 34 43 45 7 45 43 12 34 32 56 43
i have just given the same values as example. my program follows:
#!/usr/bin/perl open(FH1,"read.txt"); open(FH2,"num.txt"); @arr1=<FH1>; @arr2=<FH2>; $joi1=join('',@arr1); $joi2=join('',@arr2); @new=split('>',$joi1); @numbers=split('>',$joi2); foreach(@new){ ($seq_id,$seq)=split(/\n/,$_); push(@alp,split('',$seq)); push(@seqid,$seq_id); } foreach(@numbers){ ($num_id,$numb)=split(/\n/,$_); push(@num,split(' ',$numb)); push(@numid,$num_id) } #my @alp=split(' ','A G G G G T C A A A T C'); #my @num=split(' ','23 34 54 23 2 43 54 56 23 5 76 34'); my @keep= grep {$_ < 1 || $num[$_]>=10 || $alp[$_-1] ne $alp[$_-0]} 0. +.$#num; foreach(@seqid){ print "$_\n"; print (join(' ',@alp[@keep]),"\n"); } foreach(@numid){ print "$_\n"; print (join(' ',@num[@keep]),"\n"); }

In reply to Re^4: finding position by heidi
in thread finding position by heidi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.