Skip to content

Instantly share code, notes, and snippets.

@danmaclean
Created November 5, 2013 16:18
Show Gist options
  • Save danmaclean/7321562 to your computer and use it in GitHub Desktop.
Save danmaclean/7321562 to your computer and use it in GitHub Desktop.
irb session using Bio::GFF::GFF3::Record
irb(main):001:0> require 'bio'
=> true
irb(main):002:0> r = Bio::GFF::GFF3.new()
=> #<Bio::GFF::GFF3:0x007ff22b911ea8 @gff_version=nil, @records=[], @sequence_regions=[], @metadata=[], @sequences=[], @in_fasta=false>
irb(main):003:0> r = Bio::GFF::GFF3::Record.new()
=> #<Bio::GFF::GFF3::Record:0x007ff22c104728 @seqname=nil, @source=nil, @feature=nil, @score=nil, @strand=nil, @attributes=[], @start=nil, @end=nil, @frame=nil>
irb(main):004:0> r.seqname = "meh"
=> "meh"
irb(main):005:0> r
=> #<Bio::GFF::GFF3::Record:0x007ff22c104728 @seqname="meh", @source=nil, @feature=nil, @score=nil, @strand=nil, @attributes=[], @start=nil, @end=nil, @frame=nil>
irb(main):006:0> r.seqname
=> "meh"
irb(main):007:0> r.attributes.class
=> Array
irb(main):008:0> r.attributes.length
=> 0
irb(main):009:0> r.attributes << ["ID", "CHAL0001"]
=> [["ID", "CHAL0001"]]
irb(main):010:0> r.attributes << ["GO", "0001"]
=> [["ID", "CHAL0001"], ["GO", "0001"]]
irb(main):011:0> r.attributes << ["Desc", "actin"]
=> [["ID", "CHAL0001"], ["GO", "0001"], ["Desc", "actin"]]
irb(main):012:0> r.to_s
=> "meh\t.\t.\t.\t.\t.\t.\t.\tID=CHAL0001;GO=0001;Desc=actin\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment