[initial version, untested Ketil Malde **20080521205307] { addfile ./SNPCGI.hs hunk ./SNPCGI.hs 1 +{- | CGI program for calculating SNPs + output: + 0) a pairwise check of equality + 1) a table of variable positions + 2) any other variable columns + 3) ... +-} + +import Network.CGI + +import Columns + +-- | predefined polymorphic locations +snp_columns :: [Int] +snp_columns = [-21, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 --, 13I, 13II, 13III, 13IV, 13V, 13VI + , 14, 15, 16, 19, 62, 78, 89, 107, 117, 134, 145, 172 + , 205, 207, 208, 214, 217, 218, 219, 250, 252, 265, 271, 272, 273, 289, 298 + ] + +main :: IO () +main = runCGI cgiMain + +cgiMain = do m <- getInput "alignment" + case m of + Just n -> genResult n + Nothing -> output form + +genResult s = do + let (hs,ss) = unzip $ map splitLine $ drop 1 $ lines s + cols = transpose ss + output $ alignCols $ showCols hs $ filterCols $ enumerate (last ss) cols + +form = "Alignment analyzer" ++ + "

Paste your alignment below:

" ++ + "
" ++ + "
" ++ + "
" }