Thanks, that works very well to report CDS counts for each PACid. All 48 GFFs I parsed behaved OK, your script was super fast. Though the script does not report counts for all exons, and just the counts for all coding exons (right?),
I think the parsed output should be enough for me to test my hypothesis. Thanks again!
Parse GFF to infer numbers of all exons, and just coding exons per gene
Are there any tools that can parse GFF and report the numbers of all exons, as well as the numbers of just the coding exons, for each gene in the GFF for that species?
I am working on multiple plant species, not human or even mammalian.
If such tool(s) exist, could you help with details on which function and some example syntax, please? Thanks.
• 2,718 views
•
link
1 answer
Assuming well behaved GFF3 this perl code gets you there.
$ perl count_CDS.pl annotation.gff3
my %genes;
while(<>) {
chomp;
my @row = split(/\t/,$_);
next unless $row[2] eq 'CDS';
my %group = map { split(/=/,$_) } split(/;/,pop @row);
$genes{$group{Parent}}++;
}
#sorted by genes with the most number of CDS to least, though you could just sort by ID too
for my $gene ( sort { $genes{$b} <=> $genes{$a} } keys %genes ) {
print join("\t",$gene, $genes{$gene}), "\n";
}
• 0 views
•
link
• 0 views
•
link
yes I leave it as an exercise to the reader to add/replace the 'CDS' part with 'exon' above or modify the code to track both CDS and exon ...
• 0 views
•
link
Log in to answer this question.