Bio::DB::MeSH move to its own distribution.
[bioperl-live.git] / examples / liveseq / change_gene.pl
blobd61cb1cfe6b05c1cf80f8c07cfaac3886fb39dc2
1 #!/usr/bin/perl
3 use strict;
4 use Bio::LiveSeq::IO::BioPerl;
5 use Bio::LiveSeq::Mutator;
6 use Bio::LiveSeq::Mutation;
7 use Bio::Variation::IO;
9 if ($#ARGV < 1) { # one argument input
10 print <<USAGE;
12 LiveSeq::Mutator example by Joseph Insana
14 Arguments: filename containing embl entry, gene_name
15 It will create that Bio::LiveSeq::Gene and print out some
16 basic informations about it.
17 It will then issue mutations and print results
19 Usage: change_gene.pl filename genename
21 Example: change_gene.pl ../../t/data/ar.embl AR
22 USAGE
23 exit;
24 } else {
26 my $filename=$ARGV[0];
27 my $loader=Bio::LiveSeq::IO::BioPerl->load(-file => "$filename");
29 my $gene_name=$ARGV[1];
30 my $gene=$loader->gene2liveseq(-gene_name => $gene_name,
31 -getswissprotinfo => 0);
33 print STDERR "Gene: ",$gene->name,"\n";
34 print STDERR " Moltype: ", $gene->get_DNA->alphabet, "\n";
35 print STDERR " Features:\n";
36 print STDERR $gene->printfeaturesnum();
37 print STDERR " Gene has boundaries ",$gene->upbound," - ",$gene->downbound,"\n";
38 print STDERR " Gene has maxtranscript with start ",$gene->maxtranscript->start,
39 " end ",$gene->maxtranscript->end," strand ",$gene->maxtranscript->strand,"\n";
40 print STDERR " DNA has boundaries ",$gene->get_DNA->start," - ",$gene->get_DNA->end,"\n";
41 print STDERR "\n";
43 print STDERR "Now issuing mutations to the gene....\n";
45 my $mutation = new Bio::LiveSeq::Mutation (-seq =>'A',
46 -pos => 64
48 my $mutate = Bio::LiveSeq::Mutator->new(-gene => $gene,
49 -numbering => "coding"
51 $mutate->add_Mutation($mutation);
52 my $results=$mutate->change_gene();
53 print "\n";
54 if ($results) {
55 my $out = Bio::Variation::IO->new( '-format' => 'flat');
56 $out->write($results);