-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgetstringscore.pl
55 lines (51 loc) · 1.11 KB
/
getstringscore.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/perl
#use strict;
#Define all Needed Variables
my $path=`pwd`;
print ("$path\n");
chomp ($path);
my $stringfile ="$path/STRING/Human/9606.protein.links.v10.5.txt";
my $mapping = "$path/STRING/mapping.tsv";
my $outfile = "$path/STRING/Human/Unipr_score.lst";
my $outfile1 = "$path/STRING/Human/tst.txt";
open (FILE, "$stringfile");
open (OUT, ">>$outfile");
open (FH1, '>>', "$outfile1");
open (FH, "$mapping");
print (FH1 "Hello\n");
while (my $line =<FILE>)
{
#print ($line);
chomp ($line);
if ($line=~ /\S+\.(\S+)\s+\S+\.(\S+)\s+(\S+)/)
{
#print ("$1 $2 $3 \n");
my $prot1= $1;
my $prot2= $2;
my $strscore=$3;
my $uni1 =();
my $uni2 =();
open (FH, "$mapping");
while (my $map =<FH>)
{
chomp ($map);
if ($map =~ /\S+\s+(\S+)\|\S+\s+(\S+)/)
{
my $unipr =$1;
my $stracc=$2;
if ($stracc=~ /$prot1/)
{
#print ("First found\n");
$uni1 =$unipr;
}
if ($stracc=~ /$prot2/)
{
#print ("Second found\n");
$uni2 =$unipr;
}
}
}
print "$uni1 $uni2 $strscore \n" or die ("Can't print \n");
close (FH);
}
}