Skip to content
Snippets Groups Projects
Commit e5d968a4 authored by Arne Stabenau's avatar Arne Stabenau
Browse files

new gene counts by biotype

parent 79f6bb10
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,22 @@ my $db = new Bio::EnsEMBL::DBSQL::DBAdaptor(-host => $host, ...@@ -22,6 +22,22 @@ my $db = new Bio::EnsEMBL::DBSQL::DBAdaptor(-host => $host,
-dbname => $dbname); -dbname => $dbname);
my %attrib_codes = ( 'miRNA' => 'miRNA',
'snRNA' => 'snRNA',
'snoRNA' => 'snoRNA',
'rRNA' => 'rRNA',
'tRNA' => 'tRNA',
'known protein_coding' => 'knwCod',
'misc_RNA' => 'mscRNA',
'novel protein_coding' => 'novCod',
'pseudogene' => 'pseudo',
'scRNA' => 'scRNA',
'Mt-tRNA' => 'MTtRNA',
'Mt-rRNA' => 'MTrRNA');
# do both genestats and snpstats by default # do both genestats and snpstats by default
$genestats = $snpstats = 1 if(!$genestats && !$snpstats); $genestats = $snpstats = 1 if(!$genestats && !$snpstats);
...@@ -69,39 +85,39 @@ foreach my $slice (@$top_slices) { ...@@ -69,39 +85,39 @@ foreach my $slice (@$top_slices) {
my @attribs; my @attribs;
if($genes_present) { if($genes_present) {
my $num_known_genes = 0; my %counts;
my $num_genes = 0; my $biotype;
my $num_pseudo_genes = 0;
my @genes = @{$slice->get_all_Genes()}; my @genes = @{$slice->get_all_Genes()};
foreach my $gene (@genes) { foreach my $gene (@genes) {
if($gene->type() =~ /pseudogene/i) { $biotype = $gene->biotype();
$num_pseudo_genes++; if( $biotype =~ /coding/i ) {
} else {
$num_genes++;
if($gene->is_known()) { if($gene->is_known()) {
$num_known_genes++; $biotype = "known ".$biotype;
} } else {
$biotype = "novel ".$biotype;
}
} }
}
push @attribs, Bio::EnsEMBL::Attribute->new
(-NAME => 'Gene Count',
-CODE => 'GeneCount',
-VALUE => $num_genes,
-DESCRIPTION => 'Total Number of Genes');
push @attribs, Bio::EnsEMBL::Attribute->new $counts{$biotype}++;
(-NAME => 'Known Gene Count', }
-CODE => 'KnownGeneCount',
-VALUE => $num_known_genes,
-DESCRIPTION => 'Total Number of Known Genes');
push @attribs, Bio::EnsEMBL::Attribute->new for my $biotype ( keys %counts ) {
(-NAME => 'PseudoGene Count', my $attrib_code = $attrib_codes{$biotype};
-CODE => 'PseudoGeneCount', if( !$attrib_code ) {
-VALUE => $num_pseudo_genes, print STDERR "Unspecified biotype \"$biotype\".\n";
-DESCRIPTION => 'Total Number of PseudoGenes'); next;
}
my $no_space = $biotype;
$no_space =~ s/ /_/g;
push @attribs, Bio::EnsEMBL::Attribute->new
(-NAME => $biotype.' Gene Count',
-CODE => 'GeneNo_'.$attrib_code,
-VALUE => $counts{$biotype},
-DESCRIPTION => 'Number of '.$biotype.' Genes');
}
} }
if( $snps_present ) { if( $snps_present ) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment