Mercurial > repos > mahtabm > ensembl
comparison variant_effect_predictor/Bio/Tools/EPCR.pm @ 0:1f6dce3d34e0
Uploaded
author | mahtabm |
---|---|
date | Thu, 11 Apr 2013 02:01:53 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1f6dce3d34e0 |
---|---|
1 # $Id: EPCR.pm,v 1.8 2002/12/01 00:05:21 jason Exp $ | |
2 # | |
3 # BioPerl module for Bio::Tools::EPCR | |
4 # | |
5 # Cared for by Jason Stajich <jason@bioperl.org> | |
6 # | |
7 # Copyright Jason Stajich | |
8 # | |
9 # You may distribute this module under the same terms as perl itself | |
10 | |
11 # POD documentation - main docs before the code | |
12 | |
13 =head1 NAME | |
14 | |
15 Bio::Tools::EPCR - Parse ePCR output and make features | |
16 | |
17 =head1 SYNOPSIS | |
18 | |
19 # A simple annotation pipeline wrapper for ePCR data | |
20 # assuming ePCR data is already generated in file seq1.epcr | |
21 # and sequence data is in fasta format in file called seq1.fa | |
22 | |
23 use Bio::Tools::EPCR; | |
24 use Bio::SeqIO; | |
25 my $parser = new Bio::Tools::EPCR(-file => 'seq1.epcr'); | |
26 my $seqio = new Bio::SeqIO(-format => 'fasta', -file => 'seq1.fa'); | |
27 my $seq = $seqio->next_seq || die("cannot get a seq object from SeqIO"); | |
28 | |
29 while( my $feat = $parser->next_feature ) { | |
30 # add EPCR annotation to a sequence | |
31 $seq->add_SeqFeature($feat); | |
32 } | |
33 my $seqout = new Bio::SeqIO(-format => 'embl'); | |
34 $seqout->write_seq($seq); | |
35 | |
36 | |
37 =head1 DESCRIPTION | |
38 | |
39 This object serves as a parser for ePCR data, creating a | |
40 Bio::SeqFeatureI for each ePCR hit. These can be processed or added | |
41 as annotation to an existing Bio::SeqI object for the purposes of | |
42 automated annotation. | |
43 | |
44 =head1 FEEDBACK | |
45 | |
46 =head2 Mailing Lists | |
47 | |
48 User feedback is an integral part of the evolution of this and other | |
49 Bioperl modules. Send your comments and suggestions preferably to | |
50 the Bioperl mailing list. Your participation is much appreciated. | |
51 | |
52 bioperl-l@bioperl.org - General discussion | |
53 http://bioperl.org/MailList.shtml - About the mailing lists | |
54 | |
55 =head2 Reporting Bugs | |
56 | |
57 Report bugs to the Bioperl bug tracking system to help us keep track | |
58 of the bugs and their resolution. Bug reports can be submitted via | |
59 email or the web: | |
60 | |
61 bioperl-bugs@bioperl.org | |
62 http://bugzilla.bioperl.org/ | |
63 | |
64 =head1 AUTHOR - Jason Stajich | |
65 | |
66 Email jason@bioperl.org | |
67 | |
68 Describe contact details here | |
69 | |
70 =head1 APPENDIX | |
71 | |
72 The rest of the documentation details each of the object methods. | |
73 Internal methods are usually preceded with a _ | |
74 | |
75 =cut | |
76 | |
77 | |
78 # Let the code begin... | |
79 | |
80 | |
81 package Bio::Tools::EPCR; | |
82 use vars qw(@ISA); | |
83 use strict; | |
84 | |
85 use Bio::Root::Root; | |
86 use Bio::SeqAnalysisParserI; | |
87 use Bio::SeqFeature::FeaturePair; | |
88 use Bio::SeqFeature::Generic; | |
89 | |
90 @ISA = qw(Bio::Root::Root Bio::SeqAnalysisParserI Bio::Root::IO ); | |
91 | |
92 =head2 new | |
93 | |
94 Title : new | |
95 Usage : my $epcr = new Bio::Tools::EPCR(-file => $file); | |
96 Function: Initializes a new EPCR parser | |
97 Returns : Bio::Tools::EPCR | |
98 Args : -fh => filehandle | |
99 OR | |
100 -file => filename | |
101 | |
102 =cut | |
103 | |
104 sub new { | |
105 my($class,@args) = @_; | |
106 | |
107 my $self = $class->SUPER::new(@args); | |
108 $self->_initialize_io(@args); | |
109 | |
110 return $self; | |
111 } | |
112 | |
113 =head2 next_feature | |
114 | |
115 Title : next_feature | |
116 Usage : $seqfeature = $obj->next_feature(); | |
117 Function: Returns the next feature available in the analysis result, or | |
118 undef if there are no more features. | |
119 Example : | |
120 Returns : A Bio::SeqFeatureI implementing object, or undef if there are no | |
121 more features. | |
122 Args : none | |
123 | |
124 =cut | |
125 | |
126 sub next_feature { | |
127 my ($self) = @_; | |
128 my $line = $self->_readline; | |
129 return undef unless defined($line); | |
130 chomp($line); | |
131 my($seqname,$location,$mkrname, $rest) = split(/\s+/,$line,4); | |
132 | |
133 my ($start,$end) = ($location =~ /(\S+)\.\.(\S+)/); | |
134 | |
135 # If we require that e-PCR is run with D=1 we can detect a strand | |
136 # for now hardcoded to 0 | |
137 | |
138 my $strand = 0; | |
139 my $markerfeature = new Bio::SeqFeature::Generic ( '-start' => $start, | |
140 '-end' => $end, | |
141 '-strand' => $strand, | |
142 '-source' => 'e-PCR', | |
143 '-primary' => 'sts', | |
144 '-seq_id' => $seqname, | |
145 '-tag' => { | |
146 'name'=> $mkrname, | |
147 'note'=> $rest, | |
148 }); | |
149 return $markerfeature; | |
150 } | |
151 | |
152 1; |