          chr: chr,
          "Mb": mb,
          symbol: symbol
-      })
+      }
+    end
+
+    Repo.all(query) |> Enum.map(from_tuple_to_structure)
+
   end
 
   def marker_info(species,marker) do
-      query = """
-SELECT Geno.Chr, Geno.Mb, Species.Id,Geno.source FROM Geno, Species
-WHERE Species.Name = '#{species}'
-AND Geno.Name = '#{marker}'
-     """
-    {:ok, rows} = DB.query(query)
-    for r <- rows, do: ( {chr_name,chr_len,species_id,source} = r;
+#       query = """
+# SELECT Geno.Chr, Geno.Mb, Species.Id,Geno.source FROM Geno, Species
+# WHERE Species.Name = '#{species}'
+# AND Geno.Name = '#{marker}'
+#      """
+     query = from tab_species in Species,
+     join: geno in Geno,
+     on: tab_species."SpeciesId" == geno."SpeciesId",
+     where: tab_species."Name" == ^species and geno."Name" == ^marker,
+     select: {geno."Chr", geno."Mb", tab_species.id, geno."Source"}
+
+    # {:ok, rows} = DB.query(query)
+
+    from_tuple_to_structure = fn(query_result) ->
+      {chr_name,chr_len,species_id,source} = query_result
       %{
         species: species,
         species_id: species_id,

        marker: marker,
        chr:     chr_name,
        chr_len: chr_len
      } )
  end



defmodule GnServer.Data.Store do

  alias GnServer.Backend.MySQL, as: DB
  import Ecto.Query
  alias GnServer.Repo
  alias GnServer.Schema.Species
  alias GnServer.Schema.ProbeSetFreeze
  alias GnServer.Schema.InbredSet
  alias GnServer.Schema.ProbeFreeze
  alias GnServer.Schema.GenoFreeze
  alias GnServer.Schema.PublishFreeze
  alias GnServer.Schema.Tissue
  alias GnServer.Schema.Geno
  alias GnServer.Schema.Chr_Length
  alias GnServer.Schema.ProbeSet
  alias GnServer.Schema.ProbeSetXRef

  defp use_type(id) do
    try do
