-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathevmFormatIsoSeq.pl
More file actions
executable file
·54 lines (50 loc) · 1 KB
/
evmFormatIsoSeq.pl
File metadata and controls
executable file
·54 lines (50 loc) · 1 KB
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
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env perl
#
# author = David Jebb, 2019
#
use warnings;
use strict ;
## Prior to runnign this script I ran this oneliner to do more work
## grep -P 'HLmyoMyo4_0{5}169' hq_transcripts.cds.gff3 \
## | gt gff3 -setsource isoseq -tidy - \
## | perl -ne '$l=$_;if ($l=~/\t(exon|CDS)\t/){$l=~s/Parent=gene/Parent=mRNA/;print $l}elsif($l=~/\tmRNA\t/){chomp $l;$l=~s/Parent=gene/Parent=mRNA/;\
## ($id)=$l=~/Parent=(\w+)/;$id=";ID=$id\n";print $l.$id}else{print $l}' > tmp
my $count ;
my $fh ;
if (scalar(@ARGV)>0){
open $fh, "<$ARGV[0]";
}
else{
$fh = *STDIN ;
}
while (<$fh>){
my $l = $_ ;
if ($l =~ /^##( |\w)/){
print $l
}
elsif ($l =~ /^###/){
$count = 0 ;
print $l
}
elsif ($l=~/\texon\t/){
$count++ ;
chomp $l ;
my ($id)=$l=~/Parent=(\w+)/ ;
$id =";ID=$id.$count" ;
print $l.$id."\n" ;
}
elsif ($l=~/\tCDS\t/){
chomp $l ;
if ($l=~/ID/){
print $l."\n"
}
else{
my ($num)=$l=~/Parent=mRNA(\d+)/ ;
my $id =";ID=CDS$num\n" ;
print $l.$id ;
}
}
else{
print $l ;
}
}