Skip to content

Commit

Permalink
Merge pull request #47 from CenterForMedicalGeneticsGhent/v1.1.2
Browse files Browse the repository at this point in the history
V1.1.2
  • Loading branch information
matthdsm authored Jul 2, 2019
2 parents f864c37 + 9fd8baa commit 2ec85d7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /usr/bin/env python
from setuptools import setup, find_packages

version = '1.1.1'
version = '1.1.2'
dl_version = 'master' if 'dev' in version else '{}'.format(version)

setup(
Expand Down
5 changes: 5 additions & 0 deletions wisecondorX/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ def tool_test(args):
results_w = np.append(results_w * np.nanmedian(results_w_2),
results_w_2 * np.nanmedian(results_w))
results_w = results_w / np.nanmedian(results_w)

if np.isnan(results_w).any() or np.isinf(results_w).any():
logging.warning('Non-numeric values found in weights -- reference too small. Circular binary segmentation and z-scoring will be unweighted')
results_w = np.ones(len(results_w))

ref_sizes = np.append(ref_sizes, ref_sizes_2)

null_ratios = np.array(
Expand Down
3 changes: 2 additions & 1 deletion wisecondorX/newref_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def train_gender_model(samples):

cut_off = gmm_x[local_min_i][0]

# plot(cut_off)

genders[y_fractions > cut_off] = 'M'
genders[y_fractions < cut_off] = 'F'

Expand Down Expand Up @@ -181,7 +183,6 @@ def get_reference(pca_corrected_data, masked_bins_per_chr, masked_bins_per_chr_c
ref = sample[index_array[bin_i - start_num]]
r = np.log2(sample[bin_i] / np.median(ref))
null_ratio_array[bin_i - start_num][null_i] = r

return index_array, distance_array, null_ratio_array


Expand Down
4 changes: 3 additions & 1 deletion wisecondorX/overall_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ def get_z_score(results_c, results):
null_segments = [np.ma.average(x, weights=segment_w) for x in np.transpose(segment_nr)]
null_mean = np.ma.mean([x for x in null_segments if np.isfinite(x)])
null_sd = np.ma.std([x for x in null_segments if np.isfinite(x)])
zs.append((segment[3] - null_mean) / null_sd)
z = (segment[3] - null_mean) / null_sd
z = min(z, 1000) ; z = max(z, -1000)
zs.append(z)
return zs


Expand Down
2 changes: 1 addition & 1 deletion wisecondorX/predict_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def _normalize_once(test_data, test_copy, ref_file, optimal_cutoff, ct, cp, ap):
'''
The means of sets of within-sample reference
distances can serve as inverse weights for
CBS and Stouffer's z-scoring.
CBS, Z-scoring and plotting.
'''


Expand Down

0 comments on commit 2ec85d7

Please sign in to comment.