/usr/share/melting/profil.pl is in melting 4.3c-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | #!/usr/bin/perl -w
#*******************************************************************************
# profil.pl *
# Copyright (C) Nicolas Le Novère and Marine Dumousseau 2009 *
# Run the program melting iteratively on a nucleic acid sequence entered from *
# stdin (it can be a file redirected with 'multi.pl < file.seq') *
#*******************************************************************************/
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Nicolas Le Novère and Marine Dumousseau
# EMBL-EBI, Wellcome-Trust Genome Campus
# Hinxton Cambridge, CB10 1SD, UK
# lenov@ebi.ac.uk
###################################################################
# Usage is: profil.pl -Iinfile -Wwindow < inputfile > outputfile #
# Where inputfile contains one sequence per line. No space before #
# sequence and at least one space before extra information #
# Write the parameters of melting in an input file. See manual. #
###################################################################
use strict;
my $VERSION = 2;
my $argument; # one of the arguments
my $infile = "infile"; # contains the parameters of the run except the sequence
my $window = 10; # contains the length of the window to analise
my %nucleic_acid ; # the nucleic acid of the analysis
##########################
# Processes the arguments
##########################
if (not @ARGV){
usage();
exit();
}
if (join("",@ARGV) =~ /-H/i){
usage();
exit();
}
foreach $argument (@ARGV){
if ($argument =~ /^-I/i){ # infile specification
$argument =~ /^-I([\w\.]*)/i;
if (defined $1){$infile = $1;}
else {warning_infile();}
} elsif ($argument =~ /^-W/i){ # window width specification
$argument =~ /^-W(\d*)/i;
if (defined $1){$window = $1;}
else {warning_window();}
} else {
print "Oups! I did not recognise the option $argument.\n";
print "I do not take it into account\n";
}
}
#################################
# Reads the sequences to analyse
#################################
# it would be desirable to treat a multisequence FASTA file as
# a set of independant sequences rather than to concatenate
# everything.
while (<STDIN>){
if (/^\s*>/){next;} # remove the fasta info line
chomp(); # remove end of line
s/#.*//; # remove the comments
s/[^AGCTU]//g; # keeps only AGCTU, case insensitive
$_ = uc($_); # switch everything uppercase
$nucleic_acid{"sequence"}.=$_; # append
}
#print "DEBUG--> sequence is: ",$nucleic_acid{"sequence"},"\n";
# Note that each line could contain other elements used in derived programs, but separed by spaces
#############
# Here we go
#############
@{$nucleic_acid{"results"}}=compute_tm($nucleic_acid{"sequence"},$window);
#print "DEBUG--> results: ",$nucleic_acid{"results"},"\n";
print_result();
sub usage{
print <<EOU;
Usage is: profil.pl [-H] -Iinfile -Wwindow < inputfile > outputfile
where
-H, -h, -help print this message;
-Iinfile file containing the parameters
-Wwindow width of the window analysed at each run
inputfile file containing the sequence
outputfile file containing the results
EOU
}
sub warning_infile{
print <<EOWI;
Except the sequences, all parameters have to be contained a configuration
file, and the script run as:
prompt> ./profil.pl -Iconfig_file -Wwindow < inputfile > outputfile)
Since no configuration file has been provided (option -I), the file infile
is assumed. See the user-guide of melting for the format of this file.
EOWI
}
sub warning_window{
print "Since no window length specification has been entered (option -W), a default\n";
print "length of 10 nucleotides is assumed\n";
}
sub compute_tm{
my ($sequence,$window)=@_;
my $i; # loop counter
my @results; # array of hashes containing the results of one nucleic acid
my $seqlength = length $sequence;
# print "DEBUG--> length of the sequence is: ",$seqlength,"\n";
if ($seqlength < $window){$window = $seqlength;} # in case of very short sequences
my $half_window = sprintf ("%d",$window / 2); # absolute value.
# print "DEBUG--> half of the window is: ",$half_window,"\n";
# Tm is reported to the middle of the string, we have to populate the first half
# Note the '<', index beginning at 0
for ($i=0 ; $i<$half_window ; $i++){
$results[$i]->{"subsequence"} = 'X'x$window;
$results[$i]->{"enthalpy"} = "000000";
$results[$i]->{"entropy"} = "000.00";
$results[$i]->{"tm"} = "-274";
# print "DEBUG--> results[",$i,"] is: ",%{$results[$i]},"\n";
}
# Now we begin the actual analysis. The sequence move from the beginning, but the
# temperatures from the middle of the first substring
my $offset = 0;
while (($offset+$window) <= $seqlength){
my $subsequence = substr($sequence,$offset,$window);
# print "DEBUG--> subsequence is: ",$subsequence,"\n";
$results[$half_window+$offset]->{"subsequence"} = $subsequence;
my @rawresults = `melting -I$infile -S$subsequence -q`;
foreach (@rawresults){
if (/Enthalpy/ ){
($results[$half_window+$offset]->{"enthalpy"}) = (split)[1];
} elsif (/Entropy/ ){
($results[$half_window+$offset]->{"entropy"}) = (split)[1];
} elsif (/Melting/ ){
($results[$half_window+$offset]->{"tm"}) = (split)[2];
} else { # do nothing, this is not suppose to occur but ...
}
}
# print "DEBUG--> results[",$half_window+$offset,"] is: ",%{$results[$half_window+$offset]},"\n";
$offset++;
}
# fill the remaining position of the array
# Note that $offset is incremented just before to quit the loop,
# hence the $half_window+$offset, identical to that of the while loop.
for ( $i = $half_window + $offset ; $i < $seqlength ; $i++ ){
$results[$i]->{"subsequence"} = 'X'x$window;
$results[$i]->{"enthalpy"} = "000000";
$results[$i]->{"entropy"} = "000.00";
$results[$i]->{"tm"} = "-274";
# print "DEBUG--> results[",$i,"] is: ",%{$results[$i]},"\n";
}
return @results;
}
sub print_result{
my $i; # loop counter
print ("Base,Enthalpy,Entropy,Tm\n");
my $seqlength = length $nucleic_acid{"sequence"};
# print "DEBUG--> length of the sequence is: ",$seqlength,"\n";
for ($i=0 ; $i<$seqlength ; $i++){
printf "%s\t", $nucleic_acid{"results"}[$i]->{"subsequence"};
printf "%7d\t ",$nucleic_acid{"results"}[$i]->{"enthalpy"};
printf "%7.2f\t",$nucleic_acid{"results"}[$i]->{"entropy"};
printf "%7.2f ",$nucleic_acid{"results"}[$i]->{"tm"};
print "\n";
}
}
|