Safe Haskell | None |
---|---|
Language | Haskell98 |
Metadata necessary for a sensible genotyping workflow.
- data Sample = Sample {}
- data Library = Library {}
- data DivEst = DivEst {
- point_est :: [Double]
- conf_region :: [([Double], [Double])]
- type Metadata = HashMap Text Sample
- readMetadata :: FilePath -> IO Metadata
- updateMetadata :: (Metadata -> Metadata) -> FilePath -> IO ()
- split_sam_rgns :: Metadata -> [String] -> [(String, [Maybe String])]
Documentation
Sample | |
|
Library | |
|
Divergence estimate. Lists contain three or four floats, these are divergence, heterozygosity at W sites, heterozygosity at S sites, and optionally gappiness in this order.
readMetadata :: FilePath -> IO Metadata Source
Read the configuration file. Retries, because NFS tends to result
in ResourceVanished
if the file is replaced while we try to read it.
updateMetadata :: (Metadata -> Metadata) -> FilePath -> IO () Source
Update the configuration file. Open a new file (fn++"~new") in exclusive mode. Then read the old file, write the update to the new file, rename it atomically, then close it. Use of O_EXCL should ensure that nobody interferes. This is atomic even on NFS, provided NFS and kernel are new enough. For older NFS, I cannot be bothered.
(The first idea was to base this on the supposed fact that link(2) is atomic and fails if the new filename exists. This approach does seem to contain a race condition, though.)