forked from ion-beam-breeding/AMAP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddId.pl
More file actions
38 lines (32 loc) · 627 Bytes
/
addId.pl
File metadata and controls
38 lines (32 loc) · 627 Bytes
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
37
38
#!/usr/bin/perl
#
&help if (@ARGV != 1);
$num = 0;
open(IN,"<$ARGV[0]") or die;
while ($line = <IN>) {
chomp($line);
if ($line =~ /^#/) {
print STDOUT "$line\n";
} else {
$num ++;
$id = sprintf("ID%d",$num);
@element = split(/\t/,$line);
if ($element[2] eq ".") {
$element[2] = "None:$id";
} else {
$element[2] .= ":$id";
}
print STDOUT $element[0];
for($i=1; $i<@element; $i++) {
print STDOUT "\t$element[$i]";
}
print STDOUT "\n";
}
}
close IN;
exit(0);
### SUB : help
sub help {
print STDERR "USAGE: addId.pl read-0.snv.snp.vcf\n";
exit(-1);
}