-
Notifications
You must be signed in to change notification settings - Fork 0
/
add_name_parent_gff3.pl
44 lines (37 loc) · 1.07 KB
/
add_name_parent_gff3.pl
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
39
40
41
42
43
44
#!/usr/bin/perl
use strict;
use warnings;
open(IN,"$ARGV[0]") or die "$!";
open(OUT,">$ARGV[1]");
#open(OUT1,">$ARGV[2]");
my $count=0;
my $count1=0;
while(<IN>){
chomp;
if(/^\#/){
print OUT $_,"\n";
next;
}
if($_ =~/gene/){
$count=split /\;/,(split /\t/,$_)[-1];
if($count == 1){
my $id=(split /\=/,(split /\t/,$_)[-1])[1];
print OUT $_,";","Name=$id","\n";
next;
}
#my $id_1=(split /\;/,(split /\t/,$_)[-1])[0];
#print OUT1 $id_1,"\n";
}
if($_ =~/mRNA/){
$count1=split /\;/,(split /\t/,$_)[-1];
if($count1==1){
my $id=(split /\=/,(split /\t/,$_)[-1])[1];
print OUT $_,";","Parent=$id","\n";
next;
}
}
print OUT $_,"\n";
}
close IN;
close OUT;
#close OUT1;