Hi PerlMonks!

I'm not sure if this is a valid question to ask, but I can't debug a program and thus I require your help!

#!/usr/bin/perl use Modern::Perl; use File::Slurp qw/read_file write_file/; my $uniprot = 'D:\\ARP\\Downloads\\uniprot-sfinal.txt'; my $activin = 'D:\\ARP\\Downloads\\Activator-Pfam.txt'; my $antioxin = 'D:\\ARP\Downloads\\AntiOxidant-Pfam.txt'; my $toxinin= 'D:\\ARP\\Downloads\\Toxin-Pfam.txt'; my $activout = 'D:\\ARP\\Downloads\\ActivACNPF.txt'; my $antioxout= 'D:\\ARP\\Downloads\\AntioxACNPF.txt'; my $toxinout= 'D:\\ARP\\Downloads\\ToxinACNPF.txt'; my @activline; my @antioxline; my @toxinline; my %activ = map { /(.+)\s+\|\s+(PF.{5})/; $1 => $2 } read_file $activi +n; my %antiox = map{ /(.+)\s+\|\s+(PF.{5})/; $1 => $2 } read_file $antiox +in; my %toxin = map { /(.+)\s+\|\s+(PF.{5})/;$1=> $2} read_file $toxinin; for ( read_file $uniprot ) { /(.{6})\s+.+=([^\s]+)/; push @activline, "$1 $2 $activ{$1}\n" if $activ{$1}; push @antioxline, "$1 $2 $antiox{$1}\n" if $antiox{$1}; push @toxinline, "$1 $2 $antiox{$1}\n" if $antiox{$1}; } write_file $activout, @activline; write_file $antioxout, @antioxline; write_file $toxinout, @toxinline; print STDOUT "DONE\n";

This is a program I'm writing for my research project. Here's a few lines from each input file:

D:\\ARP\\Downloads\\uniprot-sfinal.txt

Q6GZX4 ORFNames=FV3-001R ;PF04947 Q6GZX3 ORFNames=FV3-002L ;PF03003 Q197F8 ORFNames=IIV3-002R Q197F7 ORFNames=IIV3-003L Q6GZX2 ORFNames=FV3-003R Q6GZX1 ORFNames=FV3-004R Q197F5 ORFNames=IIV3-005L

D:\\ARP\\Downloads\\Activator-Pfam.txt

Q6GZX4 | PF04947.9 Q96355 | PF01486.12 PF00319.13 Q96356 | PF01486.12 PF00319.13 Q39371 | PF01486.12 PF00319.13

D:\\ARP\Downloads\\AntiOxidant-Pfam.txt

D0EYG3 | PF10262.4 E7QVU5 | PF10417.4 PF00578.16 D1JAS4 | PF10417.4 PF00578.16

D:\\ARP\\Downloads\\Toxin-Pfam.txt

C7T183 | PF02950.12 C7T1P5 | PF02950.12 E2E4E4 | PF00918.12 A2PU44 | PF01375.12

The error codes I got were as shown

Use of uninitialized value in list assignment at ARP//positivedatasetextractor.pl line 18

Line 18: my %activ = map { /(.+)\s+\|\s+(PF.{5})/; $1 => $2 } read_file $activin;

Use of uninitialized value in list assignment at ARP//positivedatasetextractor.pl line 20

Line 20: my %toxin = map { /(.+)\s+\|\s+(PF.{5})/;$1=> $2} read_file $toxinin;

Use of uninitialized value $1 in hash element at ARP//positivedatasetextractor.pl Line 23

Line 23: push @activline, "$1 $2 $activ{$1}\n" if $activ{$1};

Use of uninitialized value $1 in hash element at ARP//positivedatasetextractor.pl Line 24

Line 24: push @antioxline, "$1 $2 $antiox{$1}\n" if $antiox{$1};

Use of uninitialized value $1 in hash element at ARP//positivedatasetextractor.pl Line 25

Line 25: push @toxinline, "$1 $2 $antiox{$1}\n" if $antiox{$1};

I know this is pretty long, but I have no idea how to debug this, so I'm posting this here for help. Thanks in advance!

Update: Thanks for your help, everyone! Well, I have further problems which use the same datasets, but is quite unrelated to this matter, so I'll be posting it on another new thread. Thanks again!


In reply to Debugging help! by invaderzard

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.