File: rev_seq.pl

package info (click to toggle)
wtdbg2 2.5-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 119,728 kB
  • sloc: ansic: 27,655; perl: 1,212; makefile: 125; sh: 83
file content (34 lines) | stat: -rwxr-xr-x 371 bytes parent folder | download | duplicates (4)
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
29
30
31
32
33
34
#!/usr/bin/perl -w
#
#AUthor: Ruan Jue
#
use strict;

my $seq = shift;

if($seq){
	rev_seq($seq);
} else {
	$seq = '';
	while(<>){
		if(/^>/){
			&rev_seq($seq);
			print; next;
			$seq = '';
		}
		chomp;
		$seq .= $_;
	}
	&rev_seq($seq);
}

1;

sub rev_seq {
	my $s = shift;
	$s =~tr/ACGTacgt/TGCAtgca/;
	$s = reverse $s;
	while($s=~/(.{1,100})/g){
		print "$1\n";
	}
}