Skip to content

Commit

Permalink
cluster snps to process reference once
Browse files Browse the repository at this point in the history
  • Loading branch information
davek44 committed Sep 11, 2023
1 parent dd1250d commit 4799a4e
Show file tree
Hide file tree
Showing 4 changed files with 400 additions and 152 deletions.
22 changes: 16 additions & 6 deletions src/baskerville/scripts/hound_snp.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import pdb
import pickle
import os
from baskerville.snps import calculate_sad
from baskerville.snps import score_snps

"""
hound_snp.py
Expand All @@ -31,6 +31,13 @@
def main():
usage = "usage: %prog [options] <params_file> <model_file> <vcf_file>"
parser = OptionParser(usage)
parser.add_option(
"-c",
dest="cluster_snps_pct",
default=0,
type="float",
help="Cluster SNPs within a %% of the seq length to make a single ref pred [Default: %default]",
)
parser.add_option(
"-f",
dest="genome_fasta",
Expand Down Expand Up @@ -66,8 +73,8 @@ def main():
)
parser.add_option(
"--stats",
dest="sad_stats",
default="SAD",
dest="snp_stats",
default="logSAD",
help="Comma-separated list of stats to save. [Default: %default]",
)
parser.add_option(
Expand Down Expand Up @@ -129,17 +136,20 @@ def main():
else:
parser.error("Must provide parameters and model files and QTL VCF file")

if options.targets_file is None:
parser.error("Must provide targets file")

if not os.path.isdir(options.out_dir):
os.mkdir(options.out_dir)

options.shifts = [int(shift) for shift in options.shifts.split(",")]
options.sad_stats = options.sad_stats.split(",")
options.snp_stats = options.snp_stats.split(",")

# calculate SAD scores:
if options.processes is not None:
calculate_sad(params_file, model_file, vcf_file, worker_index, options)
score_snps(params_file, model_file, vcf_file, worker_index, options)
else:
calculate_sad(params_file, model_file, vcf_file, 0, options)
score_snps(params_file, model_file, vcf_file, 0, options)


################################################################################
Expand Down
20 changes: 17 additions & 3 deletions src/baskerville/scripts/hound_snp_slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ def main():
parser = OptionParser(usage)

# snp
parser.add_option(
"-c",
dest="cluster_snps_pct",
default=0,
type="float",
help="Cluster SNPs within a %% of the seq length to make a single ref pred [Default: %default]",
)
parser.add_option(
"-f",
dest="genome_fasta",
Expand Down Expand Up @@ -69,8 +76,8 @@ def main():
)
parser.add_option(
"--stats",
dest="sad_stats",
default="SAD",
dest="snp_stats",
default="logSAD",
help="Comma-separated list of stats to save. [Default: %default]",
)
parser.add_option(
Expand All @@ -80,12 +87,19 @@ def main():
type="str",
help="File specifying target indexes and labels in table format",
)
parser.add_option(
"-u",
dest="untransform_old",
default=False,
action="store_true",
help="Untransform old models [Default: %default]",
)

# multi
parser.add_option(
"-e",
dest="conda_env",
default="tf210",
default="tf12",
help="Anaconda environment [Default: %default]",
)
parser.add_option(
Expand Down
Loading

0 comments on commit 4799a4e

Please sign in to comment.