Permalink
Browse files

Fixed bug where application did not exit with an appropriate error co…

…de on file errors

Removed export of GenoSNP annotation (these data have been added to the JSON SNP metadata)
  • Loading branch information...
1 parent 287fa3a commit 10db2d880cb59517e60c0211fb5df986180015cd @keithj committed Jun 6, 2012
Showing with 7 additions and 42 deletions.
  1. +5 −2 src/bpm.lisp
  2. +0 −27 src/genosnp.lisp
  3. +2 −13 src/genotype-call-cli.lisp
View
@@ -168,10 +168,13 @@ with string values and key \"position\" with an integer value.")
(loop
with snps = (snps-of manifest :key key :test test)
for snp across snps
- collect (pairlis '(:name :chromosome :position)
+ collect (pairlis '(:name :chromosome :position
+ :allele_a :allele_b :norm-id)
(list (snp-name snp)
(encode-bim-chromosome (snp-chromosome snp))
- (snp-position snp))) into specs
+ (snp-position snp)
+ (snp-allele-a snp) (snp-allele-b snp)
+ (snp-norm-id snp))) into specs
finally (with-underscore-translation
(json:encode-json specs out)
(return specs))))))
View
@@ -35,39 +35,12 @@
(when (subtypep (type-of s) 'file-stream)
(file-namestring s))))))
-(defgeneric save-genosnp-snps (filespec manifest)
- (:documentation "Writes SNP annotation to FILESPEC in the format
-expected by GenoSNP. This is a separate method rather than being part
-of intensity format-shifting because it is typically done once for all
-samples; therefore it is not required most of the time. All SNPs in
-the manifest are written.")
- (:method (filespec (manifest bpm))
- (with-open-file (out filespec :direction :output :if-exists :supersede
- :if-does-not-exist :create)
- (loop
- for snp across (snps-of manifest)
- do (write-genosnp-snp snp out)
- (terpri out)))))
-
(defun write-genosnp-sample (sample-name stream)
(write-string sample-name stream)
(write-char #\Tab stream)
(write-string sample-name stream)
(write-char #\Tab stream))
-(defun write-genosnp-snp (snp stream)
- (write-string (snp-name snp) stream)
- (write-char #\Tab stream)
- ;; FIXME: The modulo 100 transform here is to emulate the existing
- ;; software (g2i). However, I've no idea why this is applied. In
- ;; fact, GenoSNP docs say that this value should be the BeadPool
- ;; number instead.
- (princ (1+ (mod (snp-norm-id snp) 100)) stream)
- (write-char #\Tab stream)
- (write-char (snp-allele-a snp) stream)
- (write-char #\Space stream)
- (write-char (snp-allele-b snp) stream))
-
(defun write-genosnp-intensities (a b stream)
(write-char #\Tab stream)
(princ a stream)
@@ -108,10 +108,6 @@ designating a CLI class."
(:documentation "sim-to-genosnp --input <filename> --output <filename>
--manifest <filename>"))
-(define-cli bpm-to-genosnp-cli (cli output-mixin manifest-mixin)
- ()
- (:documentation "bpm-to-genosnp --output <filename> --manifest <filename>"))
-
(define-cli mock-study-cli (cli manifest-mixin)
((study-name "study-name" :required-option t :value-type 'string
:documentation "The name of the study, used in file naming.")
@@ -151,7 +147,8 @@ designating a CLI class."
(warn "No help was found for ~a~%" cmd)))
(quit-lisp :status 3))
(file-error (condition)
- (errmsg condition))
+ (errmsg condition)
+ (quit-lisp :status 4))
(error (condition)
(errmsg condition)
(write-line "Backtrace follows:" *error-output*)
@@ -242,14 +239,6 @@ designating a CLI class."
(sim-to-genosnp output manifest input :start start :end end))))
(register-command
- "bpm-to-genosnp" 'bpm-to-genosnp-cli
- (lambda (parsed-args &optional other)
- (declare (ignorable other))
- (let ((output (maybe-standard-stream (option-value 'output parsed-args)))
- (manifest (load-bpm (option-value 'manifest parsed-args))))
- (save-genosnp-snps output manifest))))
-
-(register-command
"mock-study" 'mock-study-cli
(lambda (parsed-args &optional other)
(declare (ignorable other))

0 comments on commit 10db2d8

Please sign in to comment.