JPRED-2 Initial commit of software for the Jpred website (some files excluded due...
[jpred.git] / websoft / bin / get1stfasta
diff --git a/websoft/bin/get1stfasta b/websoft/bin/get1stfasta
new file mode 100755 (executable)
index 0000000..17be49c
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+
+#
+# Returns the first sequence from a FASTA file
+#
+
+use warnings;
+
+if ($ARGV[0]) { open(IN, "<$ARGV[0]") or die($!); }
+else { *IN = *STDIN; }
+
+while (<IN>) {
+       if (/^>/) {
+               print $_;
+               while (<IN>) {
+                       if (/^>/) { exit(); }
+                       print $_;
+                       }
+               }
+       }