comparison snpEff_2_1a/scripts/fasta2tab.pl @ 0:f8eaa3f8194b default tip

Uploaded snpEff_v2_1a_core.tgz from Pablo Cingolani
author greg
date Fri, 20 Apr 2012 14:47:09 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f8eaa3f8194b
1 #!/usr/bin/perl
2
3 #------------------------------------------------------------------------------
4 # Split a fasta file (create one file per sequence)
5 #
6 #
7 #------------------------------------------------------------------------------
8
9 use strict;
10
11 #------------------------------------------------------------------------------
12 # Main
13 #------------------------------------------------------------------------------
14
15 my($seq, $name) = ('', '');
16 my($lineNum, $l, $newName);
17 #---
18 # Read fasta file
19 #---
20 for($lineNum=0 ; $l = <STDIN> ; $lineNum++ ) {
21 chomp $l;
22 if( $l =~/^>\s*(.*)\s*$/ ) {
23 $newName = $1;
24 if( $seq ne "" ) { print "$name\t$seq\n"; }
25 # New sequence
26 $name = $newName;
27 $seq = "";
28 } else { $seq .= $l; }
29 }
30
31 if( $seq ne "" ) { print "$name\t$seq\n"; }
32