Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^13: how to read input from a file, one section at a time?

by poj (Abbot)
on Apr 02, 2019 at 16:18 UTC ( [id://1232029]=note: print w/replies, xml ) Need Help??


in reply to Re^12: how to read input from a file, one section at a time?
in thread how to read input from a file, one section at a time?

#next FASTA_RECORD if $fasta_seen{ $para }++; if ( $fasta_seen{ $para }++ ){ print "DUPLICATE : $name \n $para\n"; next FASTA_RECORD; }
poj

Replies are listed 'Best First'.
Re^14: how to read input from a file, one section at a time?
by davi54 (Sexton) on Apr 02, 2019 at 17:40 UTC
    Hi Poj,
    Can I get your email ID if that's okay with you? I can send you the complete script and you can help me with my struggle.
      I posted the test file and the script in the scratchpad. Again thanks for everything Poj. I really appreciate your effort.

        I suspect the problem is trailing whitespace (carriage returns, line feeds, spaces etc) on your sequences

        # Remove comment line(s) $para =~ s/^\s*#.*//mg; # Trim trailing white space $para =~ s/\s+$//; # add this ..
        poj
Re^14: how to read input from a file, one section at a time?
by davi54 (Sexton) on Apr 02, 2019 at 16:38 UTC
    Hi Poj,
    When I made the modifications that you suggested, for some reason, it mucked up the entire script. It started giving me errors like:
    Use of uninitialized value $lowest in printf at poj_repeat.pl line 60, <$PROTFILE> chunk 2.
    Use of uninitialized value $lowest in numeric eq (==) at poj_repeat.pl line 61, <$PROTFILE> chunk 2.
    Use of uninitialized value in numeric eq (==) at poj_repeat.pl line 61, <$PROTFILE> chunk 2.
    Can you help me with this? Use of uninitialized value in concatenation (.) or string at poj_repeat.pl line 62, <$PROTFILE> chunk 2.
    Missing argument in printf at poj_repeat.pl line 67, <$PROTFILE> chunk 2.
    Missing argument in printf at poj_repeat.pl line 67, <$PROTFILE> chunk 2

      Did you remove or comment out the original line ?

      #next FASTA_RECORD if $fasta_seen{ $para }++;
      poj
        However, now the script has stopped giving me the duplicate information. I have a test file where I have put the same sequence twice. It was giving me the duplicate print message earlier, but not anymore after fixing the semicolon issue.
      Hi,
      Yes, I did. I actually forgot to put a semicolon. Lol. Nevermind.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1232029]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2024-04-18 15:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found