注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

wangyufeng的博客

祝愿BB 健康开心快乐每一天

 
 
 

日志

 
 

Chromosome::Map---Generate GD images of chromosome maps  

2011-12-20 10:51:54|  分类: Perl & bioperl |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
The Chromosome::Map module can produce chromosomal map image file. It can be used to draw genetic or physical maps. Several tracks (i.e. list of marker) can be add to the chromosomal map: markers track and QTL interval region track (see synopsis). A code colors list is available at http://chicken.genouest.org/documentations/chromosomemap/#colors
#!/usr/bin/perl -w   # This script produce a chromosomal map with several markers and QTL  # interval region. A fake %GC content is added to the chromosome     use strict;   use Chromosome::Map;    my %H = (ADL120 => '25',            ADL035 => '5',            ADL034 => '4',            MCW014 => '110',            MCW123 => '89',            MCW340 => '70',            LEI456 => '132',            LEI451 => '130',            LEI452 => '130.5',            LEI453 => '130.7',            LEI454 => '131',            LEI455 => '131.4',            LEI457 => '132',            MCW087 => '50',            MCW012 => '12',            MCW051 => '51',            ADL121 => '26',            ADL123 => '27',            ADL122 => '26.2',            MCW114 => '45',            LEI258 => '15',            MCW240 => '45.1',            MCW247 => '110',            LEI556 => '44',            MCW614 => '45.2',            ADL067 => '5.3',            MCW140 => '45.2',            LEI056 => '45.6',           );     my $map = Chromosome::Map->new (-length     => '140',                                   -name       => 'GGA5',                                   -height     => '500',                                   -units      => 'cM',                                  );     my $size  = $map->get_map_size;   my $units = $map->get_map_units;     print "Map size: $size $units\n";    my $mark_track = Chromosome::Map::Track->new (-name => 'Markers',                                                -type => 'marker',                                               );  my $qtl_track  = Chromosome::Map::Track->new (-name => 'QTL',                                                -type => 'interval',                                               );  my $GC_track  = Chromosome::Map::Track->new  (-name    => '%GC content',                                                -type    => 'feature',                                                -display => 'relative',                                                -render  => 'gradient',                                               );  # adding tracks to map  $map->add_track($mark_track);  $map->add_track($qtl_track);  $map->add_track($GC_track);    my $nb_track = $map->get_nb_tracks;  print "Nb track: $nb_track\n";    # Generating a fake feature relative elements and add them in track  # only for illustrative purpose  my %GC;  for (my $i=0;$i<=5000;$i++) {      my $nb = abs ( rand ($size));      my $value = abs ( rand (1));      $GC{$nb} = $value;  }    foreach my $nb (keys %GC) {      my $gc = Chromosome::Map::Feature->new (-loc => $nb,                                              -color => 'indigo',                                              -value => $GC{$nb},                                              -valuetype => 'relative',                                             );      $GC_track->add_element($gc);  }    my @Color = qw (blueviolet darkgoldenrod black softblue khaki red blue tomato);    foreach my $mark (keys %H) {      my $i = abs (int( rand ($#Color) ) );      my $marker = Chromosome::Map::Element->new(-name  => $mark,                                                 -loc   => $H{$mark},                                                 -color => $Color[$i],                                                );      $mark_track->add_element($marker);  }    # Define QTL element  my $qtl1 = Chromosome::Map::Block->new (-name  => 'BW',                                          -start => '3',                                          -end   => '11',                                          -color => 'darkgoldenrod',                                         );    my $qtl2 = Chromosome::Map::Block->new (-name  => 'FAT',                                          -start => '92',                                          -end   => '100',                                          -color => 'darkgoldenrod',                                         );    my $qtl3 = Chromosome::Map::Block->new (-name  => 'LEAN',                                          -start => '112',                                          -end   => '120',                                          -color => 'darkgoldenrod',                                         );    my $qtl4 = Chromosome::Map::Block->new (-name  => 'EGG DEV',                                          -start => '95',                                          -end   => '115',                                         );    my $qtl5 = Chromosome::Map::Block->new (-name  => 'IC',                                          -start => '91',                                          -end   => '122',                                          -color => 'blueviolet',                                         );    my $qtl6 = Chromosome::Map::Block->new (-name  => 'BORN',                                          -start => '20',                                          -end   => '130',                                         );    my $qtl7 = Chromosome::Map::Block->new (-name  => 'REPRODUCTION',                                          -start => '20',                                          -end   => '130',                                         );    $qtl_track->add_element($qtl1);  $qtl_track->add_element($qtl2);  $qtl_track->add_element($qtl3);  $qtl_track->add_element($qtl4);  $qtl_track->add_element($qtl5);  $qtl_track->add_element($qtl6);  $qtl_track->add_element($qtl7);      my $png = $map->png;  my $filename_png = "chr_map.png";  open (PNG, ">$filename_png") || die "cannot create file: $filename_png!\n";  binmode PNG;  print PNG $png;  close PNG;

The above script will generate the following PNG image
Chromosome::Map---Generate GD images of chromosome maps - 喜欢吃桃子 - wangyufeng的博客
 

  评论这张
 
阅读(1132)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017