Skip to content

Commit

Permalink
Merge pull request #57 from Jumitti/beta
Browse files Browse the repository at this point in the history
Beta
  • Loading branch information
Jumitti authored May 2, 2024
2 parents f9d5267 + 679aefc commit c614683
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
13 changes: 7 additions & 6 deletions TFinder-v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,13 @@ def load_lottiefile(filepath: str):

# streamlit_analytics.stop_tracking()
# views = streamlit_analytics.main.counts["total_pageviews"]
local_test = platform.processor()
if local_test == "":
unique_users = st.secrets['unique_users']
st.sidebar.markdown(f"Unique users 👥: {unique_users}")
st.session_state["LOCAL"] = 'False'
else:
try:
local_test = platform.processor()
if local_test == "":
unique_users = st.secrets['unique_users']
st.sidebar.markdown(f"Unique users 👥: {unique_users}")
st.session_state["LOCAL"] = 'False'
except Exception as e:
st.session_state["LOCAL"] = 'True'
st.sidebar.markdown(f"TFinder Local Version")

Expand Down
2 changes: 1 addition & 1 deletion clock.time
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Last updated at 14:21 on 2023-11-06
Last updated at 09:04 on 2024-05-02
10 changes: 4 additions & 6 deletions tfinder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,11 @@ def transform_matrix(matrix):

@staticmethod
# Generate random sequences for p_value
def generate_ranseq(probabilities, seq_length, progress_bar, num_random_seqs):
def generate_ranseq(probabilities, seq_length, progress_bar):
motif_length = seq_length
random_sequences = []

for _ in range(num_random_seqs):
for _ in range(1000000):
random_sequence = IMO.generate_random_sequence(motif_length, probabilities)
random_sequences.append(random_sequence)
progress_bar.update(1)
Expand Down Expand Up @@ -479,8 +479,6 @@ def individual_motif_finder(dna_sequences, threshold, matrix, progress_bar, calc

matrices = IMO.transform_matrix(matrix)

num_random_seqs = 1000000

seq_length = len(matrices['+ f']['A'])

if calc_pvalue == 'ATGCPreset':
Expand All @@ -491,7 +489,7 @@ def individual_motif_finder(dna_sequences, threshold, matrix, progress_bar, calc

probabilities = [percentage_a, percentage_c, percentage_g, percentage_t]

random_sequences = IMO.generate_ranseq(probabilities, seq_length, progress_bar, num_random_seqs)
random_sequences = IMO.generate_ranseq(probabilities, seq_length, progress_bar)

random_scores = {}
matrix_random_scores = []
Expand Down Expand Up @@ -525,7 +523,7 @@ def individual_motif_finder(dna_sequences, threshold, matrix, progress_bar, calc

probabilities = [percentage_a, percentage_c, percentage_g, percentage_t]

random_sequences = IMO.generate_ranseq(probabilities, seq_length, progress_bar, num_random_seqs)
random_sequences = IMO.generate_ranseq(probabilities, seq_length, progress_bar)

if calc_pvalue == 'ATGCProportion':
random_scores = {}
Expand Down

0 comments on commit c614683

Please sign in to comment.