#!/usr/bin/perl

use strict;
use warnings;

# the script creates links to all models adding the extension pdb

my $INDIR = "/local/CASP13/TARGETS/Targets_submitted";

# read targets
my @targets;
opendir D, $INDIR;
while(defined(my $d = readdir(D))){
    if ($d !~ /orig/){
	push @targets, $d;
    }
}
closedir D;

@targets = sort(@targets);

foreach my $t (@targets){
    if ($t =~ /^([TH]\d{4})_.*/ ){
	my $src = "$INDIR/$t";
	my $dest = "$INDIR/$1.orig.pdb";
	if (!-e $dest){
		my $command = "ln -s $src $dest ";
		system("$command");
	}
    }
}

