coils-2002/0000755000175000017500000000000007531213571012434 5ustar moellermoellercoils-2002/old.mat0000644000175000017500000000216407026150241013711 0ustar moellermoeller% % % Old matrix (as for SCIENCE paper) % w 14 1.88 0.34 1.00 0.33 20 w 21 1.76 0.28 0.86 0.26 25 w 28 1.70 0.24 0.79 0.23 30 uw 14 1.79 0.30 0.94 0.29 20 uw 21 1.70 0.25 0.83 0.24 25 uw 28 1.63 0.22 0.77 0.20 30 % % a b c d e f g L 3.167 0.297 0.398 3.902 0.585 0.501 0.483 I 2.597 0.098 0.345 0.894 0.514 0.471 0.431 V 1.665 0.403 0.386 0.949 0.211 0.342 0.360 M 2.240 0.37 0.480 1.409 0.541 0.772 0.663 F 0.531 0.076 0.403 0.662 0.189 0.106 0.013 Y 1.417 0.090 0.122 1.659 0.19 0.13 0.1550 G 0.045 0.275 0.578 0.216 0.211 0.426 0.156 A 1.297 1.551 1.084 2.612 0.377 1.248 0.877 K 1.375 2.639 1.763 0.191 1.815 1.961 2.795 R 0.659 1.163 1.210 0.031 1.358 1.937 1.798 H 0.347 0.275 0.679 0.395 0.294 0.579 0.213 E 0.262 3.496 3.108 0.998 5.685 2.494 3.048 D 0.03 2.352 2.268 0.237 0.663 1.62 1.448 Q 0.179 2.114 1.778 0.631 2.55 1.578 2.526 N 0.835 1.475 1.534 0.039 1.722 2.456 2.280 S 0.382 0.583 1.052 0.419 0.525 0.916 0.628 T 0.169 0.702 0.955 0.654 0.791 0.843 0.647 C 0.824 0.022 0.308 0.152 0.180 0.156 0.044 W 0.24 0 0 0.456 0.019 0 0 P 0.00 0.008 0 0.013 0 0 0 % coils-2002/README0000644000175000017500000000500007531212725013307 0ustar moellermoeller/* Copyright (c) 2002 Robert B. Russell * EMBL, Meyerhofstrasse 1, 69917 Heidelberg, Germany * Email: russell@embl.de * * 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. */ --- The C program --- Either re-compile the program as (e.g.) cc -O2 -I. -o ncoils-osf ncoils.c read_matrix.c -lm or use the exectuables (ncoils-osf, ncoils-irix) given. Move the executables to a central bin directory and re-name as appropriate. You then need to set an environment variable $COILSDIR to this directory so that matrices can be seen. --- An example --- Seryl tRNA synthetase has two coiled-coil segments, and should be found by the method. Try: ncoils -f < 1srya.fa You should get: >1srya SERYL-TRNA SYNTHETASE (E.C.6.1.1.11) (THERMUS THERMOPHILUS, STRAIN HB27) MVDLKRLRQEPEVFHRAIREKGVALDLEAxxxxxxxxxxxxxxxxxxxxxxxxxxxxVPK APPEExxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxVPLPPWPGAPVGGEEANREI KRVGGPPEFSFPPLDHVALMEKNGWWEPRISQVSGSRSYALKGDLALYELALLRFAMDFM ARRGFLPMTLPSYAREKAFLGTGHFPAYRDQVWAIAETDLYLTGTAEVVLNALHSGEILP YEALPLRYAGYAPAFRSEAGSFGKDVRGLMRVHQFHKVEQYVLTEASLEASDRAFQELLE NAEEILRLLELPYRLVEVATGDMGPGKWRQVDIEVYLPSEGRYRETHSCSALLDWQARRA NLRYRDPEGRVRYAYTLNNTALATPRILAMLLENHQLQDGRVRVPQALIPYMGKEVLEPC G 1 sequences 421 aas 63 in coil Note that the last line " 1 sequences..." is standard error, the rest is standard out, so if you pipe the output to 1srya_coils.fa you will just get a BLAST readable file. --- SERVER --- coils-svr.pl is a stand alone PERL program that should run the program in an HTML window if you: 1. Put the program in a /cgi-bin directory 2. Create and make read-writeable by all the directories described in the files 3. Have or install the programs "gs" "gnuplot" and "ppmtogif" I haven't documented this very well, I'm sorry, but I haven't really any time. coils-2002/coils-wrap.pl0000644000175000017500000002227207026167553015065 0ustar moellermoeller#!/usr/local/bin/perl $|=1; # Runs coils multiply to give you a three-window output # Rob Russell # Contact: russelr1@mh.uk.sbphrd.com # You may need to change these, in addition # to the "/usr/local/bin/perl" above if necessary # $ENV{"COILSDIR"} = "/data/ATG/coils/"; $coils_root = "/data/ATG/coils/"; $coils_exec = "/apps/ATG/bin/coils"; $tmpdir = "/tmp/"; undef($in_seq); undef($id); $mode = "threewin"; $weighted = ""; $matrix = "MTK"; $win = "21"; $extra = ""; for($i=0; $i<=$#ARGV; ++$i) { if($ARGV[$i] eq "-m") { # matrix file if(($i+1)>($#ARGV)) { exit_error(); } $matrix = uc($ARGV[$i+1]); $i++; } elsif($ARGV[$i] eq "-w") { # matrix file $weighted = " -w "; } elsif(!defined($fastafile)) { $fastafile = $ARGV[$i]; } else { exit_error(); } } sub exit_error { print STDERR "coils-wrap.pl [options] [fasta file]\n"; print STDERR " -m [matrix type] set matrix (MTK or MTIDK)\n"; print STDERR " -w weight a&d = b,c,e,f&g\n"; exit; } @data = read_align($fastafile,$type); if($type ne "f") { die "Error file must be in FASTA format\n"; } $extra .= $weighted; if($matrix eq "MTK") { $extra .= " -m " . $coils_root . "/old.mat"; } elsif($matrix ne "MTIDK") { die "Error matrix must be one of MTK or MTIDK\n"; } $seqfile = $tmpdir . "coils." . $$ . ".fasta"; $seqs = get_afasta(@data); print "What should appear below is the result of running COILS three \n"; print "times with windows of 14,21 & 28.\n`frame' denotes the predicted \n"; print "position of the heptad repeat for the highest scoring window that \n"; print "overlaps each position.\n`prob' gives a single integer value \n"; print "representation of P (where 0-9 covers the range 0.0-1.0)\n"; print "This will be repeated for each sequence \n\n\n"; print "A total of $seqs->{nseq} sequences found in $seqfile\n\n\n"; for($n=0; $n<$seqs->{nseq}; ++$n) { $id = $seqs->{list}[$n]; $in_seq = $seqs->{ids}{$id}{seq}; $in_seq =~ s/[\s\-\.]//g; # print "ID $id seq $seq\n"; &write_fasta($seqfile,$id,$in_seq); if($mode eq "threewin") { # Runs threewin style mode # Three windows 14,21,28 # printf("%4d %c %c %7.3f %7.3f (%7.3f %7.3f)\n",i+1,seq[i],hept_seq[i],score[i],P[i],Gcc,Gg); $align = {}; $align->{file} = ""; $align->{ids} = (); $align->{list} = (); $align->{nseq} = 7; $align->{ids}{$id}{seq} = $in_seq; $align->{alen} = length($in_seq); $align->{list}[0] = $id; for($i=14; $i<=28; $i+=7) { $j=($i-14)/7; $command = $coils_exec . $extra . " -win " . $i . " < " . $seqfile; # print "Command is $command\n"; open(IN,"$command|"); $fid = "frame-" . $i; $pid = "prob-" . $i; $align->{ids}{$fid}{seq} = ""; $align->{ids}{$pid}{seq} = ""; $align->{ids}{$pid}{Ps} = (); $align->{list}[1+$j] = $fid; $align->{list}[4+$j] = $pid; $p=0; while() { if(!/sequences/) { $_ =~ s/^ *//; @t=split(/ +/); $align->{ids}{$fid}{seq} .= $t[2]; $align->{ids}{$pid}{Ps}[$p] = $t[4]; # Raw P value $p++; $P = $t[4]*10; if($P>=10) { $sP = "9"; } else { $sP = substr($P,0,1); } if($sP eq "0") { $sP = "-"; } $align->{ids}{$pid}{seq} .= $sP; } else { print; } } close(IN); } write_clustal($align,"-"); } } #unlink $seqfile; exit; sub write_fasta { my($fn,$id,$seq) = @_; open(SEQ,">$fn") || die "$fn wouldn't open\n"; print SEQ ">$id\n"; $i=0; while($i$outfile") || die "Error opening output file $outfile\n"; # print OUT "CLUSTAL W(1.60) multiple sequence alignment\n\n"; foreach $id (keys %{$align->{ids}}) { if(defined($align->{ids}{$id}{start})) { $align->{ids}{$id}{newid} = $id . "/" . ($align->{ids}{$id}{start}+1) . "-" . ($align->{ids}{$id}{end}+1); if(defined($align->{ids}{$id}{ranges})) { $align->{ids}{$id}{newid} .= $align->{ids}{$id}{ranges}; } } else { $align->{ids}{$id}{newid} = $id; } } $i=0; while($i<$align->{alen}) { for($k=0; $k<$align->{nseq}; ++$k) { $id = $align->{list}[$k]; printf(OUT "%-10s ",$align->{ids}{$id}{newid}); for($j=0; $j<60; ++$j) { last if(($i+$j)>=$align->{alen}); print OUT substr($align->{ids}{$id}{seq},($i+$j),1); } printf(OUT "\n"); } $i+=60; printf(OUT "\n"); } close(OUT); } sub get_afasta { # Get aligned FASTA data (i.e. afasta = aligned fasta) # # Assumes that only "-" characters are gaps (treats as spaces internally) # (actually, of course this means spaces will be gaps, or maybe they should be ignored # strange dilemma that I have got myself into. For the minute they will just be kept as is # (spaces are gaps as well). This could lead to some problems. my(@data) = @_; my($align,$i,$j,$k,$n); $align = {}; $align->{ids} = (); $align->{list} = (); $align->{nseq} = 0; my($name_count) = 0; for($n=0; $n<=$#data; ++$n) { $_ = $data[$n]; chop; if(/^>/) { $label = substr($_,1); $label =~ s/ .*//; $postbumpf = $_; $postbumpf =~ s/>[^ ]* //; if(defined($align->{ids}{$label})) { $label = $label . "-" . $name_count; } $align->{list}[$name_count]=$label; $align->{ids}{$label}{seq} = ""; $align->{ids}{$label}{postbumpf} = $postbumpf; $name_count ++; } else { if(defined($align->{ids}{$label})) { $_ =~ s/-/ /g; $align->{ids}{$label}{seq} .= $_; print "Adding $_ to $label\n"; } } } $align->{nseq} = $name_count; $align->{alen} = length($align->{ids}{$align->{list}[0]}{seq}); $align->{id_prs} = get_print_string($align); return $align; } sub read_align { # Just read in text and modify format if necessary # # Likely format is determined by looking for signs of one format over another # and storing them in %votes. This won't always work, of course, but # generally the user can force one format over another, check to see # if the second variable passed to the routine is "x", and complain # if so. # my(%votes) = ( "m" => 0, "c" => 0, "b" => 0, "f" => 0, "p" => 0, "s" => 0, "h" => 0, "e" => 0, "y" => 0 ); my($file) = $_[0]; my(@data); my($i,$type); my($winner,$highest); @data=(); open(IN,$file) || die "$file wouldn't open in read_align\n"; $block_start=0; $block_end=0; while() { push(@data,$_); } close(IN); for($i=0; $i<=$#data; ++$i) { $_ = $data[$i]; if(($i==0) && ($_ =~ / *[0-9]+ +[0-9]+ */)) { $votes{"y"}+=1000; } elsif(($_ =~ /^ *Name:/) || ($_ =~ /pileUp/) || ($_ =~ /MSF.*Check.*\.\./)) { $votes{"m"}++; last; } elsif($_ =~ /^CLUSTAL/) { $votes{"c"}+=10; last; } elsif($_ =~ /^>P1;/) { $votes{"p"}+=10; last; } elsif($_ =~ /HMMER/) { $votes{"h"}+=10; last; } elsif(($_ =~ /^#=SQ/) || ($_ =~ /^#=RF/)) { $votes{"h"}++; } elsif($_ =~ /^>/) { $votes{"f"}++; $votes{"b"}++; } elsif($_ =~ /^ *\* iteration [0-9]*/) { $votes{"b"}++; $block_start++; } elsif($_ =~ /^ *\*/) { $votes{"b"}++; $block_end++; } elsif(($_ =~ /^ID /) || ($_ =~ /^CC /) || ($_ =~ /^AC /) || ($_ =~ /^SE /)) { $votes{"s"}++; } elsif(($_ =~ /^HSSP .*HOMOLOGY DERIVED SECONDARY STRUCTURE OF PROTEINS/)) { $votes{"e"}+=1000; } } # Block and FASTA are quite hard to tell apart in a quick parse, # This hack tries to fix this if(($votes{"f"} == $votes{"b"}) && ($votes{"f"}>0)) { if($block_start==0) { $votes{"f"}++; } if($block_end==0) { $votes{"f"}++; } } $winner = "x"; $highest = 0; foreach $type (keys %votes) { # print $type," ", $votes{$type},"\n"; if($votes{$type}>$highest) { $winner = $type; $highest = $votes{$type}; } } # print "File is apparently of type $winner\n"; $_[1] = $winner; return @data; } sub get_print_string { my($align) = $_[0]; my($max_len); my($i); $max_len = 0; for($i=0; $i<$align->{nseq}; ++$i) { $this_len = length($align->{list}[$i]); if($this_len > $max_len) { $max_len = $this_len; } } return $max_len; } coils-2002/read_matrix.c0000644000175000017500000000604207531212646015103 0ustar moellermoeller#include /* Copyright (c) 2002 Robert B. Russell * EMBL, Meyerhofstrasse 1, 69917 Heidelberg, Germany * Email: russell@embl.de * * 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. */ struct hept_pref *read_matrix(FILE *IN) { int i,j; int pt,aa_len; int win; float m_g,sd_g,m_cc,sd_cc,sc; float hept[7]; char buff[1000],junk[1000]; struct hept_pref *h; aa_len = strlen(AAs); h = (struct hept_pref*)malloc(sizeof(struct hept_pref)); h->m = (float**)malloc(aa_len*sizeof(float*)); for(i=0; im[i]=(float*)malloc(7*sizeof(float)); for(j=0; j<7; ++j) { h->m[i][j]=-1; } } h->f = (struct fit_dat*)malloc(sizeof(struct fit_dat)); h->n = 0; h->smallest=1.0; while(fgets(buff,999,IN)!=NULL) { if(buff[0]!='%') { if((strncmp(buff,"uw ",3)==0) || (strncmp(buff,"w ",2)==0)) { i = h->n; if(strncmp(buff,"uw ",3)==0) { h->f[i].w=0; } else { h->f[i].w=1; } sscanf(buff,"%s %d %f %f %f %f %f", &junk[0],&win,&m_cc,&sd_cc,&m_g,&sd_g,&sc); h->f[i].win = win; h->f[i].m_cc = (float)m_cc; h->f[i].sd_cc = (float)sd_cc; h->f[i].m_g = (float)m_g; h->f[i].sd_g = (float)sd_g; h->f[i].sc = (float)sc; h->n++; h->f = (struct fit_dat*)realloc(h->f,((h->n)+1)*sizeof(struct fit_dat)); if((h->n)>=9) { fprintf(stderr,"Error: too many window parms in matrix file\n"); exit(-1); } } else if(buff[0]>='A' && buff[0]<='Z') { /* AA data */ pt = (int)(buff[0]-'A'); if(h->m[pt][0]==-1) { sscanf(buff,"%s%f%f%f%f%f%f%f", &junk[0], &hept[0],&hept[1],&hept[2],&hept[3],&hept[4], &hept[5],&hept[6]); for(i=0; i<7; ++i) { h->m[pt][i] = (float)hept[i]; if(h->m[pt][i]>0) { if(h->m[pt][i]smallest) { h->smallest = h->m[pt][i]; } } else { h->m[pt][i]=-1; /* Don't permit zero values */ } } /* printf("AA %c %4.2f %4.2f %4.2f %4.2f %4.2f %4.2f %4.2f\n",buff[0], h->m[pt][0],h->m[pt][1],h->m[pt][2],h->m[pt][3],h->m[pt][4], h->m[pt][5],h->m[pt][6]); */ } else { fprintf(stderr,"Warning: multiple entries for AA %c in matrix file\n",buff[0]); } } else { fprintf(stderr,"Warning: strange characters in matrix file\n"); fprintf(stderr,"Ignoring line: %s",buff); } } } return h; } coils-2002/new.mat0000644000175000017500000000215007026150241013717 0ustar moellermoeller% % New matrix % % weighted w 14 1.89 0.30 1.04 0.27 20 w 21 1.79 0.24 0.92 0.22 25 w 28 1.74 0.20 0.86 0.18 30 uw 14 1.82 0.28 0.95 0.26 20 uw 21 1.74 0.23 0.86 0.21 25 uw 28 1.69 0.18 0.80 0.18 30 % % a b c d e f g L 2.998 0.269 0.367 3.852 0.510 0.514 0.562 I 2.408 0.261 0.345 0.931 0.402 0.440 0.289 V 1.525 0.479 0.350 0.887 0.286 0.350 0.362 M 2.161 0.605 0.442 1.441 0.607 0.457 0.570 F 0.490 0.075 0.391 0.639 0.125 0.081 0.038 Y 1.319 0.064 0.081 1.526 0.204 0.118 0.096 G 0.084 0.215 0.432 0.111 0.153 0.367 0.125 A 1.283 1.364 1.077 2.219 0.490 1.265 0.903 K 1.233 2.194 1.817 0.611 2.095 1.686 2.027 R 1.014 1.476 1.771 0.114 1.667 2.006 1.844 H 0.590 0.646 0.584 0.842 0.307 0.611 0.396 E 0.281 3.351 2.998 0.789 4.868 2.735 3.812 D 0.068 2.103 1.646 0.182 0.664 1.581 1.401 Q 0.311 2.290 2.330 0.811 2.596 2.155 2.585 N 1.231 1.683 2.157 0.197 1.653 2.430 2.065 S 0.332 0.753 0.930 0.424 0.734 0.801 0.518 T 0.197 0.543 0.647 0.680 0.905 0.643 0.808 C 0.918 0.002 0.385 0.440 0.138 0.432 0.079 W 0.066 0.064 0.065 0.747 0.006 0.115 0.014 P 0.004 0.108 0.018 0.006 0.010 0.004 0.007 % coils-2002/coils-svr.pl0000755000175000017500000002522107531213561014716 0ustar moellermoeller#!/usr/bin/perl -w # Copyright (c) 1999 Robert B. Russell # EMBL, Meyerhofstrasse 1, 69917 Heidelberg, Germany # Email: russell@embl.de # # 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. # # # Rob Russell # Contact: russell@embl-heidelberg.de # This is a very rough perl CGI program to run COILS # as a crude server. To use you will have to # edit things substantially. use CGI; $coils_root = "/usr/local/apache/htdocs/coils/"; $coils_exec = "/russell/rg1/lbin/ncoils"; $gnuplot_exec = "/russell/rg1/lbin/gnuplot"; $gs_exec = "/usr/bin/gs"; $ppmtogif_exec = "/usr/bin/ppmtogif"; $header = $coils_root."/header.html"; $footer = $coils_root."/footer.html"; $coilsmat = $coils_root . "/new.mat"; $tmpdir = "/usr/local/apache/htdocs/coils/data/"; $htmldir = "http://www.russell.embl-heidelberg.de/coils/data/"; $junkfile = "/tmp/coilsjunk.".$$; $query = new CGI; print $query->header; print $query->start_html("Rob Russell's COILS Server"); if($query->param()){ &process($query); } else { &print_prompt($query); } print $query->end_html; sub print_prompt { my($query) = @_; if(open(INFO,$header)){ while(){ print; } } else { print "Contact Rob Russell for more information.
"; } print $query->startform; print "Paste your sequence into this box (raw sequence, or FASTA format):
"; print $query->textarea(-name=>'sequence', -default=>'', -rows=>10, -columns=>50); print "
Enter a name for your query sequence (optional)
\n"; print $query->textarea(-name=>'Name', -rows=>1, -columns=>30, -default=>'Unknown' ); print "
\n"; print "Mode: "; print $query->popup_menu(-name=>'Mode', -values=>['fasta','raw','threewin'], -default=>'threewin' ); print " "; print "Weight a&d = b,c,e,f,g?"; print $query->popup_menu(-name=>'weighted?', -values=>['yes','no'], -default=>'no' ); print " "; print "Matrix:"; print $query->popup_menu(-name=>'matrix', -values=>['MTIDK','MTK'], -default=>'MTIDK' ); print "
"; print "Window (fasta/raw only): "; print $query->popup_menu(-name=>'Window', -values=>['14','21','28'], -default=>'21' ); print "
"; print $query->submit(); print $query->reset(); if(open(INFO,$footer)){ while(){ print; } } print $query->endform } sub process { print "\n"; print "\n"; $in_seq = $query->param('sequence'); $in_seq =~ s/^>[^\n].*\n//; $in_seq =~ s/^>[^\r].*\n//; $in_seq =~ s/[^A-Za-z]//g; $mode = $query->param('Mode'); $id = $query->param('Name'); $win = $query->param('Window'); if($query->param('weighted?') eq "yes") { $weighted = " -w "; } else { $weighted =""; } $extra = $weighted; if($query->param('matrix') eq "MTK") { $extra .= " -m " . $coils_root . "/old.mat"; } $ENV{"COILSDIR"} = "/russell/rg1/apps/coils/"; $seqfile = $tmpdir . "coils_svr_" . $$ . ".fasta"; $gpcomfile = $tmpdir . "coils_svr_" . $$ . "_gp.com"; $gpdatfile = $tmpdir . "coils_svr_" . $$ . "_gp.dat"; $gppsfile = $tmpdir . "coils_svr_" . $$ . "_gp.ps"; $gpppmfile = $tmpdir . "coils_svr_" . $$ . "_gp.ppm"; $gpgiffile = $tmpdir . "coils_svr_" . $$ . "_gp.gif"; $gpgifhtmlfile = $htmldir . "coils_svr_" . $$ . "_gp.gif"; &write_fasta($seqfile,$id,$in_seq); if(($mode eq "fasta") || ($mode eq "raw")) { if($mode eq "fasta") { $extra .= " -f "; } print "
";
     $command = $coils_exec . $extra .  " < ". $seqfile;
     print "Command is $command
\n"; exit; if(open(IN,"$command|")) { while() { print $_; } close(IN); } else { print "Error opening output from COILS\n"; die; } print "
"; } elsif($mode eq "threewin") { print "


What should appear below is the result of running COILS three times with windows of 14,21 & 28.
`frame' denotes the predicted position of the heptad repeat for the highest scoring window that overlaps each position.
`prob' gives a single integer value representation of P (where 0-9 covers the range 0.0-1.0)
\n"; print "
";
        # Runs threewin style mode
        # Three windows 14,21,28
        # printf("%4d %c %c %7.3f %7.3f (%7.3f %7.3f)\n",i+1,seq[i],hept_seq[i],score[i],P[i],Gcc,Gg);
        $align = {};
        $align->{file} = "";
        $align->{ids}  = ();
        $align->{list} = ();

        $align->{nseq} = 7;
        $align->{ids}{$id}{seq} = $in_seq;
        $align->{alen} = length($in_seq);
        $align->{list}[0] = $id;

        for($i=14; $i<=28; $i+=7) {
            $j=($i-14)/7;
            $command = $coils_exec . $extra . " -win " . $i . " < " . $seqfile;
#	    print "Command is $command\n";
            open(IN,"$command|");

            $fid = "frame-" . $i;
            $pid = "prob-" . $i;
            $align->{ids}{$fid}{seq} = "";
            $align->{ids}{$pid}{seq} = "";
            $align->{ids}{$pid}{Ps} = ();
            $align->{list}[1+$j] = $fid;
            $align->{list}[4+$j] = $pid;

            $p=0;
            while() {
                $_ =~ s/^ *//;
                @t=split(/ +/);
                $align->{ids}{$fid}{seq} .= $t[2];
                $align->{ids}{$pid}{Ps}[$p] = $t[4]; # Raw P value
                $p++;
                $P = $t[4]*10;
                if($P>=10) { $sP = "9"; }
                else { $sP = substr($P,0,1); }
                if($sP eq "0") { $sP = "-"; }
                $align->{ids}{$pid}{seq} .= $sP;
            }
            close(IN);
        }
        write_clustal($align,"-");
	print "
"; print "


What should appear below is an image of the three window lengths as a function of residue number. Peaks in the graph indicate regions of higher coil probability.
\n"; # Now we'll try and do a ghostscript plot if(!open(OUT,">$gpdatfile")) { print "Error running ghostscript\n"; die; } for($i=0; $i<$align->{alen}; ++$i) { printf(OUT "%4d %s %s %7.3f %s %7.3f %s %7.3f \n", $i+1,substr($align->{ids}{$id}{seq},$i,1), substr($align->{ids}{"frame-14"}{seq},$i,1), $align->{ids}{"prob-14"}{Ps}[$i], substr($align->{ids}{"frame-21"}{seq},$i,1), $align->{ids}{"prob-21"}{Ps}[$i], substr($align->{ids}{"frame-28"}{seq},$i,1), $align->{ids}{"prob-28"}{Ps}[$i]); } close(OUT); if(!open(OUT,">$gpcomfile")) { print "Error running ghostscript\n"; die; } print OUT "set terminal postscript portrait color solid set size 0.7,1.0 set output \"/dev/null\" plot [ ] [0:1.0] \"$gpdatfile\" using 1:4 title \"P(cc) vs. Seq pos win 14\" with lines replot \"$gpdatfile\" using 1:6 title \"P win 21\" with lines set output \"$junkfile\" replot \"$gpdatfile\" using 1:8 title \" win 28\" with lines set output quit"; close(OUT); $command = $gnuplot_exec . " < " . $gpcomfile ; # print "Command is $command\n"; system($command); $command = "/bin/mv ".$junkfile." ".$gppsfile; # print "Command is $command\n"; system($command); $command = $gs_exec . " -sDEVICE=ppmraw -r72 -q -dNOPAUSE -sOutputFile=\"" . $gpppmfile . "\" -- " . $gppsfile . " >> $gpcomfile "; # print "Command is $command\n"; system($command); $command = $ppmtogif_exec . " < " . $gpppmfile . " > " . $gpgiffile; # print "Command is $command\n"; system($command); print "\n"; print ""; # printf("HERE running %s
\n",$command); exit; system($command); } unlink $seqfile; unlink $junkfile; unlink $gpdatfile; unlink $gpcomfile; unlink $gppsfile; unlink $gpppmfile; unlink $gpgiffile; unlink $gpgifhtmlfile; } sub write_fasta { my($fn,$id,$seq) = @_; open(SEQ,">$fn") || die "$fn wouldn't open\n"; print SEQ ">$id\n"; $i=0; while($i$outfile") || die "Error opening output file $outfile\n"; # print OUT "CLUSTAL W(1.60) multiple sequence alignment\n\n"; foreach $id (keys %{$align->{ids}}) { if(defined($align->{ids}{$id}{start})) { $align->{ids}{$id}{newid} = $id . "/" . ($align->{ids}{$id}{start}+1) . "-" . ($align->{ids}{$id}{end}+1); if(defined($align->{ids}{$id}{ranges})) { $align->{ids}{$id}{newid} .= $align->{ids}{$id}{ranges}; } } else { $align->{ids}{$id}{newid} = $id; } } $i=0; while($i<$align->{alen}) { for($k=0; $k<$align->{nseq}; ++$k) { $id = $align->{list}[$k]; printf(OUT "%-10s ",$align->{ids}{$id}{newid}); for($j=0; $j<60; ++$j) { last if(($i+$j)>=$align->{alen}); print OUT substr($align->{ids}{$id}{seq},($i+$j),1); } printf(OUT "\n"); } $i+=60; printf(OUT "\n"); } close(OUT); } coils-2002/1srya.fa0000644000175000017500000000077407026150240014003 0ustar moellermoeller>1srya SERYL-TRNA SYNTHETASE (E.C.6.1.1.11) (THERMUS THERMOPHILUS, STRAIN HB27) MVDLKRLRQEPEVFHRAIREKGVALDLEALLALDREVQELKKRLQEVQTERNQVAKRVPKAPPEEKEALIARGKALGEEA KRLEEALREKEARLEALLLQVPLPPWPGAPVGGEEANREIKRVGGPPEFSFPPLDHVALMEKNGWWEPRISQVSGSRSYA LKGDLALYELALLRFAMDFMARRGFLPMTLPSYAREKAFLGTGHFPAYRDQVWAIAETDLYLTGTAEVVLNALHSGEILP YEALPLRYAGYAPAFRSEAGSFGKDVRGLMRVHQFHKVEQYVLTEASLEASDRAFQELLENAEEILRLLELPYRLVEVAT GDMGPGKWRQVDIEVYLPSEGRYRETHSCSALLDWQARRANLRYRDPEGRVRYAYTLNNTALATPRILAMLLENHQLQDG RVRVPQALIPYMGKEVLEPCG coils-2002/ncoils.h0000644000175000017500000000142607026150240014067 0ustar moellermoeller#include #include #include #define AAs "A_CDEFGHI_KLMN_PQRST_VW_Y_" #define PI 3.1415 /* Include file for Ncoils */ struct hept_pref { float **m; /* 20 x 7 amino acid heptad weights */ float smallest; /* Smallest of the above */ int n; /* statistical fitting data (weighted) */ struct fit_dat *f; }; struct fit_dat { int win; /* Window length */ float m_cc, sd_cc; /* mean/sd for coiled-coils */ float m_g, sd_g; /* mean/sd for globular */ float sc; /* scaling factor */ int w; /* 1= weighted, 0=un-weighted */ }; struct hept_pref *read_matrix(FILE *MAT); void exit_error(); void pred_coils(char *seq,char *ident,char *title,struct hept_pref *h,int win,int which, int weighted,int fasta,float min_P, int *t, int *tc, int min_segs); coils-2002/ncoils.c0000644000175000017500000002271707531213463014100 0ustar moellermoeller#include /* Copyright (c) 2002 Robert B. Russell * EMBL, Meyerhofstrasse 1, 69917 Heidelberg, Germany * Email: russell@embl.de * * 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. */ /* Rob Russell's attempt to make a COILS program */ main(int argc, char *argv[]) { int i,j,k,l; int verb; int window,pt; int which,weighted; int nseq; int t,tc; int seqlen; int mode; int min_seg; char heptfile[1000]; char *buff; static char *env; char *seq,*title,*ident; float min_P; struct hept_pref *h; FILE *MAT; /* defaults */ window = 21; weighted = 0; verb = 0; mode = 0; /* 0 = column mode, 1 = fasta, 2 = concise */ min_P = 0.5; if((env=getenv("COILSDIR"))==NULL) { fprintf(stderr,"error: environment variable COILSDIR must be set\n"); exit(-1); } strcpy(&heptfile[0],env); strcpy(&heptfile[strlen(heptfile)],"/new.mat"); for(i=1; i=argc) exit_error(); strcpy(&heptfile[0],argv[i+1]); i++; } else if(strcmp(&argv[i][1],"win")==0) { if((i+1)>=argc) exit_error(); sscanf(argv[i+1],"%d",&window); i++; } else if(strcmp(&argv[i][1],"c")==0) { mode=2; } else if(strcmp(&argv[i][1],"min_seg")==0) { if((i+1)>=argc) exit_error(); sscanf(argv[i+1],"%d",&min_seg); i++; } else if(strcmp(&argv[i][1],"c")==0) { mode=2; } else if((strcmp(&argv[i][1],"f")==0) || (strcmp(&argv[i][1],"fasta")==0)) { mode=1; } else if((strcmp(&argv[i][1],"min_P")==0)) { if((i+1)>=argc) exit_error(); sscanf(argv[i+1],"%f",&min_P); i++; } else if(strcmp(&argv[i][1],"help")==0) { exit_error(); } else if(strcmp(&argv[i][1],"w")==0) { weighted=1; } else if(strcmp(&argv[i][1],"V")==0 || strcmp(&argv[i][1],"v")==0) { verb=1; } else { fprintf(stderr," can't understand flag/field %s\n",argv[i]); exit_error(); } } if(verb) printf("Matrix file is %s\n",heptfile); /* Read in matrix */ if((MAT=fopen(heptfile,"r"))==NULL) { fprintf(stderr,"Error reading %s\n",heptfile); exit(-1); } h = read_matrix(MAT); if(verb) { for(i=0; im[pt][0],h->m[pt][1],h->m[pt][2],h->m[pt][3],h->m[pt][4], h->m[pt][5],h->m[pt][6]); } for(i=0; in; ++i) { printf("Window %4d %1d %f %f %f %f %f\n", h->f[i].win,h->f[i].w,h->f[i].m_cc,h->f[i].sd_cc,h->f[i].m_g,h->f[i].sd_g,h->f[i].sc); } } /* See if there is a file for our chosen window length/weight scheme */ which = -1; for(i=0; in; ++i) { if((h->f[i].win == window) && (h->f[i].w == weighted)) { /* match */ if(verb) printf("Found fitting data for win %4d w %d\n",window,weighted); which = i; } } /* Read in a sequence from the standard input */ nseq = 0; ident = (char*) malloc(100000*sizeof(char)); title = (char*) malloc(100000*sizeof(char)); buff = (char*) malloc(100000*sizeof(char)); t = 0; tc = 0; while(fgets(buff,99999,stdin)!=NULL) { /* There is a memory problem - the matrix data gets corrupted under OSF after this fgets */ for(i=0; i') { if(nseq>0) { pred_coils(seq,ident,title,h,window,which,weighted,mode,min_P,&t,&tc,min_seg); free(seq); } seqlen = 0; i=1; while((buff[i]!=' ') && (buff[i]!='\0') && (buff[i]!='\n') && (buff[i]!='\r')) { ident[i-1]=buff[i]; i++; } ident[i-1]='\0'; i++; j=0; seq = (char*)malloc(sizeof(char)); seq[0]='\0'; while(buff[i]!='\n' && buff[i]!='\0' && buff[i]!='\r') { title[j]=buff[i]; i++; j++; } title[j]='\0'; nseq++; } else { /* printf("Adding |%s| to |%s| = \n",buff,seq); */ seq=(char*)realloc(seq,(seqlen+strlen(buff)+1)*sizeof(char)); strcpy(&seq[seqlen],buff); seqlen=strlen(seq); /* printf(" |%s|\n",seq); */ } } if(nseq>0) { pred_coils(seq,ident,title,h,window,which,weighted,mode,min_P,&t,&tc,min_seg); free(seq); } fprintf(stderr,"%8d sequences %8d aas %8d in coil\n",nseq,t,tc); free(title); free(ident); exit(0); } void exit_error() { fprintf(stderr,"format: ncoils [options] < [sequence file]\n"); fprintf(stderr," -f or -fasta [fasta output - coils as 'x', like '-x' in seg]\n"); fprintf(stderr," -c [concise mode - which sequences have any coils (and how many)]\n"); fprintf(stderr," -min_seg [for concise mode - only report sequence if >= min coil segments]\n"); fprintf(stderr," -min_P [minimum P to define coil segment; DEFAULT = 0.5]\n"); fprintf(stderr," -win [window size; DEFAULT = 21]\n"); fprintf(stderr," -w [weight heptad positions a&d the same as b,c,e,f,g]\n"); fprintf(stderr," -v [verbose/debug mode - print extra junk]\n"); fprintf(stderr," -max_seq_len [longest sequence tolerated; DEFAULT = 100 000]\n"); fprintf(stderr,"\n"); fprintf(stderr,"NCOILS, Rob Russell and Andrei Lupas, 1999\n"); fprintf(stderr," based on Lupas, Van Dyck & Stock (1991) Science 252,1162-1164\n"); fprintf(stderr," Copyright (C) 1999 Robert B. Russell\n"); fprintf(stderr," NCOILS comes with ABSOLUTELY NO WARRANTY; for details see the file LICENSE\n"); fprintf(stderr," This is free software, and you are welcome to redistribute it\n"); fprintf(stderr," under certain conditions; see LICENSE for details\n"); exit(-1); } void pred_coils(char *seq,char *ident,char *title,struct hept_pref *h,int win, int which, int weighted,int mode, float min_P, int *t, int *tc, int min_seg) { int i,j; int len,pos,aa_pt; int pt; int total_coil_segments; int are_there_coils; float actual_win; float this_score,Gg,Gcc,power; float t1,t2,t3,t4; float *score; float *P; char *hept_seq; len=strlen(seq); score = (float*)malloc(len*sizeof(float)); P = (float*)malloc(len*sizeof(float)); hept_seq = (char*)malloc(len*sizeof(char)); /* printf("Sequence is %s length is %d\n",seq,len); */ for(i=0; i=0) && (aa_pt<26) && (AAs[aa_pt]!='_')) { pos = j%7; /* where are we in the heptad? pos modulus 7 */ /* printf("AA %c in hept %c %7.5f\n",seq[i+j],('a'+pos),h->m[aa_pt][pos]); */ if(weighted && (pos==0 || pos==3)) { power = 2.5; } else { power = 1.0; } actual_win+=power; if(h->m[aa_pt][pos]!=-1) { this_score*=pow(h->m[aa_pt][pos],power); } else { this_score*=pow(h->smallest,power); } } } if(actual_win>0) { this_score = pow(this_score,(1/(float)actual_win)); } else { this_score = 0; } for(j=0; ((j=0) && (aa_pt<26) && (AAs[aa_pt]!='_')) { pos = j%7; /* where are we in the heptad? pos modulus 7 */ if(this_score>score[i+j]) { score[i+j]=this_score; hept_seq[i+j]='a'+pos; } } } } if(mode==1) { printf(">%s %s\n",ident,title); } are_there_coils=0; total_coil_segments=0; for(i=0; if[which].sd_cc); t2 = (score[i]-(h->f[which].m_cc))/h->f[which].sd_cc; t3 = fabs(t2); t4 = pow(t3,2); t4 = t3*t3; Gcc = t1 * exp(-0.5*t4); /* printf("Gcc %f %f %f %f %f\n",t1cc,t2cc,t3cc,t4cc,Gcc); */ t1 = 1/(h->f[which].sd_g); t2 = (score[i]-(h->f[which].m_g))/h->f[which].sd_g; t3 = fabs(t2); t4 = pow(t3,2); t4 = t3*t3; Gg = t1 * exp(-0.5*t4); /* printf("Gg %f %f %f %f %f\n",t1g,t2g,t3g,t4g,Gg); */ P[i] = Gcc/(h->f[which].sc*Gg+Gcc); if(P[i]>=min_P) { are_there_coils=1; if((i==0) || (P[i-1]=min_P) { printf("x"); } else { printf("%c",seq[i]); } if(((i+1)%60)==0) { printf("\n"); } } else if(mode==0) { printf("%4d %c %c %7.3f %7.3f (%7.3f %7.3f)\n",i+1,seq[i],hept_seq[i],score[i],P[i],Gcc,Gg); } } if(mode==1) { printf("\n"); } if((mode==2) && (are_there_coils==1) && (total_coil_segments>=min_seg)) { if(total_coil_segments==1) { printf("Pred %4d coil segment : %s %s\n",total_coil_segments,ident,title); } else { printf("Pred %4d coil segments : %s %s\n",total_coil_segments,ident,title); } } free(P); free(score); free(hept_seq); } coils-2002/LICENSE0000644000175000017500000003545207531213141013443 0ustar moellermoeller GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.