4 # Generates a blc file from the concise file, reads in the sequence
5 # alignments those records in @data
9 # CC 22/06/07 - bug fix in 'conversion' of coil-coiled predictions
10 # CC 22/05/06 - bug fix in final foreach loop
16 if ($ARGV[0]) { open(IN, "<$ARGV[0]") or die($!); }
17 else { open(IN, "<-") or die($!); }
19 # The names of the records from the concise file that we want
20 my @data = ("JNETALIGN", "JNETHMM", "jnetpred", "JNETPSSM", "JNETCONF", "JNETSOL25", "JNETSOL5", "JNETSOL0", "Lupas_21", "Lupas_14", "Lupas_28");
22 my %convert = ("JNETALIGN" => "jalign",
25 "JNETPSSM" => "jpssm",
27 "JNETSOL25" => "sol25",
30 "Lupas_21" => "lupas_21",
31 "Lupas_14" => "lupas_14",
32 "Lupas_28" => "lupas_28",
35 my (@seq, %seq, @pred, %pred); # CC - these could be replaced with a tied hash, for future edits.
38 # Read in the concise file and extract the data
43 my ($id, $seq) = split(":", $_);
44 if (!$id || !$seq) { next; } # Check we have proper values
47 if ($id =~ /align\d*;/) {
48 @_ = split(";", $id); # Then its an alignment
63 my $seq_len = length($seq{$seq[0]}) - 1;
64 foreach (0..$seq_len) { $gap .= " "; }
69 $seq{$_} =~ s/\.|-/ /g;
76 ## CC 22/06/07 - Convert 8-state secondary structure types to 3-state types unless
77 ## it's a coil-coil prediction where 'C' is a valid prediction.
78 ## I think this is a throw-back from when Jpred was a consensus server?
82 $pred{$_} =~ s/[TCYWXZ_SI\?-]/ /g;
93 print ">$convert{$_}\n";
95 print " * iteration 1\n";
98 foreach my $i (0..$seq_len) {
100 ### CC 22/05/06 - below has been changed due to bug where if
101 # statement return false when $b == 0. This should actually
102 # be true when parsing the JNETCONF string of integers.
104 # Now we test whether the variable is defined rather than true.
105 # NB: not sure what do if the variable is not defined?
107 #if (my $b = substr($_, $i, 1)) { print $b; }
109 my $value = substr($_, $i, 1);
110 print $value if defined($value);