#!/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 $activin;
my %antiox = map{ /(.+)\s+\|\s+(PF.{5})/; $1 => $2 } read_file $antioxin;
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";
####
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
####
Q6GZX4 | PF04947.9
Q96355 | PF01486.12 PF00319.13
Q96356 | PF01486.12 PF00319.13
Q39371 | PF01486.12 PF00319.13
####
D0EYG3 | PF10262.4
E7QVU5 | PF10417.4 PF00578.16
D1JAS4 | PF10417.4 PF00578.16
####
C7T183 | PF02950.12
C7T1P5 | PF02950.12
E2E4E4 | PF00918.12
A2PU44 | PF01375.12
####
Use of uninitialized value in list assignment at ARP//positivedatasetextractor.pl line 18
####
Use of uninitialized value in list assignment at ARP//positivedatasetextractor.pl line 20