File: Sub.pl

package info (click to toggle)
ampliconnoise 1.29-10
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 6,040 kB
  • sloc: ansic: 18,080; sh: 2,899; perl: 2,089; makefile: 235
file content (36 lines) | stat: -rwxr-xr-x 538 bytes parent folder | download | duplicates (8)
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
35
36
#!/usr/bin/perl

$fastaFile = $ARGV[0];

$ucFile = $ARGV[1];

open(FILE, $fastaFile) or die "Can't open $fastaFile\n";
my $count = 0;
my %hashID = {};
while($line = <FILE>){
	chomp($line);

	if($line=~/>(.*)/){
		$hashID{$1} = $count;
		$count++;
	}
}

close(FILE);

open(FILE, $ucFile) or die "Can't open $ucFile\n";

while($line = <FILE>){
        chomp($line);
	
	my @tokens = split(/\t/,$line);
	my $id = $tokens[8];
	my $nid = $hashID{$id};

	$tokens[8] = $nid;
	my $string = join("\t",@tokens);
	print "$string\n";
}

close(FILE);