changes all issue tracking in preparation for switch to github issues
[bioperl-live.git] / Bio / SeqIO / flybase_chadoxml.pm
blob3d46e05d201af889a0291018a7198b5fd438721b
2 # BioPerl module for Bio::SeqIO::flybase_chadoxml
4 # Peili Zhang <peili@morgan.harvard.edu>
6 # You may distribute this module under the same terms as perl itself
8 # POD documentation - main docs before the code
10 =head1 NAME
12 Bio::SeqIO::flybase_chadoxml - FlyBase variant of chadoxml with sequence output stream
14 =head1 SYNOPSIS
16 It is probably best not to use this object directly, but
17 rather go through the SeqIO handler system:
19 $writer = Bio::SeqIO->new(-file => ">chado.xml",
20 -format => 'flybase_chadoxml');
22 # assume you already have Sequence or SeqFeature objects
23 $writer->write_seq($seq_obj);
25 #after writing all seqs
26 $writer->close_chadoxml();
29 =head1 DESCRIPTION
31 This is a simple subclass of L<Bio::SeqIO::chadoxml>; please see
32 its documentation for details.
34 =head1 FEEDBACK
36 =head2 Mailing Lists
38 User feedback is an integral part of the evolution of this and other
39 Bioperl modules. Send your comments and suggestions preferably to one
40 of the Bioperl mailing lists. Your participation is much appreciated.
42 bioperl-l@bioperl.org - General discussion
43 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
45 =head2 Support
47 Please direct usage questions or support issues to the mailing list:
49 I<bioperl-l@bioperl.org>
51 rather than to the module maintainer directly. Many experienced and
52 reponsive experts will be able look at the problem and quickly
53 address it. Please include a thorough description of the problem
54 with code and data examples if at all possible.
56 =head2 Reporting Bugs
58 Report bugs to the Bioperl bug tracking system to help us keep track
59 the bugs and their resolution.
60 Bug reports can be submitted via the web:
62 https://github.com/bioperl/bioperl-live/issues
64 =head1 AUTHOR - Peili Zhang
66 Email peili@morgan.harvard.edu
68 =head1 APPENDIX
70 The rest of the documentation details each of the object
71 methods. Internal methods are usually preceded with a _
73 =cut
75 package Bio::SeqIO::flybase_chadoxml;
76 use strict;
78 use base 'Bio::SeqIO::chadoxml';
80 sub _initialize {
81 my($self,%args) = @_;
82 $self->SUPER::_initialize(%args);
84 #default for standard chado is polypeptide
85 $Bio::SeqIO::chadoxml::feattype_args2so{'CDS'} = 'protein';
86 $Bio::SeqIO::chadoxml::cv_name{'sequence'} = 'SO';
87 $Bio::SeqIO::chadoxml::cv_name{'relationship'} = 'relationship type';
88 $Bio::SeqIO::chadoxml::cv_name{'feature_property'} = 'property type';
90 return;
93 =head2 return_ftype_hash
95 Title : return_ftype_hash
96 Usage : $obj->return_ftype_hash()
97 Function : A simple hash where returning it has be factored out of the main
98 code to allow subclasses to override it.
99 Returns : A hash that indicates what the name of the SO term is and what
100 the name of the Sequence Ontology is in the cv table.
101 Args : The string that represents the SO term.
102 Status :
104 =cut
106 sub return_ftype_hash {
107 my $self = shift;
108 my $ftype = shift;
109 my %ftype_hash = ( "name" => $ftype,
110 "cv_id" => {"name" => $Bio::SeqIO::chadoxml::cv_name{'sequence'} });
111 return %ftype_hash;
114 =head2 return_reltypename
116 Title : return_reltypename
117 Usage : $obj->return_reltypename
118 Function : Return the appropriate relationship type name depending on the
119 feature type (typically part_of, but derives_from for polypeptide).
120 Returns : A relationship type name.
121 Args : A SO type name.
122 Status :
124 =cut
126 sub return_reltypename {
127 my $self = shift;
128 my $sftype = shift;
130 my $reltypename;
131 if ($sftype eq 'protein' || $sftype eq 'polypeptide') {
132 $reltypename = 'producedby';
133 } else {
134 $reltypename = 'partof';
137 return $reltypename;
140 =head2 write_seq
142 Title : write_seq
143 Usage : $stream->write_seq(-seq=>$seq, -seq_so_type=>$seqSOtype,
144 -src_feature=>$srcfeature,
145 -src_feat_type=>$srcfeattype,
146 -nounflatten=>0 or 1,
147 -is_analysis=>'true' or 'false',
148 -data_source=>$datasource)
149 Function: writes the $seq object (must be seq) into chadoxml.
150 Returns : 1 for success and 0 for error
151 Args : A Bio::Seq object $seq, optional $seqSOtype, $srcfeature,
152 $srcfeattype, $nounflatten, $is_analysis and $data_source.
154 Overrides Bio::SeqIO::chadoxml's write_seq method just to add an internal
155 close_chadoxml (mimics original use by FlyBase).
157 =cut
159 sub write_seq {
160 my ($self, @argv) = @_;
162 $self->SUPER::write_seq(@argv);
164 $self->close_chadoxml;
165 return 1;