Skip to content

Commit

Permalink
v0.3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
asistradition committed Mar 11, 2022
1 parent 75ec112 commit 3a4599f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### Version 0.3.6

* Fix bug in saved location output

### Version 0.3.5

* Fix bug when no regulators are found and saving locations is set.
Expand Down
13 changes: 8 additions & 5 deletions inferelator_prior/network_from_motifs.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,15 @@ def network_scan_build_single_tf(tf_mi_df):
# MULTIPROCESS PER-TF ##########################################################################################
prior_matrix, raw_matrix, prior_data = [], [], []

with pathos.multiprocessing.Pool(processes=num_cores, maxtasksperchild=50) as pool:
with pathos.multiprocessing.Pool(processes=num_cores, maxtasksperchild=10) as pool:
motif_information = [df for _, df in motif_information.groupby(MOTIF_NAME_COL)]
_is_first = True
for i, res in enumerate(pool.imap_unordered(network_scan_build_single_tf, motif_information)):

if save_locs and res[1] is not None:
res[1].to_csv(save_locs, sep="\t", mode="w" if i == 0 else "a", header=i == 0)
res[1].iloc[:, 0:-1].to_csv(save_locs, sep="\t", mode="w" if _is_first else "a",
header=_is_first, index=False)
_is_first = False

p_m, r_m, p_d = res[0]

Expand Down Expand Up @@ -348,7 +351,7 @@ def network_scan_build_single_tf(tf_mi_df):
(prior_matrix != 0).astype(int).to_csv(output_prefix + "_edge_matrix.tsv.gz", sep="\t")

if save_locs_filtered and prior_data is not None:
prior_data.to_csv(save_locs_filtered, sep="\t")
prior_data.to_csv(save_locs_filtered, sep="\t", index=False)

return prior_matrix, raw_matrix, prior_data

Expand Down Expand Up @@ -414,7 +417,7 @@ def network_scan(motifs, motif_information, genes, genomic_fasta_file, constrain

if save_locs and motif_peaks is not None:
print(f"Writing output file {save_locs}")
motif_peaks.to_csv(save_locs, sep="\t")
motif_peaks.iloc[:, 0:-1].to_csv(save_locs, sep="\t", index=False)

# PROCESS CHROMATIN PEAKS INTO NETWORK MATRIX ######################################################################

Expand Down Expand Up @@ -453,7 +456,7 @@ def network_build(raw_matrix, prior_data, num_cores=1, output_prefix=None, debug

if save_locs_filtered and output_prefix is not None and prior_data is not None:
print(f"Writing output file {save_locs_filtered}")
prior_data.to_csv(save_locs_filtered, sep="\t")
prior_data.to_csv(save_locs_filtered, sep="\t", index=False)

return prior_matrix, raw_matrix, prior_data

Expand Down
2 changes: 1 addition & 1 deletion inferelator_prior/network_from_motifs_fasta.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def build_motif_prior_from_fasta(motif_file, promoter_fasta_file, scanner_type='

if save_locs:
save_locs = output_prefix + "_tf_binding_locs.tsv"
motif_peaks.to_csv(save_locs, sep="\t")
motif_peaks.to_csv(save_locs, sep="\t", index=False)

if save_locs_filtered:
save_locs_filtered = output_prefix + "_tf_binding_locs_filtered.tsv"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

install_requires = ["numpy", "pandas>=1.0", "HTSeq", "pybedtools", "scipy", "pathos", "sklearn", "tqdm"]
tests_require = ["coverage", "nose", "pysam"]
version = "0.3.5"
version = "0.3.6"

# Description from README.md
base_dir = os.path.dirname(os.path.abspath(__file__))
Expand Down

0 comments on commit 3a4599f

Please sign in to comment.