| 1 |
Author: Steffen Moeller <[email protected]> |
| 2 |
LastChanged: Sat, 12 Jun 2010 16:03:22 +0200 |
| 3 |
Description: |
| 4 |
* coils-wrap now uses Getopt::Long |
| 5 |
* coils-wrap now also writes out raw prediction |
| 6 |
* coils-wrap input file format recognition improved |
| 7 |
* ncoils.c does not require the env var COILSDIR defined any more |
| 8 |
* -max_seq_len is not a cmd line argument any more |
| 9 |
* added coils-wrap.pod and ncoils.pod |
| 10 |
|
| 11 |
|
| 12 |
--- a/coils-wrap.pl |
| 13 |
+++ b/coils-wrap.pl |
| 14 |
@@ -1,6 +1,8 @@ |
| 15 |
-#!/usr/local/bin/perl |
| 16 |
- |
| 17 |
+#!/usr/bin/perl -w |
| 18 |
$|=1; |
| 19 |
+use Carp qw| cluck :DEFAULT |; |
| 20 |
+use Getopt::Long; |
| 21 |
+use File::Temp qw||; |
| 22 |
|
| 23 |
|
| 24 |
# Runs coils multiply to give you a three-window output |
| 25 |
@@ -9,42 +11,75 @@ |
| 26 |
# You may need to change these, in addition |
| 27 |
# to the "/usr/local/bin/perl" above if necessary |
| 28 |
# |
| 29 |
-$ENV{"COILSDIR"} = "/data/ATG/coils/"; |
| 30 |
-$coils_root = "/data/ATG/coils/"; |
| 31 |
-$coils_exec = "/apps/ATG/bin/coils"; |
| 32 |
+#$ENV{"COILSDIR"} = "__MAKE_PREFIX__/usr/share/coiledcoils"; |
| 33 |
+$coils_root = "__pkgdatadir__"; |
| 34 |
+$coils_exec = "ncoils"; |
| 35 |
|
| 36 |
-$tmpdir = "/tmp/"; |
| 37 |
+$tmpdir = File::Temp::tempdir( CLEANUP => 1 ); |
| 38 |
|
| 39 |
undef($in_seq); |
| 40 |
undef($id); |
| 41 |
$mode = "threewin"; |
| 42 |
$weighted = ""; |
| 43 |
$matrix = "MTK"; |
| 44 |
-$win = "21"; |
| 45 |
+#$win = "21"; |
| 46 |
$extra = ""; |
| 47 |
|
| 48 |
-for($i=0; $i<=$#ARGV; ++$i) { |
| 49 |
- if($ARGV[$i] eq "-m") { # matrix file |
| 50 |
- if(($i+1)>($#ARGV)) { exit_error(); } |
| 51 |
- $matrix = uc($ARGV[$i+1]); |
| 52 |
- $i++; |
| 53 |
- } elsif($ARGV[$i] eq "-w") { # matrix file |
| 54 |
- $weighted = " -w "; |
| 55 |
- } elsif(!defined($fastafile)) { |
| 56 |
- $fastafile = $ARGV[$i]; |
| 57 |
- } else { |
| 58 |
- exit_error(); |
| 59 |
- } |
| 60 |
+$nameScr = $0; |
| 61 |
+$nameScr =~ s/.*\///g; |
| 62 |
+ |
| 63 |
+$Lok = GetOptions ("m=s" => \$matrix, |
| 64 |
+ "w!" => \$opt_weight, |
| 65 |
+ "i=s" => \$fastafile, |
| 66 |
+ "o=s" => \$outfile, |
| 67 |
+ "r=s" => \$fileRaw, |
| 68 |
+ "debug!" => \$dbg |
| 69 |
+ #'help' => \$opt_help); |
| 70 |
+ ); |
| 71 |
+ |
| 72 |
+ |
| 73 |
+if ( ! $Lok ) { |
| 74 |
+ print STDERR |
| 75 |
+ "Invalid arguments found, -h or --help for help\n", |
| 76 |
+ "Usage: $nameScr [options] -i fastafile -o out_file -r raw_file\n", |
| 77 |
+ " -m [matrix type] set matrix (MTK or MTIDK)\n", |
| 78 |
+ " -w weight a&d = b,c,e,f&g\n", |
| 79 |
+ "Try $nameScr --help for more information\n"; |
| 80 |
+ |
| 81 |
+ exit(1); |
| 82 |
+} |
| 83 |
+ |
| 84 |
+ |
| 85 |
+if ( ! $fastafile or ! $outfile ) { |
| 86 |
+ print STDERR |
| 87 |
+ "Usage: $nameScr [options] -i fastafile -o out_file -r raw_file\n", |
| 88 |
+ " -m [matrix type] set matrix (MTK or MTIDK)\n", |
| 89 |
+ " -w weight a&d = b,c,e,f&g\n", |
| 90 |
+ "Try $nameScr --help for more information\n"; |
| 91 |
+ exit(1); |
| 92 |
+} |
| 93 |
+ |
| 94 |
+if ( ! -f $fastafile ) { |
| 95 |
+ print STDERR |
| 96 |
+ "input file '$fastafile' not found, exiting..\n"; |
| 97 |
+ exit(1); |
| 98 |
+} |
| 99 |
+ |
| 100 |
+$fileRaw = $outfile."_raw" if ( ! defined $fileRaw ); |
| 101 |
+ |
| 102 |
+$matrix = uc($matrix); |
| 103 |
+if ( $opt_weight ) { |
| 104 |
+ $weighted = " -w "; |
| 105 |
} |
| 106 |
|
| 107 |
sub exit_error { |
| 108 |
- print STDERR "coils-wrap.pl [options] [fasta file]\n"; |
| 109 |
+ print STDERR "coils-wrap.pl [options] [fasta file] [output file]\n"; |
| 110 |
print STDERR " -m [matrix type] set matrix (MTK or MTIDK)\n"; |
| 111 |
print STDERR " -w weight a&d = b,c,e,f&g\n"; |
| 112 |
exit; |
| 113 |
} |
| 114 |
|
| 115 |
-@data = read_align($fastafile,$type); |
| 116 |
+@data = read_align($fastafile,\$type); |
| 117 |
if($type ne "f") { |
| 118 |
die "Error file must be in FASTA format\n"; |
| 119 |
} |
| 120 |
@@ -61,14 +96,14 @@ |
| 121 |
|
| 122 |
$seqs = get_afasta(@data); |
| 123 |
|
| 124 |
-print "What should appear below is the result of running COILS three \n"; |
| 125 |
-print "times with windows of 14,21 & 28.\n`frame' denotes the predicted \n"; |
| 126 |
-print "position of the heptad repeat for the highest scoring window that \n"; |
| 127 |
-print "overlaps each position.\n`prob' gives a single integer value \n"; |
| 128 |
-print "representation of P (where 0-9 covers the range 0.0-1.0)\n"; |
| 129 |
-print "This will be repeated for each sequence \n\n\n"; |
| 130 |
+#print "What should appear below is the result of running COILS three \n"; |
| 131 |
+#print "times with windows of 14,21 & 28.\n`frame' denotes the predicted \n"; |
| 132 |
+#print "position of the heptad repeat for the highest scoring window that \n"; |
| 133 |
+#print "overlaps each position.\n`prob' gives a single integer value \n"; |
| 134 |
+#print "representation of P (where 0-9 covers the range 0.0-1.0)\n"; |
| 135 |
+#print "This will be repeated for each sequence \n\n\n"; |
| 136 |
|
| 137 |
-print "A total of $seqs->{nseq} sequences found in $seqfile\n\n\n"; |
| 138 |
+#print "A total of $seqs->{nseq} sequences found in $seqfile\n\n\n"; |
| 139 |
for($n=0; $n<$seqs->{nseq}; ++$n) { |
| 140 |
$id = $seqs->{list}[$n]; |
| 141 |
$in_seq = $seqs->{ids}{$id}{seq}; |
| 142 |
@@ -76,7 +111,8 @@ |
| 143 |
# print "ID $id seq $seq\n"; |
| 144 |
|
| 145 |
&write_fasta($seqfile,$id,$in_seq); |
| 146 |
- |
| 147 |
+ @result = (); |
| 148 |
+ push @result, ">$id\n\n"; |
| 149 |
if($mode eq "threewin") { |
| 150 |
# Runs threewin style mode |
| 151 |
# Three windows 14,21,28 |
| 152 |
@@ -94,7 +130,10 @@ |
| 153 |
for($i=14; $i<=28; $i+=7) { |
| 154 |
$j=($i-14)/7; |
| 155 |
$command = $coils_exec . $extra . " -win " . $i . " < " . $seqfile; |
| 156 |
-# print "Command is $command\n"; |
| 157 |
+ if ( $i == 28 ) { |
| 158 |
+ open (RAW,">$fileRaw") or die "cannot write to $fileRaw:$!"; |
| 159 |
+ } |
| 160 |
+ if($dbg){ cluck("Command is $command"); } |
| 161 |
open(IN,"$command|"); |
| 162 |
|
| 163 |
$fid = "frame-" . $i; |
| 164 |
@@ -107,7 +146,18 @@ |
| 165 |
|
| 166 |
$p=0; |
| 167 |
while(<IN>) { |
| 168 |
- if(!/sequences/) { |
| 169 |
+ if ( $i == 28 ) { # print the raw file if window is 28 |
| 170 |
+ print RAW $_; |
| 171 |
+ } |
| 172 |
+ if ( /^\#/ ) { |
| 173 |
+ chomp($result = $_); |
| 174 |
+ $result =~ s/.*aas//; |
| 175 |
+ $result =~ s/in coil\s*//g; |
| 176 |
+ $result = "window size = $i ".$result." residues in coiled coil". |
| 177 |
+ " domain\n"; |
| 178 |
+ push @result, $result; |
| 179 |
+ next; |
| 180 |
+ } else { |
| 181 |
$_ =~ s/^ *//; |
| 182 |
@t=split(/ +/); |
| 183 |
$align->{ids}{$fid}{seq} .= $t[2]; |
| 184 |
@@ -118,18 +168,22 @@ |
| 185 |
else { $sP = substr($P,0,1); } |
| 186 |
if($sP eq "0") { $sP = "-"; } |
| 187 |
$align->{ids}{$pid}{seq} .= $sP; |
| 188 |
- } else { |
| 189 |
- print; |
| 190 |
} |
| 191 |
} |
| 192 |
close(IN); |
| 193 |
} |
| 194 |
- write_clustal($align,"-"); |
| 195 |
- } |
| 196 |
-} |
| 197 |
-#unlink $seqfile; |
| 198 |
+ |
| 199 |
+ |
| 200 |
+ if ( defined($outfile)) { # Write output to file |
| 201 |
+ write_clustal($align,\@result, $outfile); |
| 202 |
+ } else { |
| 203 |
+ write_clustal($align,\@result, "-"); |
| 204 |
+ } |
| 205 |
+ } |
| 206 |
+} |
| 207 |
+unlink $seqfile; |
| 208 |
|
| 209 |
-exit; |
| 210 |
+exit(0); |
| 211 |
|
| 212 |
sub write_fasta { |
| 213 |
my($fn,$id,$seq) = @_; |
| 214 |
@@ -139,7 +193,7 @@ |
| 215 |
while($i<length($seq)) { |
| 216 |
$aa = substr($seq,$i,1); |
| 217 |
print SEQ $aa; |
| 218 |
- if((($i+1)%60)==0){ print SEQ "\n" } |
| 219 |
+ if((($i+1)%50)==0){ print SEQ "\n" } |
| 220 |
$i++; |
| 221 |
} |
| 222 |
print SEQ "\n"; |
| 223 |
@@ -150,12 +204,14 @@ |
| 224 |
my($align) = $_[0]; |
| 225 |
my($i,$j,$k,$id); |
| 226 |
|
| 227 |
- my($outfile) = $_[1]; |
| 228 |
+ my($header)= $_[1]; |
| 229 |
+ my($outfile) = $_[2]; |
| 230 |
open(OUT,">$outfile") || die "Error opening output file $outfile\n"; |
| 231 |
|
| 232 |
- |
| 233 |
- |
| 234 |
# print OUT "CLUSTAL W(1.60) multiple sequence alignment\n\n"; |
| 235 |
+ |
| 236 |
+ print OUT @$header; |
| 237 |
+ print OUT "\n"; |
| 238 |
|
| 239 |
foreach $id (keys %{$align->{ids}}) { |
| 240 |
if(defined($align->{ids}{$id}{start})) { |
| 241 |
@@ -164,24 +220,44 @@ |
| 242 |
$align->{ids}{$id}{newid} .= $align->{ids}{$id}{ranges}; |
| 243 |
} |
| 244 |
} else { |
| 245 |
- $align->{ids}{$id}{newid} = $id; |
| 246 |
- } |
| 247 |
- } |
| 248 |
- $i=0; |
| 249 |
- while($i<$align->{alen}) { |
| 250 |
- for($k=0; $k<$align->{nseq}; ++$k) { |
| 251 |
- $id = $align->{list}[$k]; |
| 252 |
- printf(OUT "%-10s ",$align->{ids}{$id}{newid}); |
| 253 |
- for($j=0; $j<60; ++$j) { |
| 254 |
- last if(($i+$j)>=$align->{alen}); |
| 255 |
- print OUT substr($align->{ids}{$id}{seq},($i+$j),1); |
| 256 |
- } |
| 257 |
- printf(OUT "\n"); |
| 258 |
- } |
| 259 |
- $i+=60; |
| 260 |
- printf(OUT "\n"); |
| 261 |
+ if ( $id !~ /frame/ and $id !~ /prob/) { |
| 262 |
+ $align->{ids}{$id}{newid} = "seq"; |
| 263 |
+ } else { |
| 264 |
+ $align->{ids}{$id}{newid} = $id; |
| 265 |
+ } |
| 266 |
+ } # |
| 267 |
+ } |
| 268 |
+ # |
| 269 |
+ $i=0; |
| 270 |
+ |
| 271 |
+ while($i<$align->{alen}) { |
| 272 |
+ printf OUT "%-10s ", ' '; |
| 273 |
+ for ($z = 1; $z <=50; $z++) { |
| 274 |
+ if ($z == 50) { |
| 275 |
+ print OUT ($i+50)/10 ; |
| 276 |
+ } elsif ($z % 10 == 0) { |
| 277 |
+ print OUT ":"; |
| 278 |
+ } elsif ($z % 5 == 0) { |
| 279 |
+ print OUT "."; |
| 280 |
+ } else { |
| 281 |
+ print OUT " "; |
| 282 |
+ } |
| 283 |
+ } |
| 284 |
+ print OUT "\n"; |
| 285 |
+ |
| 286 |
+ for($k=0; $k<$align->{nseq}; ++$k) { |
| 287 |
+ $id = $align->{list}[$k]; |
| 288 |
+ printf(OUT "%-10s ",$align->{ids}{$id}{newid}); |
| 289 |
+ for($j=0; $j<50; ++$j) { |
| 290 |
+ last if(($i+$j)>=$align->{alen}); |
| 291 |
+ print OUT substr($align->{ids}{$id}{seq},($i+$j),1); |
| 292 |
+ } |
| 293 |
+ print OUT "\n"; |
| 294 |
+ } |
| 295 |
+ $i+=50; |
| 296 |
} |
| 297 |
- close(OUT); |
| 298 |
+ print OUT "// End\n\n"; |
| 299 |
+ close OUT; |
| 300 |
} |
| 301 |
|
| 302 |
sub get_afasta { |
| 303 |
@@ -222,7 +298,7 @@ |
| 304 |
if(defined($align->{ids}{$label})) { |
| 305 |
$_ =~ s/-/ /g; |
| 306 |
$align->{ids}{$label}{seq} .= $_; |
| 307 |
- print "Adding $_ to $label\n"; |
| 308 |
+# print "Adding $_ to $label\n"; |
| 309 |
} |
| 310 |
} |
| 311 |
} |
| 312 |
@@ -233,6 +309,7 @@ |
| 313 |
} |
| 314 |
|
| 315 |
sub read_align { # Just read in text and modify format if necessary |
| 316 |
+ #( $fastafile, \$type ) |
| 317 |
|
| 318 |
# |
| 319 |
# Likely format is determined by looking for signs of one format over another |
| 320 |
@@ -255,7 +332,7 @@ |
| 321 |
my($file) = $_[0]; |
| 322 |
my(@data); |
| 323 |
my($i,$type); |
| 324 |
- my($winner,$highest); |
| 325 |
+ my($winner,$highest) = ('x', 0); |
| 326 |
|
| 327 |
@data=(); |
| 328 |
|
| 329 |
@@ -268,18 +345,19 @@ |
| 330 |
|
| 331 |
for($i=0; $i<=$#data; ++$i) { |
| 332 |
$_ = $data[$i]; |
| 333 |
- if(($i==0) && ($_ =~ / *[0-9]+ +[0-9]+ */)) { $votes{"y"}+=1000; } |
| 334 |
+ if( $file =~ /\.fa(sta)?$/oi ){ $votes{"f"}+=1000; last; } |
| 335 |
+ elsif(($i==0) && ($_ =~ / *[0-9]+ +[0-9]+ */)) { $votes{"y"}+=1000; } |
| 336 |
+ elsif(($i==0) && ($_ =~ /^>/o) && $data[1] && $data[1] =~ /^[a-z]/io ) { $votes{"f"}+=10; } |
| 337 |
elsif(($_ =~ /^ *Name:/) || ($_ =~ /pileUp/) || ($_ =~ /MSF.*Check.*\.\./)) { $votes{"m"}++; last; } |
| 338 |
elsif($_ =~ /^CLUSTAL/) { $votes{"c"}+=10; last; } |
| 339 |
elsif($_ =~ /^>P1;/) { $votes{"p"}+=10; last; } |
| 340 |
- elsif($_ =~ /HMMER/) { $votes{"h"}+=10; last; } |
| 341 |
+ elsif($_ =~ /HMMER/o && $data[0] !~ /^>/o) { $votes{"h"}+=10; last; } |
| 342 |
elsif(($_ =~ /^#=SQ/) || ($_ =~ /^#=RF/)) { $votes{"h"}++; } |
| 343 |
elsif($_ =~ /^>/) { $votes{"f"}++; $votes{"b"}++; } |
| 344 |
elsif($_ =~ /^ *\* iteration [0-9]*/) { $votes{"b"}++; $block_start++; } |
| 345 |
elsif($_ =~ /^ *\*/) { $votes{"b"}++; $block_end++; } |
| 346 |
elsif(($_ =~ /^ID /) || ($_ =~ /^CC /) || ($_ =~ /^AC /) || ($_ =~ /^SE /)) { $votes{"s"}++; } |
| 347 |
elsif(($_ =~ /^HSSP .*HOMOLOGY DERIVED SECONDARY STRUCTURE OF PROTEINS/)) { $votes{"e"}+=1000; } |
| 348 |
- |
| 349 |
} |
| 350 |
|
| 351 |
# Block and FASTA are quite hard to tell apart in a quick parse, |
| 352 |
@@ -289,14 +367,12 @@ |
| 353 |
if($block_end==0) { $votes{"f"}++; } |
| 354 |
} |
| 355 |
|
| 356 |
- $winner = "x"; |
| 357 |
- $highest = 0; |
| 358 |
foreach $type (keys %votes) { |
| 359 |
# print $type," ", $votes{$type},"\n"; |
| 360 |
if($votes{$type}>$highest) { $winner = $type; $highest = $votes{$type}; } |
| 361 |
} |
| 362 |
-# print "File is apparently of type $winner\n"; |
| 363 |
- $_[1] = $winner; |
| 364 |
+ if( $dbg ){ warn( "File is apparently of type $winner" ); } |
| 365 |
+ ${$_[1]} = $winner; |
| 366 |
return @data; |
| 367 |
} |
| 368 |
sub get_print_string { |
| 369 |
@@ -311,3 +387,5 @@ |
| 370 |
} |
| 371 |
return $max_len; |
| 372 |
} |
| 373 |
+ |
| 374 |
+# vim:et:ai: |
| 375 |
--- a/ncoils.c |
| 376 |
+++ b/ncoils.c |
| 377 |
@@ -1,4 +1,5 @@ |
| 378 |
#include <ncoils.h> |
| 379 |
+#include <string.h> |
| 380 |
|
| 381 |
/* Copyright (c) 2002 Robert B. Russell |
| 382 |
* EMBL, Meyerhofstrasse 1, 69917 Heidelberg, Germany |
| 383 |
@@ -22,16 +23,19 @@ |
| 384 |
|
| 385 |
|
| 386 |
/* Rob Russell's attempt to make a COILS program */ |
| 387 |
+#ifndef __PKGDATADIR__ |
| 388 |
+#define __PKGDATADIR__ "" |
| 389 |
+#endif |
| 390 |
|
| 391 |
-main(int argc, char *argv[]) { |
| 392 |
+int main(int argc, char *argv[]) { |
| 393 |
|
| 394 |
- int i,j,k,l; |
| 395 |
+ int i,j; |
| 396 |
int verb; |
| 397 |
int window,pt; |
| 398 |
int which,weighted; |
| 399 |
int nseq; |
| 400 |
int t,tc; |
| 401 |
- int seqlen; |
| 402 |
+ int seqlen = 0; |
| 403 |
int mode; |
| 404 |
int min_seg; |
| 405 |
|
| 406 |
@@ -39,7 +43,8 @@ |
| 407 |
char heptfile[HEPTFILELENGTH]; |
| 408 |
char *buff; |
| 409 |
static char *env; |
| 410 |
- char *seq,*title,*ident; |
| 411 |
+ char *seq = NULL; |
| 412 |
+ char *title,*ident; |
| 413 |
|
| 414 |
float min_P; |
| 415 |
|
| 416 |
@@ -55,10 +60,10 @@ |
| 417 |
mode = 0; /* 0 = column mode, 1 = fasta, 2 = concise */ |
| 418 |
min_P = 0.5; |
| 419 |
|
| 420 |
- if((env=getenv("COILSDIR"))==NULL) { |
| 421 |
+ if((env=getenv("COILSDIR"))==NULL) env = __PKGDATADIR__; |
| 422 |
+ |
| 423 |
+ if( env[0] == 0 ){ // empty string |
| 424 |
fprintf(stderr,"error: environment variable COILSDIR must be set\n"); |
| 425 |
- fprintf(stderr," Assuming /usr/share/ncoils\n"); |
| 426 |
- env=strdup("/usr/share/ncoils"); // a little leak, tolerated as singleton |
| 427 |
exit(-1); |
| 428 |
} |
| 429 |
|
| 430 |
@@ -67,19 +72,19 @@ |
| 431 |
|
| 432 |
|
| 433 |
for(i=1; i<argc; ++i) { |
| 434 |
- if(argv[i][0]!='-') exit_error(); |
| 435 |
+ if(argv[i][0]!='-') exit_error( env ); |
| 436 |
if(strcmp(&argv[i][1],"m")==0) { |
| 437 |
- if((i+1)>=argc) exit_error(); |
| 438 |
+ if((i+1)>=argc) exit_error( env ); |
| 439 |
strncpy(&heptfile[0],argv[i+1],HEPTFILELENGTH-1); |
| 440 |
i++; |
| 441 |
} else if(strcmp(&argv[i][1],"win")==0) { |
| 442 |
- if((i+1)>=argc) exit_error(); |
| 443 |
+ if((i+1)>=argc) exit_error( env ); |
| 444 |
sscanf(argv[i+1],"%d",&window); |
| 445 |
i++; |
| 446 |
} else if(strcmp(&argv[i][1],"c")==0) { |
| 447 |
mode=2; |
| 448 |
} else if(strcmp(&argv[i][1],"min_seg")==0) { |
| 449 |
- if((i+1)>=argc) exit_error(); |
| 450 |
+ if((i+1)>=argc) exit_error( env ); |
| 451 |
sscanf(argv[i+1],"%d",&min_seg); |
| 452 |
i++; |
| 453 |
} else if(strcmp(&argv[i][1],"c")==0) { |
| 454 |
@@ -87,18 +92,18 @@ |
| 455 |
} else if((strcmp(&argv[i][1],"f")==0) || (strcmp(&argv[i][1],"fasta")==0)) { |
| 456 |
mode=1; |
| 457 |
} else if((strcmp(&argv[i][1],"min_P")==0)) { |
| 458 |
- if((i+1)>=argc) exit_error(); |
| 459 |
+ if((i+1)>=argc) exit_error( env ); |
| 460 |
sscanf(argv[i+1],"%f",&min_P); |
| 461 |
i++; |
| 462 |
} else if(strcmp(&argv[i][1],"help")==0) { |
| 463 |
- exit_error(); |
| 464 |
+ exit_error( env ); |
| 465 |
} else if(strcmp(&argv[i][1],"w")==0) { |
| 466 |
weighted=1; |
| 467 |
} else if(strcmp(&argv[i][1],"V")==0 || strcmp(&argv[i][1],"v")==0) { |
| 468 |
verb=1; |
| 469 |
} else { |
| 470 |
fprintf(stderr," can't understand flag/field %s\n",argv[i]); |
| 471 |
- exit_error(); |
| 472 |
+ exit_error( env ); |
| 473 |
} |
| 474 |
} |
| 475 |
|
| 476 |
@@ -175,14 +180,14 @@ |
| 477 |
pred_coils(seq,ident,title,h,window,which,weighted,mode,min_P,&t,&tc,min_seg); |
| 478 |
free(seq); |
| 479 |
} |
| 480 |
- fprintf(stderr,"%8d sequences %8d aas %8d in coil\n",nseq,t,tc); |
| 481 |
+ if( verb ) fprintf(stderr,"%8d sequences %8d aas %8d in coil\n",nseq,t,tc); |
| 482 |
free(title); free(ident); |
| 483 |
|
| 484 |
exit(0); |
| 485 |
|
| 486 |
} |
| 487 |
|
| 488 |
-void exit_error() { |
| 489 |
+void exit_error( const char* __coilsdir ) { |
| 490 |
fprintf(stderr,"format: ncoils [options] < [sequence file]\n"); |
| 491 |
fprintf(stderr," -f or -fasta [fasta output - coils as 'x', like '-x' in seg]\n"); |
| 492 |
fprintf(stderr," -c [concise mode - which sequences have any coils (and how many)]\n"); |
| 493 |
@@ -191,7 +196,7 @@ |
| 494 |
fprintf(stderr," -win <int> [window size; DEFAULT = 21]\n"); |
| 495 |
fprintf(stderr," -w [weight heptad positions a&d the same as b,c,e,f,g]\n"); |
| 496 |
fprintf(stderr," -v [verbose/debug mode - print extra junk]\n"); |
| 497 |
- fprintf(stderr," -max_seq_len <int> [longest sequence tolerated; DEFAULT = 100 000]\n"); |
| 498 |
+ fprintf(stderr,"Effective COILSDIR: %s\n", __coilsdir ); |
| 499 |
fprintf(stderr,"\n"); |
| 500 |
fprintf(stderr,"NCOILS, Rob Russell and Andrei Lupas, 1999\n"); |
| 501 |
fprintf(stderr," based on Lupas, Van Dyck & Stock (1991) Science 252,1162-1164\n"); |
| 502 |
@@ -206,7 +211,6 @@ |
| 503 |
|
| 504 |
int i,j; |
| 505 |
int len,pos,aa_pt; |
| 506 |
- int pt; |
| 507 |
int total_coil_segments; |
| 508 |
int are_there_coils; |
| 509 |
|
| 510 |
--- /dev/null |
| 511 |
+++ b/coils-wrap.pod |
| 512 |
@@ -0,0 +1,77 @@ |
| 513 |
+=head1 NAME |
| 514 |
+ |
| 515 |
+coils-wrap - runs ncoils three times to give you a three-window output |
| 516 |
+ |
| 517 |
+=head1 SYNOPSIS |
| 518 |
+ |
| 519 |
+coils-wrap [OPTION] |
| 520 |
+ |
| 521 |
+=head1 DESCRIPTION |
| 522 |
+ |
| 523 |
+coils-wrap runs ncoils three times to give you a three-window output. |
| 524 |
+ |
| 525 |
+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. |
| 526 |
+ |
| 527 |
+=head1 OPTIONS |
| 528 |
+ |
| 529 |
+=over |
| 530 |
+ |
| 531 |
+=item -i |
| 532 |
+ |
| 533 |
+input file in FASTA format |
| 534 |
+ |
| 535 |
+=item -o |
| 536 |
+ |
| 537 |
+output file |
| 538 |
+ |
| 539 |
+=item -r |
| 540 |
+ |
| 541 |
+raw output file, default: `<output file>_raw' |
| 542 |
+ |
| 543 |
+=item -m |
| 544 |
+ |
| 545 |
+matrix type; set matrix (MTK or MTIDK) |
| 546 |
+ |
| 547 |
+=item -w |
| 548 |
+ |
| 549 |
+weight a&d = b,c,e,f&g (boolean) |
| 550 |
+ |
| 551 |
+=back |
| 552 |
+ |
| 553 |
+=head1 EXAMPLES |
| 554 |
+ |
| 555 |
+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> |
| 556 |
+ |
| 557 |
+C<ncoils -win 14 < /usr/share/doc/ncoils/1srya.fa> |
| 558 |
+ |
| 559 |
+=head1 FILES |
| 560 |
+ |
| 561 |
+=over |
| 562 |
+ |
| 563 |
+=item F</usr/share/coiledcoils/*.mat> |
| 564 |
+ |
| 565 |
+matrix data files |
| 566 |
+ |
| 567 |
+=back |
| 568 |
+ |
| 569 |
+=head1 AUTHOR |
| 570 |
+ |
| 571 |
+R.B. Russell, A.N. Lupas, 1999 |
| 572 |
+ |
| 573 |
+=head1 COPYRIGHT AND LICENSE |
| 574 |
+ |
| 575 |
+GPL |
| 576 |
+ |
| 577 |
+Based on Lupas, Van Dyck & Stock (1991) Science 252,1162-1164 |
| 578 |
+ |
| 579 |
+=head1 SEE ALSO |
| 580 |
+ |
| 581 |
+L<ncoils(1)>, L</usr/share/doc/coils/README>, L<http://www.russelllab.org/cgi-bin/coils/coils-svr.pl> |
| 582 |
+ |
| 583 |
+=over |
| 584 |
+ |
| 585 |
+=item A Lupas: Prediction and Analysis of Coiled-Coil Structures. Methods in Enzymology, 266, 513-525, 1996 |
| 586 |
+ |
| 587 |
+=item A. Lupas, M. Van Dyke, and J. Stock: Predicting coiled coils from protein sequences. Science, 252, 1162-1164, 1991 |
| 588 |
+ |
| 589 |
+=back |
| 590 |
--- /dev/null |
| 591 |
+++ b/ncoils.pod |
| 592 |
@@ -0,0 +1,89 @@ |
| 593 |
+=head1 NAME |
| 594 |
+ |
| 595 |
+ncoils - prediction of coiled-coil secondary structure elements |
| 596 |
+ |
| 597 |
+=head1 SYNOPSIS |
| 598 |
+ |
| 599 |
+ncoils [OPTION] < [FASTA FILE] |
| 600 |
+ |
| 601 |
+ncoils -f < /usr/share/doc/ncoils/1srya.fa |
| 602 |
+ |
| 603 |
+=head1 DESCRIPTION |
| 604 |
+ |
| 605 |
+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. |
| 606 |
+ |
| 607 |
+=head1 OPTIONS |
| 608 |
+ |
| 609 |
+=over |
| 610 |
+ |
| 611 |
+=item -f, -fasta |
| 612 |
+ |
| 613 |
+fasta output - coils as 'x', like '-x' in seg |
| 614 |
+ |
| 615 |
+=item -c |
| 616 |
+ |
| 617 |
+concise mode - which sequences have any coils (and how many) |
| 618 |
+ |
| 619 |
+=item -min_seg <int> |
| 620 |
+ |
| 621 |
+for concise mode - only report sequence if >= min coil segments |
| 622 |
+ |
| 623 |
+=item -min_P <float> |
| 624 |
+ |
| 625 |
+minimum P to define coil segment; DEFAULT = 0.5 |
| 626 |
+ |
| 627 |
+=item -win <int> |
| 628 |
+ |
| 629 |
+window size; DEFAULT = 21 |
| 630 |
+ |
| 631 |
+=item -w |
| 632 |
+ |
| 633 |
+weight heptad positions a&d the same as b,c,e,f,g |
| 634 |
+ |
| 635 |
+=item -v |
| 636 |
+ |
| 637 |
+verbose/debug mode - print extra junk |
| 638 |
+ |
| 639 |
+=back |
| 640 |
+ |
| 641 |
+=head1 EXAMPLES |
| 642 |
+ |
| 643 |
+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> |
| 644 |
+ |
| 645 |
+C<ncoils -win 14 < /usr/share/doc/ncoils/1srya.fa> |
| 646 |
+ |
| 647 |
+=head1 ENVIRONMENT |
| 648 |
+ |
| 649 |
+COILSDIR - specifies the directory containing the file new.mat overriding the default F</usr/share/ncoils> |
| 650 |
+ |
| 651 |
+=head1 FILES |
| 652 |
+ |
| 653 |
+=over |
| 654 |
+ |
| 655 |
+=item F</usr/share/ncoils/*.mat> |
| 656 |
+ |
| 657 |
+matrix data files |
| 658 |
+ |
| 659 |
+=back |
| 660 |
+ |
| 661 |
+=head1 AUTHOR |
| 662 |
+ |
| 663 |
+R.B. Russell, A.N. Lupas |
| 664 |
+ |
| 665 |
+=head1 COPYRIGHT AND LICENSE |
| 666 |
+ |
| 667 |
+GPL |
| 668 |
+ |
| 669 |
+Based on Lupas, Van Dyck & Stock (1991) Science 252,1162-1164 |
| 670 |
+ |
| 671 |
+=head1 SEE ALSO |
| 672 |
+ |
| 673 |
+L<coils-wrap(1)>, L</usr/share/doc/coils/README>, L<http://www.russelllab.org/cgi-bin/coils/coils-svr.pl> |
| 674 |
+ |
| 675 |
+=over |
| 676 |
+ |
| 677 |
+=item A Lupas: Prediction and Analysis of Coiled-Coil Structures. Methods in Enzymology, 266, 513-525, 1996 |
| 678 |
+ |
| 679 |
+=item A. Lupas, M. Van Dyke, and J. Stock: Predicting coiled coils from protein sequences. Science, 252, 1162-1164, 1991 |
| 680 |
+ |
| 681 |
+=back |
| 682 |
--- a/ncoils.h |
| 683 |
+++ b/ncoils.h |
| 684 |
@@ -1,7 +1,6 @@ |
| 685 |
#include <stdio.h> |
| 686 |
#include <stdlib.h> |
| 687 |
#include <math.h> |
| 688 |
-#include <string.h> |
| 689 |
|
| 690 |
#define AAs "A_CDEFGHI_KLMN_PQRST_VW_Y_" |
| 691 |
#define PI 3.1415 |
| 692 |
@@ -25,6 +24,6 @@ |
| 693 |
|
| 694 |
|
| 695 |
struct hept_pref *read_matrix(FILE *MAT); |
| 696 |
-void exit_error(); |
| 697 |
+void exit_error(const char*); |
| 698 |
void pred_coils(char *seq,char *ident,char *title,struct hept_pref *h,int win,int which, |
| 699 |
int weighted,int fasta,float min_P, int *t, int *tc, int min_segs); |
| 700 |
--- a/read_matrix.c |
| 701 |
+++ b/read_matrix.c |
| 702 |
@@ -1,4 +1,5 @@ |
| 703 |
#include <ncoils.h> |
| 704 |
+#include <string.h> |
| 705 |
|
| 706 |
/* Copyright (c) 2002 Robert B. Russell |
| 707 |
* EMBL, Meyerhofstrasse 1, 69917 Heidelberg, Germany |