   [t i r]
   (let [v (ld1-> t i "variant" "relatedContextualAllele" (prop= t true "preferred"))]
   (if (nil? v ) (log/error (str "Exception in get-variant: relatedContextualAllele not found")))
-    {:variantIdentifier (variant-identifier v),
-     :altDesignations (variant-alt-designations v),
-     :refseq (variant-refseq t v),
-     :start (variant-start t v),
-     :stop  (variant-stop t v),
-     :ref (variant-ref t v),
-     :alt (variant-alt v)}))
+    {:variantIdentifier (variant-identifier v r),
+     :altDesignations (variant-alt-designations v r),
+     :refseq (variant-refseq t v r),
+     :start (variant-start t v r),
+     :stop  (variant-stop t v r),
+     :ref (variant-ref t v r),
+     :alt (variant-alt v r)}))
 
 ;*** Condition related transformations 
 


 (defn variant-identifier
   "Return variant identifier, typically the ClinGen AlleleReg id."
   [v]
   (csv-colval (get v "CanonicalAllele") "ERROR-variant-identifier"))


  (defn variant-alt-designations
  "Return variant hgvs representations"
  [v]
  (csv-colval (get v "alleleName name") "ERROR-variant-alt-designations"))
 
 (defn variant-refseq
  "Return the variant reference sequence."
  [t v] 
  (let [refseq (ld-> t v "referenceCoordinate" "referenceSequence")]
    (csv-colval (get refseq "display") "ERROR-variant-refseq")))

(defn variant-start
  "Return the variant reference sequence start pos (0-to-1-based transform)."
  [t v]
   ;if ref is not null add 1 to start otherwise as-is
  (let [ref (ld-> t v "referenceCoordinate" "refAllele")
        alt (get v "allele")
        start (ld-> t v "referenceCoordinate" "start")]
    (csv-colval (if (str/blank? ref) (get start "index") (+ 1 (get start "index"))) "ERROR-variant-start")))

(defn variant-stop
  "Return the variant reference sequence stop pos (0-to-1-based transform)."
  [t v]
   ;if ref is blank and alt is not add 1 to stop otherwise as-is
  (let [ref (ld-> t v "referenceCoordinate" "refAllele")
        alt (get v "allele")
        stop (ld-> t v "referenceCoordinate" "end")]
    (csv-colval (if (and (str/blank? ref) (not (str/blank? alt))) (+ 1 (get stop "index")) (get stop "index")) "ERROR-variant-stop")))
 
 (defn variant-ref
  "Return the variant ref allele sequence."
  [t v]
  (let [refcoord (ld-> t v "referenceCoordinate")] 
    (csv-colval (get refcoord "refAllele") "ERROR-variant-ref")))
 
 (defn variant-alt
   "Return the variant alt allele sequence."
   [v]
   (csv-colval (get v "allele") "ERROR-variant-alt"))
 
 (defn get-variant
  "Returns a map of all variant related fields needed for the clinvar 

  (if(nil? (ld-> t i "contribution")) (report/append-to-report r "\n\n*E-401: Interpretation evaluation date not provided"))
  (let [contribution (ld-> t i "contribution")]
    (if (nil? (get contribution "onDate")) "" 
      (try
      (.format 
        (java.text.SimpleDateFormat. "'=\"'yyyy-MM-dd'\"'") 
        (.parse
          (java.text.SimpleDateFormat. "yyyy-MM-dd'T'HH:mm:ss.SSSSSSXXX")
          (get contribution "onDate")))
       (catch Exception e (report/append-to-report r "\n\n*E-404: Interpretation evaluation date format not valid") (get contribution "onDate") "*E-404")))))

  (defn get-interpretation
   "Returns a map of all interpretation related fields needed for the 
