Skip to content

Instantly share code, notes, and snippets.

@coela
coela / gist:850403
Created March 2, 2011 03:12
Getting JSON data from Genomes Online Database
use 5.12.2;
use JSON;
use Data::Dumper;
use LWP::Simple;
my @json_places = (
['Complete' , "http://www.genomesonline.org/complete_published.json"],
['Bacteria Ongoing' , "http://www.genomesonline.org/bacterial_ongoing.json"],
['Eukaryal Ongoing' , "http://www.genomesonline.org/eukaryal_ongoing.json"],
['Archaeal Ongoing' , "http://www.genomesonline.org/archaeal_ongoing.json"],
['Metagenome' , "http://www.genomesonline.org/microbial.json"],
use G;
use 5.12.4;
my $gb = load('ecoli');
$gb->{$_}->{product} = '' for $gb->cds();
for ($gb->cds()){
my $l = length $gb->{$_}->{translation};
$gb->{$_}->{product} = 'ribosomal fucking protein' if $l >=500;
}
say Dumper w_value ($gb);
@coela
coela / gist:1208141
Created September 10, 2011 09:17
cal free energy
sub add_free_energy{
my $gb = shift;
for my $cds ($gb->feature('CDS')){
my $before = $gb->before_startcodon($cds,4);
my $after = substr ($gb->get_geneseq($cds), 0 , 30);
my $freeenergy = `echo "$after" | hybrid-ss-min --stream`;
chomp $freeenergy;
$gb->{$cds}->{'free_energy'} = $freeenergy;
}
return $gb;
@coela
coela / FurlPOST.pl
Created September 29, 2011 08:34
furl post
use Furl;
my $furl = Furl->new(
agent => 'MyGreatUA/2.0',
timeout => 10,
);
my %query = (
u => 'ebisama',
);
use 5.14.2;
use Data::Dumper;
my @array;
for (1..100) {
my $gene;
$gene->{tpi} = $_;
$gene->{start} = $_ * 100;
push @array,$gene;
@coela
coela / hoge.pl
Created July 4, 2012 09:44
hoge.pl
use strict;
print "hoge";
@coela
coela / hoge.pl
Created July 4, 2012 09:47
hoge.pl
use 5.14.2;
use warnings;
use Data::Dumper;
use SWISS::Entry;
use SWISS::IDs;
use JSON;
use GraphViz;
use GO::Parser;
use lib qw{../lib};
@coela
coela / hoge.pl
Created July 6, 2012 15:18
hoge.pl
#!/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()) {
@coela
coela / gist:3082638
Created July 10, 2012 10:50
hoge.pl
use strict;
use G;
use Data::Dumper;
my $gb = new G ("ecoli", "no msg");
open my $FILE, $ARGV[0] || die;
my $bunkatu = int (length ($gb->{SEQ}) /20);
cai($gb);
my @feature;
#!/usr/bin/perl
use strict;
use warnings;
use LWP::UserAgent;
use HTTP::Request::Common qw(POST);
my $referer = 'http://www.phosphosite.org/sequenceLogoAction.do';
my $url = 'http://www.phosphosite.org/sequenceLogoSubmitAction.do';