biohazard-0.6.5: bioinformatics support library

Safe HaskellNone



Metadata necessary for a sensible genotyping workflow.



data Sample Source




sample_libraries :: [Library]
sample_avro_files :: HashMap Text Text

maps a region to the av file

sample_bcf_files :: HashMap Text Text

maps a region to the bcf file

sample_div_tables :: HashMap Text (Double, Vector Int)

maps a region to the table needed for div. estimation

sample_divergences :: HashMap Text DivEst

data DivEst Source

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.




point_est :: [Double]
conf_region :: [([Double], [Double])]

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.)