[Bioperl-guts-l] [16522] bioperl-live/trunk/Bio/Tools/GuessSeqFormat.pm: Add format guesser for crossbow format.

Dan Kortschak kortsch at dev.open-bio.org
Thu Dec 17 23:11:59 EST 2009


Revision: 16522
Author:   kortsch
Date:     2009-12-17 23:11:59 -0500 (Thu, 17 Dec 2009)
Log Message:
-----------
Add format guesser for crossbow format.

Modified Paths:
--------------
    bioperl-live/trunk/Bio/Tools/GuessSeqFormat.pm

Modified: bioperl-live/trunk/Bio/Tools/GuessSeqFormat.pm
===================================================================
--- bioperl-live/trunk/Bio/Tools/GuessSeqFormat.pm	2009-12-18 02:53:43 UTC (rev 16521)
+++ bioperl-live/trunk/Bio/Tools/GuessSeqFormat.pm	2009-12-18 04:11:59 UTC (rev 16522)
@@ -192,6 +192,10 @@
 
 Tab ("tab")
 
+=item *
+
+Crossbow ("crossbow")
+
 =back
 
 =head1 FEEDBACK
@@ -440,7 +444,8 @@
     selex       => { test => \&_possibly_selex      },
     stockholm   => { test => \&_possibly_stockholm  },
     swiss       => { test => \&_possibly_swiss      },
-    tab         => { test => \&_possibly_tab        }
+    tab         => { test => \&_possibly_tab        },
+    crossbow    => { test => \&_possibly_crossbow   }
 );
 
 sub guess
@@ -961,4 +966,18 @@
     return ($lineno == 1 && $line =~ /^[^\t]+\t[^\t]+/) ;
 }
 
+=head2 _possibly_crossbow
+
+Contributed by kortsch.
+
+=cut
+
+sub _possibly_crossbow
+{
+    my ($line, $lineno) = (shift, shift);
+    return ($line =~ /^[[:alnum:]]+(?:\t([[:alpha:]]+)\t([ -~]+))(?:\t([[:alpha:]]+)\t([ -~]+))?$/)
+            && length($1)==length($2) && (defined($3) ? length($3):0)==(defined($4) ? length($4):0);
+}
+
+
 1;



More information about the Bioperl-guts-l mailing list