Skip to content

Commit

Permalink
fixing sonarqube
Browse files Browse the repository at this point in the history
  • Loading branch information
mfl15 committed Oct 23, 2023
1 parent fc99cce commit 6a05aeb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 29 deletions.
26 changes: 0 additions & 26 deletions srcs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,32 +155,6 @@ def remove_corr_organisms_from_ref(sig_info_dict: Dict[str, Tuple[str, float, in
manifest_df = pd.DataFrame(manifest_df, columns=['organism_name', 'md5sum', 'num_unique_kmers_in_genome_sketch', 'num_total_kmers_in_genome_sketch', 'genome_scale_factor'])

return rep_remove_dict, manifest_df

# def compute_sample_vector(sample_hashes, hash_to_idx):
# """
# Helper function that computes the sample vector for a given sample signature.
# :param sample_hashes: hashes in the sample signature
# :param hash_to_idx: dictionary mapping hashes to indices in the training dictionary
# :return: numpy array (sample vector)
# """
# # total number of hashes in the training dictionary
# hash_to_idx_keys = set(hash_to_idx.keys())

# # total number of hashes in the sample
# sample_hashes_keys = set(sample_hashes.keys())

# # initialize the sample vector
# sample_vector = np.zeros(len(hash_to_idx_keys))

# # get the hashes that are in both the sample and the training dictionary
# sample_intersect_training_hashes = hash_to_idx_keys.intersection(sample_hashes_keys)

# # fill in the sample vector
# for sh in tqdm(sample_intersect_training_hashes):
# sample_vector[hash_to_idx[sh]] = sample_hashes[sh]

# return sample_vector


class Prediction:
"""
Expand Down
7 changes: 4 additions & 3 deletions tests/unittests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import math
import pytest
import pandas as pd
import os
Expand Down Expand Up @@ -69,14 +70,14 @@ def test_get_cami_profile():
prediction1 = profile[0]
assert prediction1.rank == 'superkingdom'
assert prediction1.taxid == '2157'
assert prediction1.percentage == 0.029528
assert math.isclose(prediction1.percentage, 0.029528, abs_tol=1e-6)
assert prediction1.taxpath == '2157'
assert prediction1.taxpathsn == 'Archaea'

prediction2 = profile[1]
assert prediction2.rank == 'superkingdom'
assert prediction2.taxid == '2'
assert prediction2.percentage == 29.183763
assert math.isclose(prediction2.percentage, 29.183763, rel_tol=1e-6)
assert prediction2.taxpath == '2'
assert prediction2.taxpathsn == 'Bacteria'

Expand All @@ -87,7 +88,7 @@ def test_get_alt_mut_rate():
significance = 0.99
result = get_alt_mut_rate(nu, thresh, ksize, significance)
expected_result = 0.047902071844405425
assert result == expected_result
assert math.isclose(result, expected_result, rel_tol=1e-6, abs_tol=1e-6)

def test_get_alt_mut_rate_zero_nu():
nu = 0
Expand Down

0 comments on commit 6a05aeb

Please sign in to comment.