File: extractTranscriptEnds.pl

package info (click to toggle)
augustus 3.4.0%2Bdfsg2-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 758,480 kB
  • sloc: cpp: 65,451; perl: 21,436; python: 3,927; ansic: 1,240; makefile: 1,032; sh: 189; javascript: 32
file content (28 lines) | stat: -rwxr-xr-x 507 bytes parent folder | download | duplicates (5)
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/perl

# extract transcript ends of a given length from a gene fasta file (no UTR)
# Katharina Hoff, 9.8.2011, katharina.hoff@gmail.com

my $n = 30;

my $seq;
my $seqLen;
my $i = 1;
while(<STDIN>){
    if($_=~m/^>/){
	$lenLen = length($seq);
	print ">seq".$i."\n";
	print substr($seq, $seqLen-30, 27)."\n";
	$seq = "";
	$i = $i+1;
    }else{
	chomp;
	$seq = $seq.$_;
    }
}

if(length($seq)>1){
    $lenLen = length($seq);
    print ">seq".$i."\n";
    print substr($seq, $seqLen-30, 30)."\n";
}