diff --git a/src/Poseidon/CLI/OptparseApplicativeParsers.hs b/src/Poseidon/CLI/OptparseApplicativeParsers.hs index f260eb07..85840bc0 100644 --- a/src/Poseidon/CLI/OptparseApplicativeParsers.hs +++ b/src/Poseidon/CLI/OptparseApplicativeParsers.hs @@ -37,9 +37,9 @@ import Data.List.Split (splitOn) import Data.Version (Version) import qualified Options.Applicative as OP import SequenceFormats.Plink (PlinkPopNameMode (PlinkPopNameAsBoth, PlinkPopNameAsFamily, PlinkPopNameAsPhenotype)) -import System.FilePath (dropExtensions, splitExtension, +import System.FilePath (splitExtension, splitExtensions, takeExtension, - takeExtensions, (<.>)) + (<.>)) import qualified Text.Parsec as P import Text.Read (readMaybe) @@ -506,7 +506,7 @@ parseInGenoSep = parseEigenstrat <|> parsePlink <|> parseVCF pure Nothing <*> parseFileWithEndings "Eigenstrat individual file" "indFile" [".ind"] <*> pure Nothing - parsePlink = GenotypeEigenstrat <$> + parsePlink = GenotypePlink <$> parseFileWithEndings "Plink genotype matrix, optionally gzipped" "bedFile" [".bed", ".bed.gz"] <*> pure Nothing <*> parseFileWithEndings "Plink snp positions file, optionally gzipped" "bimFile" [".bim", ".bim.gz"] <*> @@ -523,7 +523,9 @@ parseFileWithEndings help long endings = OP.option (OP.maybeReader fileEndingRea OP.metavar "FILE") where fileEndingReader :: String -> Maybe FilePath - fileEndingReader optString = if takeExtensions optString `elem` endings then Just (dropExtensions optString) else Nothing + fileEndingReader p = + let (_, extension) = splitExtensionsOptGz p + in if extension `elem` endings then Just p else Nothing parseGenotypeSNPSet :: OP.Parser SNPSetSpec parseGenotypeSNPSet = OP.option (OP.eitherReader readSnpSet) (