Last active
October 8, 2015 15:27
-
-
Save averagehat/802af2bd08561f27bcda to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file : (not-qual sanger <'\n'>)+ | (not-qual illumina-1-0 <'\n'>)+ | (not-qual illumina-1-3 <'\n'>)+ | |
sanger: ('!' | '\"' | '#' | '$' | '%' | '&' | '\'' | '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | ':' | ';' | '<' | '=' | '>' | '?' | '@' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | '[' | '\\' | ']' | '^' | '_' | '`' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | '{' | '|' | '}')+ | |
illumina-1-0: (';' | '<' | '=' | '>' | '?' | '@' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | '[' | '\\' | ']' | '^' | '_' | '`' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | '{' | '|' | '}')+ | |
illumina-1-3: ('@' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | '[' | '\\' | ']' | '^' | '_' | '`' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | '{' | '|' | '}')+ | |
<not-qual> : header <'\n'> sequence <'\n'> desc <'\n'> | |
desc : <'+'> not-newline? | |
header : <'@'> not-newline | |
<not-newline> : #'[^\n]+' | |
sequence : ('A' | 'G' | 'C' | 'T')+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require ['clojure.zip :as 'z]) | |
(require '[clojure.test :refer :all]) | |
(def fq-parse (insta/parser (clojure.java.io/file "fastq.grammar"))) | |
(def tr1 | |
(fq-parse | |
"@M02261:12:000000000-A6FJ2:1:1101:15914:1452 1:N:0:12 | |
CTTATCTCCTGTTCCACTTCAAACAGCAGTTGTAATGCTTGCATGAATGTTATTTGTTCAAAGCTATTTTCAGTTGTTCTTAATCTGTGTCTCACTTCTTCAATTAGCCATCTTATCTCTTCAAACTTCTGACCTAGCTGTTCTCGCCATTTCCCGTTTCTGTTTTGGAGTAAGTGGAGGTCCCCCATTTTCATTACTGCTTCTCCTAGCGAATCTCTGTAGATTTTTAGAGACTCGAACTGTGTT | |
+ | |
1>AA1FD3DFFFG3BBF11FGGGGHHGFHGFGGHHFGBHHFHHHFFFFF1DFGHHHGF1FFH10G1HHBHFHEHHGGHHHHH2FFGHABGAGHFHHHFHHBGFHF1GBFFHHHFEGGHBGB1B@EGGHFHFEHGGFFHFFGH2EGGGCFGFHHFBE/FBGEDEBFCB?10FFHDDDHDC//@@FGE?CG2<FGGGHEHBGFHHHHH1<>C--@>CHFHDDDBD000DG./<DDGGB..:.GFHHHH | |
")) | |
(def tr2 | |
(fq-parse | |
"@EAS54_6_R1_2_1_443_348 | |
GTTGCTTCTGGCGTGGGTGGGGGGG | |
+ | |
ZZZZZZZZZZZXZVZZMVZRXRRRR | |
")) | |
(defn get-encoding [t] (-> (z/vector-zip t) z/down z/right z/right z/right z/right z/node first)) | |
(is | |
(= :sanger (get-encoding tr1))) | |
(is | |
(= :illumina-1-3 (get-encoding tr2))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment