Skip to content

Instantly share code, notes, and snippets.

@epaule
Last active October 8, 2021 15:55
Show Gist options
  • Save epaule/d342a92a0acd47cf26fd431eebb7f589 to your computer and use it in GitHub Desktop.
Save epaule/d342a92a0acd47cf26fd431eebb7f589 to your computer and use it in GitHub Desktop.
fix the braker GTF, so it can be used with htsseq
#!/usr/bin/env perl
while (<>){
chomp;
@F=split(/\s\s+/);
if ($F[2] eq 'gene'){
my $t = "gene_id \"$F[-1]\";";
$F[-1]=$t;
}elsif($F[2] eq 'transcript'){
my $t="transcript_id \"$F[-1]\";";
$F[-1]=~/(g\d+)\.t\d+/;
$t.=" gene_id \"$1\";";
$F[-1]=$t;
}
print join "\t",@F;
print "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment