Maker Lab script

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
 
 
#!/usr/bin/perl
 
use strict;
use warnings;
use GAL::Annotation;
 
#-----------------------------------------------------------------------------
#----------------------------------- MAIN ------------------------------------
#-----------------------------------------------------------------------------
 
my $usage = "
 
Synopsis:
 
gal_maker_example feature.gff3 genome.fasta
 
Description:
 
This is an example script for using the GAL library for working
with GFF3 sequences produced by MAKER.
 
";
 
my ($gff3_file, $fasta_file) = @ARGV;
 
die "$usage\n\nFATAL : missing_fasta_file : Fasta file required\n"
    unless $fasta_file;
die "$usage\n\nFATAL : missing_gff3_file : GFF3 file required\n"
    unless $gff3_file;
 
my $annotation = GAL::Annotation->new($gff3_file,
				      $fasta_file);
 
my $features = $annotation->features;
 
# Do the search and get an interator for all matching features
my $genes = $features->search({type => 'gene'});
 
# Iterate over the features
while (my $gene = $genes->next) {
    # Get the feature ID
    my $g_id = $gene->feature_id;
    my $g_length = $gene->length;
    my $mrnas = $gene->mRNAs;
 
    # Iterate over the features
    while (my $mrna = $mrnas->next) {
	# Get the feature ID
	my $m_id = $mrna->feature_id;
	my $m_length = $mrna->length;
	# Get all the exons for this mRNA
	my $introns = $mrna->introns;
	# Iterate over each intron
	while (my $intron = $introns->next) {
	    my $i_id = $intron->feature_id;
	    my $i_length = $intron->length;
	    my $i_gc = $intron->gc_content;
	    print join "\t", ($g_id, $g_length, $m_id, $m_length, $i_id,
			      $i_length, $i_gc);
	    print "\n";
	}
    }
}
			

Comments are closed.