Created
July 6, 2012 15:18
-
-
Save coela/3060817 to your computer and use it in GitHub Desktop.
hoge.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
use G; | |
my $eco = new G( "ecoli", "no msg" ); | |
my @cds; | |
for my $cds ($eco->cds()) { | |
for ($eco->{$cds}->{start} .. $eco->{$cds}->{end}) { | |
$cds[$_] = $cds; | |
} | |
} | |
my @cds_dir; | |
my @cds_compl; | |
foreach my $cds ( $eco->cds() ){ | |
if ( $eco->{$cds}->{direction} eq "direct" ) { | |
push @cds_dir, $cds; | |
} | |
else { | |
push @cds_compl, $cds; | |
} | |
} | |
print "gene\t", "count\t", "product\t", "function\n"; | |
my $hogehoge1; | |
my $hogehoge2; | |
my $cds_count = 0; | |
my $sd_count = 0; | |
my %direct_pos_to_oligomers = oligomer_search($eco->{SEQ}, "ggnggn", -return=>"both"); | |
foreach my $pos_d ( sort{$a <=> $b} keys %direct_pos_to_oligomers ) { | |
my $feature = $cds[$pos_d]; | |
if ( $feature ) { | |
$sd_count++; | |
my $gene = $eco->{$feature}->{gene}; | |
$hogehoge1->{$gene}->{gene_in} = $eco->{$feature}->{gene}; | |
$hogehoge1->{$gene}->{sd_count_in} = $sd_count; | |
$hogehoge1->{$gene}->{product_in} = $eco->{$feature}->{product}; | |
$hogehoge1->{$gene}->{function_in} = $eco->{$feature}->{function}; | |
} | |
} | |
my $cds_count_compl = 0; | |
my $cds_count_compl2 = 0; | |
my %compl_pos_to_oligomers = oligomer_search($eco->{SEQ}, "nccncc", -return=>"both"); | |
foreach my $pos_c ( sort{$a <=> $b} keys %compl_pos_to_oligomers ) { | |
my $feature3 = $cds[$pos_c]; | |
if ( $feature3 ) { | |
$sd_count++; | |
my $gene = $eco->{$feature3}->{gene}; | |
$hogehoge1->{$gene}->{gene_in} = $eco->{$feature3}->{gene}; | |
$hogehoge1->{$gene}->{sd_count_in} = $sd_count; | |
$hogehoge1->{$gene}->{product_in} = $eco->{$feature3}->{product}; | |
$hogehoge1->{$gene}->{function_in} = $eco->{$feature3}->{function}; | |
} | |
} | |
for my $gene ( keys %$hogehoge1 ) { | |
print join "\t", ($hogehoge1->{$gene}->{gene_in},$hogehoge1->{$gene}->{sd_count_in},$hogehoge1->{$gene}->{product_in},$hogehoge1->{$gene}->{function_in}); | |
print "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment