JPRED-2 Initial commit of software for the Jpred website (some files excluded due...
[jpred.git] / websoft / bin / create_readme
diff --git a/websoft/bin/create_readme b/websoft/bin/create_readme
new file mode 100755 (executable)
index 0000000..ced375b
--- /dev/null
@@ -0,0 +1,75 @@
+#!/usr/bin/perl
+
+# Script to create README file, run in the directory with the results in it.
+# Outputs to STDOUT by default, change with --out option or redirect.
+# If you're using an alignment give the --format msf option
+
+use strict;
+use warnings;
+use Getopt::Long;
+
+my ($out, $format);
+GetOptions(
+   "o|out=s" => \$out,
+);
+
+$out = '-' unless $out;
+
+## create look-up table of descriptions for files created by Jpred
+my %file = (
+   'LOG'               => "The log file of the prediction\n",
+   'README'            => "This file\n",
+   '.align'            => "PSIBLAST alignment with gaps and redundancy removed in FASTA format\n",
+   '.align.msf'        => "Your alignment in MSF format\n",
+   '.als'              => "Alscript command file. Used to generate PS/PDF output",
+   '.blast.gz'         => "PSIBLAST output (compressed)\n",
+   '.coils.csv'        => "The output from coils in CSV format\n",
+   '.coilseq.lupas_14' => "The output from coils using a window length of 14\n",
+   '.coilseq.lupas_21' => "The output from coils using a window length of 21\n",
+   '.coilseq.lupas_28' => "The output from coils using a window length of 28\n",
+   '.concise'          => "The prediction in pseudo-CSV format, including the coiled-coil prediction, solvent accessiblity and the sequence alignment\n",
+   '.concise.blc'      => "A BLC file of the prediction and alignment\n",
+   '.concise.pdf'      => "A PDF file of the prediction and alignment\n",
+   '.concise.ps'       => "A PostScript file of the prediction and alignment\n",
+   '.fasta'            => "Input query sequence in FASTA format\n",
+   '.hmm'              => "The HHMer2 profile of the alignment\n",
+   '.html'             => "A HTML file of the prediction and alignment\n",
+   '.input'            => "Your raw input\n",
+   '.jalview'          => "A Jalview annotation file to be read in with the .align file to view the predictions in Jalview\n",
+   '.jnet'             => "The output from Jnet\n",
+   '.profile'          => "PSIBLAST profile\n",
+   '.pssm'             => "PSIBLAST PSSM in a format for Jnet\n",
+   '.seq'              => "Your sequence\n",
+   '.simple.html'      => "The brief HTML output of the query sequence and prediction only\n",
+   '.tar.gz'           => "An archive of all the files in the directory\n",
+);
+
+## open the current directory
+opendir DIR, $ENV{'PWD'} or die "$ENV{PWD}: $!\n";
+
+## find the longest filename in order to correctly format the file
+my $len = 0;
+foreach (readdir DIR) { $len = length if length > $len; }
+rewinddir DIR;
+$len = "%-".($len + 5)."s%s";  # filename format for printing is max. length + 5 chars
+
+## Open output and write formatted filenames with their descriptions
+open FILE, ">$out" or die "$out: $!\n";
+printf FILE $len, "Filename", "Description\n";
+printf FILE $len, "--------", "-----------\n";
+
+foreach my $file (sort readdir DIR) {
+   # determine the extension for each file
+   my ($extn) = ($file =~ /[^.]*(.*)$/);
+   
+   # remove unwanted files - Alignment in CSV format (can be found in the .concise file)
+   # and the SGE job files
+   unlink $file if ($extn eq '.align.csv');
+   unlink $file if ($extn =~ /\.[eo]\d{6}$/);
+
+   # output the formatted filename along with its description if it has a known extension
+   printf FILE $len, $file, $file{$extn} if $file{$extn};
+}
+close(FILE);
+exit;
+