Package: coils / 2002-7

coils-wrap Patch series | download
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
Author: Steffen Moeller <moeller@debian.org>
LastChanged: Sat, 12 Jun 2010 16:03:22 +0200
Description:
 * coils-wrap now uses Getopt::Long
 * coils-wrap now also writes out raw prediction
 * coils-wrap input file format recognition improved
 * ncoils.c does not require the env var COILSDIR defined any more
 * -max_seq_len is not a cmd line argument any more
 * added coils-wrap.pod and ncoils.pod


--- a/coils-wrap.pl
+++ b/coils-wrap.pl
@@ -1,6 +1,8 @@
-#!/usr/local/bin/perl 
-
+#!/usr/bin/perl -w
 $|=1;
+use Carp qw| cluck :DEFAULT |;
+use Getopt::Long;
+use File::Temp qw||;
 
 
 # Runs coils multiply to give you a three-window output
@@ -9,42 +11,75 @@ $|=1;
 # 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";
+#$ENV{"COILSDIR"} = "__MAKE_PREFIX__/usr/share/coiledcoils";
+$coils_root = "__pkgdatadir__";
+$coils_exec = "ncoils";
 
-$tmpdir = "/tmp/";
+$tmpdir = File::Temp::tempdir( CLEANUP => 1 );
 
 undef($in_seq);
 undef($id);
 $mode = "threewin";
 $weighted = "";
 $matrix = "MTK";
