repare 0.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of repare might be problematic. Click here for more details.
- repare/__init__.py +4 -0
- repare/main.py +64 -0
- repare/pedigree.py +1214 -0
- repare/pedigree_reconstructor.py +874 -0
- repare-0.0.2.dist-info/METADATA +35 -0
- repare-0.0.2.dist-info/RECORD +10 -0
- repare-0.0.2.dist-info/WHEEL +5 -0
- repare-0.0.2.dist-info/entry_points.txt +2 -0
- repare-0.0.2.dist-info/licenses/LICENSE +7 -0
- repare-0.0.2.dist-info/top_level.txt +1 -0
repare/__init__.py
ADDED
repare/main.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import logging
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
from tqdm.contrib.logging import logging_redirect_tqdm
|
|
6
|
+
|
|
7
|
+
from repare.pedigree_reconstructor import PedigreeReconstructor
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def parse_arguments():
|
|
11
|
+
parser = argparse.ArgumentParser(description="Build and analyze pedigrees.")
|
|
12
|
+
parser.add_argument("-n", "--nodes", type=str, required=True, help="Path to the nodes CSV file.")
|
|
13
|
+
parser.add_argument("-r", "--relations", type=str, required=True, help="Path to the relations CSV file.")
|
|
14
|
+
parser.add_argument(
|
|
15
|
+
"-o",
|
|
16
|
+
"--output",
|
|
17
|
+
type=str,
|
|
18
|
+
default=".",
|
|
19
|
+
help="Directory to save the output files. Defaults to the current directory.",
|
|
20
|
+
)
|
|
21
|
+
parser.add_argument(
|
|
22
|
+
"-m",
|
|
23
|
+
"--max_candidate_pedigrees",
|
|
24
|
+
type=int,
|
|
25
|
+
default=1000,
|
|
26
|
+
help="Number of pedigrees to keep after each iteration. Default is 100.",
|
|
27
|
+
)
|
|
28
|
+
parser.add_argument(
|
|
29
|
+
"-e", "--epsilon", type=float, default=0.2, help="Epsilon value for the simulation. Default is 0.2."
|
|
30
|
+
)
|
|
31
|
+
parser.add_argument("-s", "--seed", type=int, default=42, help="Random seed for reproducibility. Default is 42.")
|
|
32
|
+
parser.add_argument("-d", "--do_not_plot", action="store_false", help="Do not plot reconstructed pedigree(s).")
|
|
33
|
+
parser.add_argument(
|
|
34
|
+
"-w", "--write_alternates", action="store_true", help="Write outputs of alternate pedigrees to disk."
|
|
35
|
+
)
|
|
36
|
+
parser.add_argument("-v", "--verbose", action="store_true", help="Enable verbose output (INFO-level logging).")
|
|
37
|
+
return parser.parse_args()
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def main():
|
|
41
|
+
args = parse_arguments()
|
|
42
|
+
logging_level = logging.INFO if args.verbose else logging.WARNING
|
|
43
|
+
logging.basicConfig(level=logging_level, format="%(levelname)s - %(message)s")
|
|
44
|
+
|
|
45
|
+
output_dir = args.output
|
|
46
|
+
if not os.path.exists(output_dir):
|
|
47
|
+
os.makedirs(output_dir, exist_ok=True)
|
|
48
|
+
|
|
49
|
+
with logging_redirect_tqdm():
|
|
50
|
+
pedigree_reconstructor = PedigreeReconstructor(
|
|
51
|
+
relations_path=args.relations,
|
|
52
|
+
nodes_path=args.nodes,
|
|
53
|
+
outputs_dir=output_dir,
|
|
54
|
+
max_candidate_pedigrees=args.max_candidate_pedigrees,
|
|
55
|
+
epsilon=args.epsilon,
|
|
56
|
+
plot=args.do_not_plot,
|
|
57
|
+
write_alternate_pedigrees=args.write_alternates,
|
|
58
|
+
random_seed=args.seed,
|
|
59
|
+
)
|
|
60
|
+
pedigree_reconstructor.find_best_pedigree()
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
if __name__ == "__main__":
|
|
64
|
+
main()
|