bioperl中。 Bio ::带有GFF文件的图形

时间:2014-01-18 20:28:50

标签: bioperl

我需要获得这样的东西:

enter image description here

然而,我不知道如何继续...现在我有了这个:

enter image description here

换句话说......我不知道如何添加标签和相应的成绩单,CDS等。

我的代码现在是以下代码:

#!/usr/bin/perl

#use strict;
use Bio::Graphics;
use Bio::SeqFeature::Generic;

my $panel = Bio::Graphics::Panel->new(
                                      -length => 20000,
                                      -width  => 800
                                     );

my $full_length = Bio::SeqFeature::Generic->new(
                                                -start => 1,
                                                -end   => 20000,
                                               );



$panel->add_track($full_length,
                  -key     => "hola",
                  -glyph   => 'arrow',
                  -tick    => 2,
                  -fgcolor => 'black',
                  -double  => 1,
                 );

my $track = $panel->add_track(
                              -glyph => 'generic',
                              -label => 1
                             );

my $track = $panel->add_track(
                              -glyph => 'generic',
                              -label => 1
                             );


$seq = "";
$seqlength = length($seq);
$count = 0;
while (<>) {
  chomp;
  next if /^\#/;
  my @gff_data = split /\t+/;
  next if ($gff_data[2] ne "gene");
  my $feature = Bio::SeqFeature::Generic->new(

                                              -display_name => $gff_data[8],
                                              -score        => $gff_data[5],
                                              -start        => $gff_data[3],
                                              -end          => $gff_data[4],
                                             );
  $track->add_feature($feature);
}

print $panel->png;

我也读过CPAN信息,但没有线索...... NCBI文件有很多信息,但GFF没有...

我的数据:

313-9640000-9660000:19634:fwd   maker   gene    1978    7195    .   +   .   ID=maker-313-9640000-9660000%3A19634%3Afwd-augustus-gene-0.10;Name=maker-313-9640000-9660000%253A19634%253Afwd-augustus-gene-0.10
313-9640000-9660000:19634:fwd   maker   mRNA    1978    7195    .   +   .   ID=maker-313-9640000-9660000%3A19634%3Afwd-augustus-gene-0.10-mRNA-1;Name=maker-313-9640000-9660000%253A19634%253Afwd-augustus-gene-0.10-mRNA-1;Parent=maker-313-9640000-9660000%3A19634%3Afwd-augustus-gene-0.10
313-9640000-9660000:19634:fwd   maker   exon    1978    2207    0.48    +   .   Parent=maker-313-9640000-9660000%3A19634%3Afwd-augustus-gene-0.10-mRNA-1
313-9640000-9660000:19634:fwd   maker   exon    3081    3457    0.48    +   .   Parent=maker-313-9640000-9660000%3A19634%3Afwd-augustus-gene-0.10-mRNA-1
313-9640000-9660000:19634:fwd   maker   exon    3535    3700    0.48    +   .   Parent=maker-313-9640000-9660000%3A19634%3Afwd-augustus-gene-0.10-mRNA-1

任何帮助都会非常受欢迎。

3 个答案:

答案 0 :(得分:1)

use Bio::Graphics;
use Bio::Tools::GFF;
use Bio::SeqFeature::Generic;

$gfffile = shift;
my $gff = Bio::Tools::GFF->new(-file => $gfffile, -gff_version => 3);

while($feature = $gff->next_feature()) {
  $tag = $feature->primary_tag;
  push @{$hash{$tag}}, $feature;
}
$gff->close();

my $panel = Bio::Graphics::Panel->new(
                                  -length => 20000,
                                  -width  => 800,
                                  -key_style => 'between',
                                 );

my $full_length = Bio::SeqFeature::Generic->new(
                                            -start => 1,
                                            -end   => 20000,
                                           );

$panel->add_track($full_length,
              -key     => "hola",
              -glyph   => 'arrow',
              -tick    => 2,
              -fgcolor => 'black',
              -double  => 1,
             );

my @colors = qw(cyan orange blue);
my $idx    = 0;
for my $tag (sort keys %hash) {
  my $features = $hash{$tag};
  $panel->add_track($features,
                -glyph       =>  'generic',
                -bgcolor     =>  $colors[$idx++ % @colors],
                -fgcolor     => 'black',
                -font2color  => 'red',
                -key         => "${tag}s",
                -bump        => +1,
                -height      => 8,
                -label       => 1,
                -description => 1,
               );
} 
print $panel->png;

答案 1 :(得分:0)

您在第一个屏幕截图中显示的内容可能来自GBrowse,并且跟踪标签(我认为这就是'标签'的含义)在配置文件中定义。通过在创建对象时设置'label'和'label_feat'属性,可以打开/关闭功能标签。如果您不喜欢MAKER设置为ID的长字符串,则必须手动编辑该文件。

您可以通过选择不同的字形来更改每个要素的外观。例如,您选择了“通用”字形,因此您获得的是一个非常通用的框,它只显示该功能的位置。对于外观漂亮的成绩单,请查看'processed_transcript'和'decorated_transcript'字形。

您的代码也存在一些问题,例如某些部分的重复,但这可能来自复制和粘贴代码。

答案 2 :(得分:0)

我遇到了和你相同的问题。事情不是很容易解释。最后我解决了它,mi的数字与你的相似。 就我而言,我想在几个基因的5'UTR中连接一些编码数据。此编码数据应使用虚线连接。 所以我创建了一个Bio :: SeqFeature :: Generic对象,里面绘制的信息是我的编码区域,所以这个编码区域需要在内部进行sub_located:

my $splitlocation = Bio::Location::Split->new();
foreach $encode_regions ....{
    $splitlocation->add_sub_Location(Bio::Location::Simple->new(-start=>$start,-end=>$end,-  strand=>$strand,-splittype=>"join"));
}

$exones = new Bio::SeqFeature::Generic(
    -primary_tag => 'Encode Regions',
    -location=>$splitlocation
);