   end
 
   def menu_species do
-    {:ok, rows} = DB.query("SELECT speciesid,name,menuname FROM Species")
-    for r <- rows, do: ( {id,name,fullname} = r; [id,name,fullname] )
+    query = form species in Species,
+      select: {species."SpeciesId", species."Name", species."MenuName"}
+    # {:ok, rows} = DB.query("SELECT speciesid,name,menuname FROM Species")
+    # for r <- rows, do: ( {id,name,fullname} = r; [id,name,fullname] )
+    Repo.all(query) |> Enum.map(&(Tuple.to_list(&1)))
   end
 
   def menu_groups(species) do

  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] )
  end

  def menu_datasets(species, group, type) do

  alias GnServer.Schema.GenoFreeze
  alias GnServer.Schema.PublishFreeze
  alias GnServer.Schema.Tissue
  alias GnServer.Schema.Geno

  defp use_type(id) do
    try do
