       order_by: chr_length."OrderId"
 
     Repo.all(query) |> Enum.map(&(Tuple.to_list(&1)))
-#       query = """
-# SELECT Chr_Length.Name, Length
-# FROM Chr_Length, InbredSet as C
-# WHERE #{subq}
-# AND Chr_Length.SpeciesId = C.SpeciesId
-# ORDER BY Chr_Length.OrderId
-#       """
-#     {:ok, rows} = DB.query(query)
-#     for r <- rows, do: ( {chr_name,chr_len} = r; [chr_name,chr_len] )
   end
 
   def group_info({:optimized, group}) do

# group by InbredSet.Name
    {:ok, %Mariaex.Result{columns: _columns, command: _command, connection_id: _connection_id, last_insert_id: _last_insert_id, num_rows: _num_rows, rows: rows }} = SQL.query(Repo, query, [species])
    rows
    # {:ok, rows} = DB.query(query)
    # for r <- rows, do: ( {id,name,fullname} = r; [id,name,fullname] )
  end

  def menu_types(species, group) do
    # query = """
    # select distinct Tissue.Name
    # from ProbeFreeze,ProbeSetFreeze,InbredSet,Tissue,Species
    # where Species.Name = '#{species}' and
      # Species.Id = InbredSet.SpeciesId and
      # InbredSet.Name = '#{group}' and
      # ProbeFreeze.TissueId = Tissue.Id and
      # ProbeFreeze.InbredSetId = InbredSet.Id and
      # ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id and
      # ProbeSetFreeze.public > 0
      # order by Tissue.Name
    # """
    # {:ok, rows} = DB.query(query)
    # for r <- rows, do: ( {tissue} = r; [tissue] )

    query = from tab_species in Species,
      join: inbredset in InbredSet,
      on: tab_species.id == inbredset."SpeciesId",

        { :integer, i } -> {:id, i}
        { :string, s }  -> {:Name, s}
      end

    query = from probesetfreeze in ProbeSetFreeze,
      join: probefreeze in ProbeFreeze,
