File: centrifuge-RemoveEmptySequence.pl

package info (click to toggle)
centrifuge 1.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 11,864 kB
  • sloc: cpp: 51,936; perl: 1,919; python: 1,538; makefile: 618; sh: 352
file content (28 lines) | stat: -rwxr-xr-x 411 bytes parent folder | 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
#!/usr/bin/env perl

# remove the headers with empty sequences. possible introduced by dustmask

use strict ;

# die "usage: a.pl < in.fa >out.fa"

my $tag ;
my @lines ;

$lines[0] = <> ;
$tag = 0 ;
while ( <> )
{
	$lines[1-$tag] = $_ ;
	if ( /^>/ && $lines[$tag] =~ /^>/ ) 
	{
		$tag = 1 - $tag ;
		next ;
	}
	print $lines[$tag] ;
	$tag = 1- $tag ;
}
if ( !( $lines[$tag] =~ /^>/ ) )
{
	print $lines[$tag] ;
}