Skip to content

Commit

Permalink
Merge pull request #28 from poseidon-framework/poseidon_hs_v1403
Browse files Browse the repository at this point in the history
Updating to Poseidon hs v1403 and new GHC and LTS
  • Loading branch information
stschiff authored Nov 8, 2023
2 parents fa5c2bb + 5e81c99 commit 1448134
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
stack: ["latest"]
ghc: ["9.2.7"]
ghc: ["9.4.7"]

steps:
# setup and loading cache
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- 1.0.0.2: Switched to poseidon-hs v1.4.0.3 and a new compiler (GHC 9.4.7) and stackage snapshot version (LTS-21.17)
- 1.0.0.1: Switched to poseidon-hs v1.4.0.2
- 1.0.0.0: Some key updates:
- now uses newest poseidon-hs library (v1.4.0.0) with improved and clarified semantics for entity selectors
Expand Down
14 changes: 8 additions & 6 deletions Dockerfile.linux
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM centos:7

RUN yum -y update
RUN yum -y install zlib-devel wget ncurses-devel ncurses-compat-libs make gcc
RUN yum -y install zlib-devel wget ncurses-devel ncurses-compat-libs make gcc gcc-c++

# Install GHC since stack's local install has issues
RUN wget https://downloads.haskell.org/~ghc/9.2.7/ghc-9.2.7-x86_64-centos7-linux.tar.xz
RUN tar xvf ghc-9.2.7-x86_64-centos7-linux.tar.xz
RUN cd ghc-9.2.7; ./configure; make install
RUN wget https://downloads.haskell.org/~ghc/9.4.7/ghc-9.4.7-x86_64-centos7-linux.tar.xz
RUN tar xvf ghc-9.4.7-x86_64-centos7-linux.tar.xz
RUN cd ghc-9.4.7-x86_64-unknown-linux; ./configure; make install

# install stack
RUN curl -sSL https://get.haskellstack.org/ | sh
Expand All @@ -15,5 +15,7 @@ RUN curl -sSL https://get.haskellstack.org/ | sh
ADD . source
WORKDIR source

# Install sequenceTools. As described in cryptonite README, cryptonite requires disabling "use_target_attributes"
RUN stack install --system-ghc --flag cryptonite:-use_target_attributes
# install
# - as described in cryptonite README, cryptoniate requires disabling "use_target_attributes"
# - for bitvec the "simd" flag added in v1.1.5.0 has to be deactivated - the gcc version here does not seem to support it
RUN stack install --system-ghc --flag cryptonite:-use_target_attributes --flag bitvec:-simd
2 changes: 1 addition & 1 deletion poseidon-analysis-hs.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: poseidon-analysis-hs
version: 1.0.0.1
version: 1.0.0.2
synopsis: A package with analysis-tools to work with Poseidon Genotype Data
description: The tools in this package analyse Poseidon-formatted genotype databases, a modular system for storing genotype data from thousands of individuals.
license: MIT
Expand Down
10 changes: 5 additions & 5 deletions src/Poseidon/Analysis/CLI/FStats.hs
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ runFstats opts = do
collectedStats = collectStatSpecGroups statSpecs
-- new groups can be used on the right hand side of further group definitions, that's why we explicitly exclude them here in the end of the expression
allEntities = nub (concatMap (map underlyingEntity . snd) groupDefs ++ collectedStats) \\ newGroups
checkIfAllEntitiesExist allEntities . getJointIndividualInfo $ allPackages
checkIfAllEntitiesExist allEntities =<< getJointIndividualInfo allPackages

-- annotate all individuals in all packages with the new adhoc-group definitions where necessary
let packagesWithNewGroups = addGroupDefs groupDefs allPackages

