[BioRuby-cvs] bioruby/lib/bio/io/flatfile indexer.rb,1.21,1.22
Naohisa Goto
ngoto at pub.open-bio.org
Sun Jan 29 06:54:16 UTC 2006
Update of /home/repository/bioruby/bioruby/lib/bio/io/flatfile
In directory pub.open-bio.org:/tmp/cvs-serv7939/io/flatfile
Modified Files:
indexer.rb
Log Message:
* In lib/bio/db/pdb/chemicalcomponent.rb, added a new class Bio::PDB::ChemicalComponent to parse the PDB Chemical Component Dictionary (PDB style format).
* Added file format autodetection for Bio::PDB::ChemicalComponent.
* Added flatfile indexer for Bio::PDB::ChemicalComponent.
Index: indexer.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/io/flatfile/indexer.rb,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** indexer.rb 26 Sep 2005 13:00:08 -0000 1.21
--- indexer.rb 29 Jan 2006 06:54:14 -0000 1.22
***************
*** 81,84 ****
--- 81,86 ----
when 'Bio::Blast::WU::Report_TBlast'
BlastDefaultParser.new(Bio::Blast::WU::Report_TBlast, *arg)
+ when 'Bio::PDB::ChemicalComponent'
+ PDBChemicalComponentParser.new(Bio::PDB::ChemicalComponent, *arg)
else
raise 'unknown or unsupported format'
***************
*** 437,440 ****
--- 439,471 ----
end
end #class BlastDefaultReportParser
+
+ class PDBChemicalComponentParser < TemplateParser
+ NAMESTYLE = NameSpaces.new(
+ NameSpace.new( 'UNIQUE', Proc.new { |x| x.entry_id } )
+ )
+ PRIMARY = 'UNIQUE'
+ def initialize(klass, pri_name = nil, sec_names = nil)
+ super()
+ self.format = 'raw'
+ self.dbclass = Bio::PDB::ChemicalComponent
+ self.set_primary_namespace((pri_name or PRIMARY))
+ unless sec_names then
+ sec_names = []
+ @namestyle.each_value do |x|
+ sec_names << x.name if x.name != self.primary.name
+ end
+ end
+ self.add_secondary_namespaces(*sec_names)
+ end
+ def open_flatfile(fileid, file)
+ super
+ @flatfile.pos = 0
+ begin
+ pos = @flatfile.pos
+ line = @flatfile.gets
+ end until (!line or line =~ /^RESIDUE /)
+ @flatfile.pos = pos
+ end
+ end #class PDBChemicalComponentParser
end #module Parser
More information about the bioruby-cvs
mailing list