Skip to content

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jmschrei committed Sep 19, 2022
1 parent a9753c2 commit 9f6211d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
8 changes: 5 additions & 3 deletions modisco
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ def save_seqlet_coords(seqlets, dset_name, grp):
save_string_list(string_list=coords_strings,
dset_name=dset_name, grp=grp)

def motif_discovery_main(sequences, attributions, output, max_seqlets):
def motif_discovery_main(sequences, attributions, output, max_seqlets, n_leiden_runs):
(multitask_seqlet_creation_results, metaclustering_results,
metacluster_idx_to_submetacluster_results) = modiscolite.tfmodisco.TFMoDISco(
hypothetical_contribs=attributions, one_hot=sequences,
max_seqlets_per_metacluster=max_seqlets,
sliding_window_size=20,
flank_size=5,
target_seqlet_fdr=0.05,
n_leiden_runs=2)
n_leiden_runs=n_leiden_runs)

########
### Ugly saving code
Expand Down Expand Up @@ -213,6 +213,8 @@ motifs_parser.add_argument("-i", "--h5py", type=str,
help="A legacy h5py file containing the one-hot encoded sequences and shap scores.")
motifs_parser.add_argument("-n", "--max_seqlets", type=int, required=True,
help="The maximum number of seqlets per metacluster.")
motifs_parser.add_argument("-l", "--n_leiden", type=int, default=2,
help="The number of Leiden clusterings to perform with different random seeds.")
motifs_parser.add_argument("-w", "--window", type=int, default=400,
help="The window surrounding the peak center that will be considered for motif discovery.")
motifs_parser.add_argument("-o", "--output", type=str, default="modisco_results.h5",
Expand Down Expand Up @@ -277,7 +279,7 @@ if args.cmd == "motifs":
attributions = attributions[:, :, start:end].transpose(0, 2, 1)

motif_discovery_main(sequences, attributions, args.output,
args.max_seqlets)
args.max_seqlets, args.n_leiden)

elif args.cmd == 'report':
modiscolite.report.report_motifs(args.h5py, args.output, suffix=args.suffix,
Expand Down
2 changes: 1 addition & 1 deletion modiscolite/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
from . import cluster
from . import report

__version__ = '0.0.9'
__version__ = '1.0.0'
7 changes: 4 additions & 3 deletions modiscolite/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def fetch_tomtom_matches(ppm, cwm, motifs_db,
"""

_, fname = tempfile.mkstemp()
_, tomtom_fname = tempfile.mkstemp()

score = np.sum(np.abs(cwm), axis=1)
trim_thresh = np.max(score) * trim_threshold # Cut off anything less than 30% of max score
Expand All @@ -69,11 +70,11 @@ def fetch_tomtom_matches(ppm, cwm, motifs_db,
write_meme_file(trimmed, background, fname)

# run tomtom
cmd = '%s -no-ssc -oc . --verbosity 1 -text -min-overlap 5 -mi 1 -dist pearson -evalue -thresh 10.0 %s %s > .tomtom.tmp' % (tomtom_exec_path, fname, motifs_db)
cmd = '%s -no-ssc -oc . --verbosity 1 -text -min-overlap 5 -mi 1 -dist pearson -evalue -thresh 10.0 %s %s > %s' % (tomtom_exec_path, fname, motifs_db, tomtom_fname)

os.system(cmd)
tomtom_results = pandas.read_csv(".tomtom.tmp", sep="\t", usecols=(1, 5))
os.system("rm .tomtom.tmp")
tomtom_results = pandas.read_csv(tomtom_fname, sep="\t", usecols=(1, 5))
os.system('rm ' + tomtom_fname)
os.system('rm ' + fname)
return tomtom_results

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='modisco-lite',
version='0.0.9',
version='1.0.0',
author='Jacob Schreiber',
author_email='[email protected]',
packages=['modiscolite'],
Expand Down

0 comments on commit 9f6211d

Please sign in to comment.