-- select only the packages needed for the statistics to be computed
relevantPackageNames <- determineRelevantPackages collectedStats . getJointIndividualInfo $ packagesWithNewGroups
relevantPackageNames <- determineRelevantPackages collectedStats =<< getJointIndividualInfo packagesWithNewGroups
let relevantPackages = filter (flip elem relevantPackageNames . posPacNameAndVersion) packagesWithNewGroups
logInfo $ (show . length $ relevantPackages) ++ " relevant packages for chosen statistics identified:"
mapM_ (logInfo . show . posPacNameAndVersion) relevantPackages
Expand Down Expand Up @@ -230,12 +230,12 @@ type EntityAlleleFreqLookup = M.Map PoseidonEntity (Maybe Double)
-- This functioin builds the central Fold that is run over each block of sites of the input data. The return is a tuple of the internal FStats datatypes and the fold.
buildStatSpecsFold :: (MonadIO m) => [PoseidonPackage] -> [FStatSpec] -> PoseidonIO (FoldM m (EigenstratSnpEntry, GenoLine) BlockData)
buildStatSpecsFold packages fStatSpecs = do
let indInfos = getJointIndividualInfo packages
indivNames = map indInfoName indInfos
indInfoCollection <- getJointIndividualInfo packages
let indivNames = map indInfoName (fst indInfoCollection)
ploidyVec <- makePloidyVec . getJointJanno $ packages
entityIndicesLookup <- do
let collectedSpecs = collectStatSpecGroups fStatSpecs
entityIndices <- sequence [resolveUniqueEntityIndices [s] indInfos | s <- collectedSpecs]
entityIndices <- sequence [resolveUniqueEntityIndices [s] indInfoCollection | s <- collectedSpecs]
return . M.fromList . zip collectedSpecs $ entityIndices
blockAccum <- do
listOfInnerVectors <- forM fStatSpecs $ \(FStatSpec fType _ _) -> do
Expand Down
14 changes: 7 additions & 7 deletions src/Poseidon/Analysis/CLI/RAS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ runRAS rasOpts = do
let newGroups = map (Group . fst) groupDefs
let allEntities = nub (concatMap (map underlyingEntity . snd) groupDefs ++
popLefts ++ popRights ++ outgroupSpec) \\ newGroups
checkIfAllEntitiesExist allEntities . getJointIndividualInfo $ allPackages
checkIfAllEntitiesExist allEntities =<< getJointIndividualInfo allPackages

-- annotate all individuals in all packages with the new adhoc-group definitions where necessary
let packagesWithNewGroups = addGroupDefs groupDefs allPackages

-- select only the packages needed for the statistics to be computed
relevantPackageNames <- determineRelevantPackages (popLefts ++ popRights ++ outgroupSpec) . getJointIndividualInfo $ packagesWithNewGroups
relevantPackageNames <- determineRelevantPackages (popLefts ++ popRights ++ outgroupSpec) =<< getJointIndividualInfo packagesWithNewGroups
let relevantPackages = filter (flip elem relevantPackageNames . posPacNameAndVersion) packagesWithNewGroups
logInfo $ (show . length $ relevantPackages) ++ " relevant packages for chosen statistics identified:"
mapM_ (logInfo . show . posPacNameAndVersion) relevantPackages
Expand Down Expand Up @@ -246,16 +246,16 @@ readPopConfig fn = do

buildRasFold :: (MonadIO m) => [PoseidonPackage] -> FreqSpec -> FreqSpec -> Double -> Maybe PoseidonEntity -> EntitiesList -> EntitiesList -> PoseidonIO (FoldM m (EigenstratSnpEntry, GenoLine) BlockData)
buildRasFold packages minFreq maxFreq maxM maybeOutgroup popLefts popRights = do
let indInfos = getJointIndividualInfo packages
indInfoCollection <- getJointIndividualInfo packages
ploidyVec <- makePloidyVec . getJointJanno $ packages
outgroupI <- case maybeOutgroup of
Nothing -> return []
Just o -> resolveUniqueEntityIndices [o] indInfos
leftI <- sequence [resolveUniqueEntityIndices [l] indInfos | l <- popLefts]
rightI <- sequence [resolveUniqueEntityIndices [r] indInfos | r <- popRights]
Just o -> resolveUniqueEntityIndices [o] indInfoCollection
leftI <- sequence [resolveUniqueEntityIndices [l] indInfoCollection | l <- popLefts]
rightI <- sequence [resolveUniqueEntityIndices [r] indInfoCollection | r <- popRights]
let nL = length popLefts
nR = length popRights
let indivNames = map indInfoName indInfos
let indivNames = map indInfoName (fst indInfoCollection)
return $ FoldM (step ploidyVec indivNames outgroupI leftI rightI) (initialise nL nR) extract
where
step :: (MonadIO m) => PloidyVec -> [String] -> [Int] -> [[Int]] -> [[Int]] -> BlockAccumulator ->
Expand Down
7 changes: 3 additions & 4 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
resolver: lts-20.24
resolver: lts-21.17

packages:
- .
# - ../poseidon-hs