-$win    = "21";
+#$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();
-   }
+$nameScr = $0;
+$nameScr =~ s/.*\///g;
+
+$Lok = GetOptions ("m=s"    => \$matrix,
+		   "w!"   => \$opt_weight,
+		   "i=s" => \$fastafile,
+		   "o=s" => \$outfile,
+		   "r=s" => \$fileRaw,
+		   "debug!"    => \$dbg
+		   #'help'     => \$opt_help);
+		   );
+
+
+if ( ! $Lok ) {
+    print STDERR 
+	"Invalid arguments found, -h or --help for help\n",
+	"Usage: $nameScr [options]  -i fastafile -o out_file -r raw_file\n",
+	"   -m [matrix type]  set matrix (MTK or MTIDK)\n",
+	"   -w                weight a&d = b,c,e,f&g\n",
+        "Try $nameScr --help for more information\n";
+    
+    exit(1);
+}
+
+
+if ( ! $fastafile or ! $outfile ) {
+    print STDERR
+        "Usage: $nameScr [options]  -i fastafile -o out_file -r raw_file\n",
+	"   -m [matrix type]  set matrix (MTK or MTIDK)\n",
+	"   -w                weight a&d = b,c,e,f&g\n",
+        "Try $nameScr --help for more information\n";
+    exit(1);
+}
+
+if ( ! -f $fastafile ) {
+    print STDERR
+        "input file '$fastafile' not found, exiting..\n";
+    exit(1);
+}
+
+$fileRaw = $outfile."_raw" if ( ! defined $fileRaw );
+
+$matrix = uc($matrix);
+if ( $opt_weight ) {
+    $weighted = " -w ";
 }
 
 sub exit_error {
-   print STDERR "coils-wrap.pl [options] [fasta file]\n";
+   print STDERR "coils-wrap.pl [options] [fasta file] [output 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);
+@data = read_align($fastafile,\$type);
 if($type ne "f") {
    die "Error file must be in FASTA format\n";
 }
@@ -61,14 +96,14 @@ $seqfile = $tmpdir . "coils." . $$ . ".f
 
 $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 "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";
+#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};
@@ -76,7 +111,8 @@ for($n=0; $n<$seqs->{nseq}; ++$n) {
 #   print "ID $id seq $seq\n";
 
    &write_fasta($seqfile,$id,$in_seq);
-
+   @result = ();
+   push @result, ">$id\n\n";
    if($mode eq "threewin") {
            # Runs threewin style mode
            # Three windows 14,21,28
@@ -94,7 +130,10 @@ for($n=0; $n<$seqs->{nseq}; ++$n) {
            for($i=14; $i<=28; $i+=7) {
                $j=($i-14)/7;
                $command = $coils_exec . $extra . " -win " . $i . " < " . $seqfile;
-#   	       print "Command is $command\n";
+	       if ( $i == 28 ) {
+		   open (RAW,">$fileRaw") or die "cannot write to $fileRaw:$!";
+	       }
+   	       if($dbg){ cluck("Command is $command"); }
                open(IN,"$command|");
 
                $fid = "frame-" . $i;
@@ -107,7 +146,18 @@ for($n=0; $n<$seqs->{nseq}; ++$n) {
 
                $p=0;
                while(<IN>) {
-                   if(!/sequences/) {
+		   if ( $i == 28 ) { # print the raw file if window is 28
+		       print RAW $_;
+		   }
+		   if ( /^\#/ ) {
+		       chomp($result = $_);
+		       $result =~ s/.*aas//;
+		       $result =~ s/in coil\s*//g;
+		       $result = "window size = $i ".$result." residues in coiled coil".
+			   " domain\n";
+		       push @result, $result;
+		       next;
+		   } else {
                        $_ =~ s/^ *//;
                        @t=split(/ +/);
                        $align->{ids}{$fid}{seq} .= $t[2];
@@ -118,18 +168,22 @@ for($n=0; $n<$seqs->{nseq}; ++$n) {
                        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;
+	   
+  
+	   if ( defined($outfile)) { # Write output to file
+	       write_clustal($align,\@result, $outfile);
+	   } else {
+	       write_clustal($align,\@result, "-");
+	   }
+       }
+}  
+unlink $seqfile;	     
 
-exit;
+exit(0);
 
 sub write_fasta {
    my($fn,$id,$seq) = @_;
@@ -139,7 +193,7 @@ sub write_fasta {
    while($i<length($seq)) {
       $aa = substr($seq,$i,1);
       print SEQ $aa;
-      if((($i+1)%60)==0){ print SEQ "\n" }
+      if((($i+1)%50)==0){ print SEQ "\n" }
       $i++;
    }
    print SEQ "\n";
@@ -150,12 +204,14 @@ sub write_clustal {
         my($align) = $_[0];
         my($i,$j,$k,$id);
 
-        my($outfile) = $_[1];
+	my($header)= $_[1];
+        my($outfile) = $_[2];
         open(OUT,">$outfile") || die "Error opening output file $outfile\n";
 
-
-
 #        print OUT "CLUSTAL W(1.60) multiple sequence alignment\n\n";
+	
+	print OUT @$header;
+	print OUT "\n";
 
         foreach $id (keys %{$align->{ids}}) {
                 if(defined($align->{ids}{$id}{start})) {
@@ -164,24 +220,44 @@ sub write_clustal {
                                 $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");
+		    if ( $id !~ /frame/ and $id !~ /prob/) {
+			$align->{ids}{$id}{newid} = "seq";
+		    } else {
+			$align->{ids}{$id}{newid} = $id;
+		    }
+                }		# 
+	    }
+    				# 
+	$i=0;
+
+        while($i<$align->{alen}) {
+	    printf OUT "%-10s ", ' ';
+	    for ($z = 1; $z <=50; $z++) {
+		if ($z == 50) {
+		    print OUT ($i+50)/10 ;
+		} elsif ($z % 10 == 0) {
+		    print OUT ":";
+		} elsif ($z % 5 == 0) {
+		    print OUT ".";
+		} else {
+		    print OUT " ";
+		}
+	    }
+	    print OUT "\n";
+	    
+	    for($k=0; $k<$align->{nseq}; ++$k) {
+		$id = $align->{list}[$k];
+		printf(OUT "%-10s ",$align->{ids}{$id}{newid});
+		for($j=0; $j<50; ++$j) {
+		    last if(($i+$j)>=$align->{alen});
+		    print OUT substr($align->{ids}{$id}{seq},($i+$j),1);
+		}
+		print OUT "\n";
+	    }
+	    $i+=50;
         }
-        close(OUT);
+	print OUT "// End\n\n"; 
+        close OUT;
 }
 
 sub get_afasta {
@@ -222,7 +298,7 @@ sub get_afasta {
 		if(defined($align->{ids}{$label})) {
 			$_ =~ s/-/ /g;
 			$align->{ids}{$label}{seq} .= $_;
-			print "Adding $_ to $label\n";
+#			print "Adding $_ to $label\n";
 		}
 	}
    }
@@ -233,6 +309,7 @@ sub get_afasta {
 }
 
 sub read_align { # Just read in text and modify format if necessary
+        #( $fastafile, \$type )
 
 #
 # Likely format is determined by looking for signs of one format over another
@@ -255,7 +332,7 @@ sub read_align { # Just read in text and
    my($file) = $_[0];
    my(@data);
    my($i,$type);
-   my($winner,$highest);
+   my($winner,$highest) = ('x', 0);
 
    @data=();
 
@@ -268,18 +345,19 @@ sub read_align { # Just read in text and
 
    for($i=0; $i<=$#data; ++$i) {
 	$_ = $data[$i];
-        if(($i==0) && ($_  =~ / *[0-9]+ +[0-9]+ */)) { $votes{"y"}+=1000; }
+        if( $file =~ /\.fa(sta)?$/oi ){ $votes{"f"}+=1000; last; }
+        elsif(($i==0) && ($_  =~ / *[0-9]+ +[0-9]+ */)) { $votes{"y"}+=1000; }
+        elsif(($i==0) && ($_  =~ /^>/o) && $data[1] && $data[1] =~ /^[a-z]/io ) { $votes{"f"}+=10; }
 	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($_ =~ /HMMER/o && $data[0] !~ /^>/o) { $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,
@@ -289,14 +367,12 @@ sub read_align { # Just read in text and
     	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;
+   if( $dbg ){ warn( "File is apparently of type $winner" ); }
+   ${$_[1]} = $winner;
    return @data;
 }
 sub get_print_string {
@@ -311,3 +387,5 @@ sub get_print_string {
         }
         return $max_len;
 }
+
+# vim:et:ai:
--- a/ncoils.c
+++ b/ncoils.c
@@ -1,4 +1,5 @@
 #include <ncoils.h>
+#include <string.h>
 
 /* Copyright (c) 2002 Robert B. Russell 
  *  EMBL, Meyerhofstrasse 1, 69917 Heidelberg, Germany 
@@ -22,16 +23,19 @@
 
 
 /* Rob Russell's attempt to make a COILS program */
+#ifndef __PKGDATADIR__
+#define __PKGDATADIR__ ""
+#endif
 
-main(int argc, char *argv[]) {
+int main(int argc, char *argv[]) {
 
-	int i,j,k,l;
+	int i,j;
 	int verb;
 	int window,pt;
 	int which,weighted;
 	int nseq;
 	int t,tc;
-	int seqlen;
+	int seqlen = 0;
 	int mode;
 	int min_seg;
 
@@ -39,7 +43,8 @@ main(int argc, char *argv[]) {
 	char heptfile[HEPTFILELENGTH];
 	char *buff;
 	static char *env;
-	char *seq,*title,*ident;
+	char *seq = NULL;
+	char *title,*ident;
 
 	float min_P;
 
@@ -55,10 +60,10 @@ main(int argc, char *argv[]) {
 	mode = 0; /* 0 = column mode, 1 = fasta, 2 = concise */
 	min_P = 0.5;
 
-	if((env=getenv("COILSDIR"))==NULL) {
+	if((env=getenv("COILSDIR"))==NULL) env = __PKGDATADIR__;
+
+	if( env[0] == 0 ){ // empty string
 		fprintf(stderr,"error: environment variable COILSDIR must be set\n");
-		fprintf(stderr,"       Assuming /usr/share/ncoils\n");
-		env=strdup("/usr/share/ncoils"); // a little leak, tolerated as singleton
 		exit(-1);
 	}
 
@@ -67,19 +72,19 @@ main(int argc, char *argv[]) {
 
 
 	for(i=1; i<argc; ++i) {
-           if(argv[i][0]!='-') exit_error();
+           if(argv[i][0]!='-') exit_error( env );
 	   if(strcmp(&argv[i][1],"m")==0) {
-             if((i+1)>=argc) exit_error();
+             if((i+1)>=argc) exit_error( env );
              strncpy(&heptfile[0],argv[i+1],HEPTFILELENGTH-1);
              i++;
 	   } else if(strcmp(&argv[i][1],"win")==0) {
-             if((i+1)>=argc) exit_error();
+             if((i+1)>=argc) exit_error( env );
              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();
+             if((i+1)>=argc) exit_error( env );
              sscanf(argv[i+1],"%d",&min_seg);
              i++;
 	   } else if(strcmp(&argv[i][1],"c")==0) {
@@ -87,18 +92,18 @@ main(int argc, char *argv[]) {
 	   } 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();
+             if((i+1)>=argc) exit_error( env );
              sscanf(argv[i+1],"%f",&min_P);
              i++;
 	   } else if(strcmp(&argv[i][1],"help")==0) {
-	     exit_error();
+	     exit_error( env );
 	   } 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();
+             exit_error( env );
            }
         }
 
@@ -175,14 +180,14 @@ main(int argc, char *argv[]) {
 		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);
+	if( verb ) fprintf(stderr,"%8d sequences %8d aas %8d in coil\n",nseq,t,tc);
 	free(title); free(ident); 
 
 	exit(0);
 
 }
 
-void exit_error() {
+void exit_error( const char* __coilsdir ) {
 	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");
@@ -191,7 +196,7 @@ void exit_error() {
 	fprintf(stderr,"       -win <int>          [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 <int>  [longest sequence tolerated; DEFAULT = 100 000]\n");
+	fprintf(stderr,"Effective COILSDIR: %s\n", __coilsdir );
 	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");
@@ -206,7 +211,6 @@ void pred_coils(char *seq,char *ident,ch
 
 	int i,j;
 	int len,pos,aa_pt;
-	int pt;
 	int total_coil_segments;
 	int are_there_coils;
 
--- /dev/null
+++ b/coils-wrap.pod
@@ -0,0 +1,77 @@
+=head1 NAME
+
+coils-wrap - runs ncoils three times to give you a three-window output
+
+=head1 SYNOPSIS
+
+coils-wrap [OPTION]
+
+=head1 DESCRIPTION
+
+coils-wrap runs ncoils three times to give you a three-window output.
+
+ncoils is a program that compares a sequence to a database of known parallel two-stranded coiled-coils and derives a similarity score. By comparing this score to the distribution of scores in globular and coiled-coil proteins, the program then calculates the probability that the sequence will adopt a coiled-coil conformation. 
+
+=head1 OPTIONS
+
+=over
+
+=item -i
+
+input file in FASTA format
+
+=item -o
+
+output file
+
+=item -r
+
+raw output file, default: `<output file>_raw'
+
+=item -m
+
+matrix type; set matrix (MTK or MTIDK)
+
+=item -w
+
+weight a&d = b,c,e,f&g (boolean)
+
+=back
+
+=head1 EXAMPLES
+
+C<coils-wrap -m MTIDK -i /usr/share/doc/ncoils/1srya.fa -o /tmp/coils.out -r /tmp/coils_raw.txt && less /tmp/coils.out /tmp/coils_raw.txt>
+
+C<ncoils -win 14 < /usr/share/doc/ncoils/1srya.fa>
+
+=head1 FILES
+
+=over
+
+=item F</usr/share/coiledcoils/*.mat>
+
+matrix data files
+
+=back
+
+=head1 AUTHOR
+
+R.B. Russell, A.N. Lupas, 1999
+
+=head1 COPYRIGHT AND LICENSE
+
+GPL
+
+Based on Lupas, Van Dyck & Stock (1991) Science 252,1162-1164
+
+=head1 SEE ALSO
+
+L<ncoils(1)>, L</usr/share/doc/coils/README>, L<http://www.russelllab.org/cgi-bin/coils/coils-svr.pl>
+
+=over
+
+=item A Lupas: Prediction and Analysis of Coiled-Coil Structures. Methods in Enzymology, 266, 513-525, 1996
+
+=item A. Lupas, M. Van Dyke, and J. Stock: Predicting coiled coils from protein sequences. Science, 252, 1162-1164, 1991
+
+=back
--- /dev/null
+++ b/ncoils.pod
@@ -0,0 +1,89 @@
+=head1 NAME
+
+ncoils - prediction of coiled-coil secondary structure elements
+
+=head1 SYNOPSIS
+
+ncoils [OPTION] < [FASTA FILE]
+
+ncoils -f < /usr/share/doc/ncoils/1srya.fa
+
+=head1 DESCRIPTION
+
+ncoils is a program that compares a sequence to a database of known parallel two-stranded coiled-coils and derives a similarity score. By comparing this score to the distribution of scores in globular and coiled-coil proteins, the program then calculates the probability that the sequence will adopt a coiled-coil conformation. 
+
+=head1 OPTIONS
+
+=over
+
+=item -f, -fasta
+
+fasta output - coils as 'x', like '-x' in seg
+
+=item -c
+
+concise mode - which sequences have any coils (and how many)
+
+=item -min_seg <int>
+
+for concise mode - only report sequence if >= min coil segments
+
+=item -min_P <float>
+
+minimum P to define coil segment; DEFAULT = 0.5
+
+=item -win <int>
+
+window size; DEFAULT = 21
+
+=item -w
+
+weight heptad positions a&d the same as b,c,e,f,g
+
+=item -v
+
+verbose/debug mode - print extra junk
+
+=back
+
+=head1 EXAMPLES
+
+C<coils-wrap -m MTIDK -i /usr/share/doc/ncoils/1srya.fa -o /tmp/coils.out -r /tmp/coils_raw.txt && less /tmp/coils.out /tmp/coils_raw.txt>
+
+C<ncoils -win 14 < /usr/share/doc/ncoils/1srya.fa>
+
+=head1 ENVIRONMENT
+
+COILSDIR - specifies the directory containing the file new.mat overriding the default F</usr/share/ncoils>
+
+=head1 FILES
+
+=over
+
+=item F</usr/share/ncoils/*.mat>
+
+matrix data files
+
+=back
+
+=head1 AUTHOR
+
+R.B. Russell, A.N. Lupas
+
+=head1 COPYRIGHT AND LICENSE
+
+GPL
+
+Based on Lupas, Van Dyck & Stock (1991) Science 252,1162-1164
+
+=head1 SEE ALSO
+
+L<coils-wrap(1)>, L</usr/share/doc/coils/README>, L<http://www.russelllab.org/cgi-bin/coils/coils-svr.pl>
+
+=over
+
+=item A Lupas: Prediction and Analysis of Coiled-Coil Structures. Methods in Enzymology, 266, 513-525, 1996
+
+=item A. Lupas, M. Van Dyke, and J. Stock: Predicting coiled coils from protein sequences. Science, 252, 1162-1164, 1991
+
+=back
--- a/ncoils.h
+++ b/ncoils.h
@@ -1,7 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
-#include <string.h>
 
 #define AAs "A_CDEFGHI_KLMN_PQRST_VW_Y_"
 #define PI  3.1415
--- a/read_matrix.c
+++ b/read_matrix.c
@@ -1,4 +1,5 @@
 #include <ncoils.h>
+#include <string.h>
 
 /* Copyright (c) 2002 Robert B. Russell
  *  EMBL, Meyerhofstrasse 1, 69917 Heidelberg, Germany