# File lib/bio/graphics/page.rb, line 39
      def  selfself..from_jsonfrom_json(args)
        require 'rubygems'
        require 'json'
        data = JSON.parse(File.open(args[:json], 'r').read)
        p = Page.new(:width => data["Page"]["width"],
                     :height => data["Page"]["height"],
                     :number_of_intervals => data["Page"]["intervals"])
        data["Tracks"].each do |track|
          #prep the track args
          track_args = track.dup
          track_args.delete("file")
          track_args.delete("file_type")
          track_args = track_args.inject({}) { |memo, (k, v)| memo[k.to_sym] = v; memo }
          ##convert any of the pre-made gradient strings in the keys to symbol
          track_args.each_key do |k|
            next unless track_args[k].respond_to?(:to_sym)
            track_args[k] = track_args[k].to_sym if Glyph.gradients.include?(track_args[k].to_sym)
          end

          svg_track = p.add_track(track_args)
          features = [] ##set up the features...

          case track["file_type"] ##deal with the gff and data files
            when "gff"
              groups = {}
              parentless_features = []
              Page.parse_gff(track["file"]).each do |gff| #gets features in a list and links their children to them as members of the array at the key
                parent_id = gff.attributes.select { |a| a.first == 'Parent' }
                if parent_id.empty?
                  parentless_features << gff
                else
                  if groups[parent_id.first.last].nil?
                    groups[parent_id.first.last] = []
                    groups[parent_id.first.last] << gff
                  else
                    groups[parent_id.first.last] << gff
                  end
                end
              end
              #now flick through the parentless features and add any exons / UTRs
              parentless_features.each do |plf|
                require 'pp'
                #pp parentless_features
                gff_id = plf.attributes.select { |a| a.first == 'ID' }
                gff_id = gff_id.first.last
                exons = []
                utrs = []
                children = groups[gff_id] || children = []
                children.each do |child|
                  if child.feature == 'exon' or child.feature == 'CDS'
                    exons += [child.start, child.end]
                  elsif child.feature =~ /utr/i
                    utrs += [child.start, child.end]
                  end
                end
                features << MiniFeature.new(:start => plf.start, :end => plf.end, :exons => exons, :utrs => utrs, :strand => plf.strand, :id => gff_id)
              end #parentless features end
            when "data"
              ##each line is a data feature
              File.open(track["file"], "r").each do |line|
                start, stop, value = line.split(/\t/)
                features << MiniFeature.new(:start => start.to_i, :end => stop.to_i, :segment_height => value.to_f)
              end
          end #data end
          features.each { |f| svg_track.add(f) }
        end #track end
        p.write(args[:outfile])
      end