extra-deps:
- git: https://github.com/poseidon-framework/poseidon-hs
commit: 215e0106dc21b3cbe84287da13e47f19cb7c0e61
commit: a760f94e963e171aeb884f855f910d53d92cdef5
- table-layout-0.9.1.0
- data-default-instances-base-0.1.0.1
- sequence-formats-1.7.0
- pipes-ordered-zip-1.2.1
- co-log-0.5.0.0
- co-log-0.6.0.2
- ansi-terminal-0.10.3
- parsec3-numbers-0.1.0
- chronos-1.1.5
- typerep-map-0.5.0.0
allow-newer: true
31 changes: 12 additions & 19 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

packages:
- completed:
commit: 215e0106dc21b3cbe84287da13e47f19cb7c0e61
commit: a760f94e963e171aeb884f855f910d53d92cdef5
git: https://github.com/poseidon-framework/poseidon-hs
name: poseidon-hs
pantry-tree:
sha256: bf36052db164931ca7e91a158d9c1ec282034a4249160b620ece877d2954b7a7
sha256: 0ca7f5e2d425de4f635a32163f1e30bfff23f40218b756f45d26183254607af1
size: 44449
version: 1.4.0.2
version: 1.4.0.3
original:
commit: 215e0106dc21b3cbe84287da13e47f19cb7c0e61
commit: a760f94e963e171aeb884f855f910d53d92cdef5
git: https://github.com/poseidon-framework/poseidon-hs
- completed:
hackage: table-layout-0.9.1.0@sha256:172b8b3a06c992839a781b77e42bbce689ba87d92c260acb61d187f7e6aad7f2,7154
Expand Down Expand Up @@ -44,12 +44,12 @@ packages:
original:
hackage: pipes-ordered-zip-1.2.1
- completed:
hackage: co-log-0.5.0.0@sha256:a7e84650eaef7eba2d59ee7664309e79317a7ca67011abedf971f0e6bd6475bb,5448
hackage: co-log-0.6.0.2@sha256:91c14447cb1cbdd6d76317e80d2acd75efe4d964975a57f9731d8af56a4fba7a,6395
pantry-tree:
sha256: 33b838c07c8b7e70b2e82bddc889bb1e6386d7e12a9d1593c0b4b263b1fcb925
size: 1043
sha256: 2ed9bcc839c3681796dd7ef797bcd65cf73e20fc0c542c94cae0a2532db7b3ba
size: 1198
original:
hackage: co-log-0.5.0.0
hackage: co-log-0.6.0.2
- completed:
hackage: ansi-terminal-0.10.3@sha256:e2fbcef5f980dc234c7ad8e2fa433b0e8109132c9e643bc40ea5608cd5697797,3226
pantry-tree:
Expand All @@ -71,16 +71,9 @@ packages:
size: 581
original:
hackage: chronos-1.1.5
- completed:
hackage: typerep-map-0.5.0.0@sha256:34f1ba9b268a6d52e26ae460011a5571e8099b50a3f4a7c8db25dd8efe3be8ee,4667
pantry-tree:
sha256: ca5565de307d260dc67f6dae0d4d33eee42a3238183461569b5142ceb909c91d
size: 1487
original:
hackage: typerep-map-0.5.0.0
snapshots:
- completed:
sha256: e019cd29e3f7f9dbad500225829a3f7a50f73c674614f2f452e21bb8bf5d99ea
size: 650253
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/24.yaml
original: lts-20.24
sha256: 85d2382958c178491d3fe50d770a624621f5ab456beef7d31ac7521f780c9bc7
size: 640042
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/17.yaml
original: lts-21.17
2 changes: 1 addition & 1 deletion test/Poseidon/Analysis/UtilsSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ testAddGroupDefs = do
("MyNewGroup2", [Include (Ind "XXX011"), Include (Ind "XXX012")])
]
let newPacs = addGroupDefs groupDefs pacs
let indInfo = getJointIndividualInfo newPacs
(indInfo, _) <- getJointIndividualInfo newPacs
(map indInfoGroups . filter ((=="XXX017") . indInfoName) $ indInfo) `shouldBe` [["POP1", "MyNewGroup1"]]
(map indInfoGroups . filter ((=="XXX007") . indInfoName) $ indInfo) `shouldBe` [["POP1", "MyNewGroup1"]]
(map indInfoGroups . filter ((=="XXX011") . indInfoName) $ indInfo) `shouldBe` [["POP1", "MyNewGroup2"]]
Expand Down

0 comments on commit 1448134

Please sign in to comment.