So I recently posted up this code on perlmonks asking for help, and got it to work properly(THANKS)

$/="\/\/"; our @acnumbers=qw(P0A252 Q9AT80 Q0HKB6); our $acnumbers; foreach $acnumbers(@acnumbers){ my $unit; foreach $unit(<PFAMDB>){ my @units= split /#/,$unit; my @pfx=grep(/=GF AC/,@units); our $units; foreach $units(@units){ if ($units=~/.*AC $acnumbers/){ push (@list, @pfx); }else{next} } } print "$acnumbers is in:"; print @list; undef @list; }

So what it did was to take this data

# STOCKHOLM 1.0

#=GF ID 1-cysPrx_C

#=GF AC PF10417.4

#=GF DE C-terminal domain of 1-Cys peroxiredoxin

...

#=GS D8BPP0_ECOLX/154-186 AC D8BPP0.1

#=GS D6I5T0_ECOLX/154-186 AC D6I5T0.1

...

//

...

find the PFxxxx number and whether the AC xxxxxx number was in it.

There's another file, which has many lines of:

>tr|A0A171|A0A171_PYRHR Glutamate synthase small subunit-like protein 1 OS=Pyrococcus horikoshii GN=gltY PE=4 SV=1

and i need to get the A0A171, and A0A171_PYRHR Glutamate synthase small subunit-like protein 1 out also, then run the first code. So i got this:

foreach (<DATABASE>){push (@uniprot,$_);} my $i; my $name; foreach $uniprot(@uniprot){ our $acc; my @splitted=split /\||=/,$uniprot; foreach $i(@splitted){ if ($i=~/\b\w{6}\b/ and $i !~/\_/){ $acc=$i; } elsif ($i=~ /.+(?= OS)/){ $name=$i; } else {next;} my $unit; $/="\/\/"; open PFAMDB, 'C:\Users\Jems\Desktop\Perl\PFAM.txt' or die $!; foreach $unit(<PFAMDB>){ my @units= split /#/,$unit; my @pfx=grep(/=GF AC/,@units); our $units; foreach $units(@units){ if ($units=~/.*AC $acc/){ push (@list, @pfx); }else{next} } } print "$acc, also called $name, is in:" print @list; undef @list; }}

however it no longer seems to get @list out. @pfx is still correct when i print tested, but it no longer pushes to @list. (I THINK)

so is it that i am doing anything wrong? also, how would i remove the OS at the back of $name, and the #=GF AC and everything after the fullstop in @pfx? Thanks in advance!


In reply to Help with program for proteins by jemswira

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.