Skip to content

Commit

Permalink
Updating runtime estimates and prints
Browse files Browse the repository at this point in the history
  • Loading branch information
rjandr committed Mar 11, 2021
1 parent 7d353a3 commit 82e0211
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
20 changes: 10 additions & 10 deletions ScanFold/ScanFold-Fold_IGV.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,8 +703,7 @@ def scramble(text, randomizations, type):
#Generate nucleotide dictionary to assign each nucleotide in sequence a key
nuc_dict = NucleotideDictionary(lines)
step_size, window_size = get_step_win(lines)
print("Sequence length: "+str(len(nuc_dict))+"nt")
# if len(nuc_dict) > 1000:
print("Sequence length: "+str(len(nuc_dict))+"nt. Check if same as above.") # if len(nuc_dict) > 1000:
# raise SystemExit('Input sequence is longer than 1000 nt; in order to scan longer sequences consider using the stand alone programs (avaiable here: https://github.com/moss-lab/ScanFold)')

#Determine start and end coordinate values
Expand All @@ -718,7 +717,7 @@ def scramble(text, randomizations, type):


#Iterate through input file, read each rows metrics, sequence, etc.
print("Reading sequence and structures...")
#print("Reading sequence and structures...")

for row in lines:

Expand Down Expand Up @@ -927,7 +926,7 @@ def scramble(text, randomizations, type):
#Iterate through initial i-nuc dictionary to determine best base pairs (round 1)
# elapsed_time = round((time.time() - start_time), 2)
# print("Elapsed time: "+str(elapsed_time)+"s")
print("Determining best base pairs...")
#print("Determining best base pairs...")
for k, v in sorted(bp_dict.items()):
#Initiate local dictionaries to store metrics per nucleotide
zscore_dict = {}
Expand Down Expand Up @@ -1091,7 +1090,7 @@ def scramble(text, randomizations, type):
#Iterate through round 1 i-j pairs
if competition == 1:
#print(start_coordinate, end_coordinate)
print("Detecting competing pairs...")
#print("Detecting competing pairs...")
j_coord_list = []
# for k, v in sorted(best_bps.items()):
# print(jcoordinate)
Expand Down Expand Up @@ -1263,22 +1262,22 @@ def scramble(text, randomizations, type):
if competition == 0:
# elapsed_time = str(round((time.time() - start_time), 2))+"s"
# print("Elapsed time: "+elapsed_time)
print("Writing DP files, can not write CT files...")
#print("Writing DP files, can not write CT files...")
if filter != None:
write_dp(best_bps, output+str(filter)+".dp", filter)
write_dp(best_bps, out1, float(10))
write_dp(best_bps, out2, float(-1))
write_dp(best_bps, out3, float(-2))
write_dp(best_bps, output+"mean_"+str(round(meanz, 2))+".dp", meanz)
write_dp(best_bps, output+"below_mean_"+str(round(one_sig_below, 2))+".dp", one_sig_below)
print("ScanFold-Fold complete, find results in...")
#print("ScanFold-Fold complete, find results in...")

#Write CT files
if competition == 1:
#print("Trying to write CT files with -c option")
# elapsed_time = str(round((time.time() - start_time), 2))+"s"
# print(elapsed_time)
print("Writing CT files")
#print("Writing CT files")

# if filter != None or filter != -2:
# write_ct(final_partners, output+str(filter)+".ct", filter, strand)
Expand Down Expand Up @@ -1332,7 +1331,8 @@ def scramble(text, randomizations, type):
#If specified, refold and generate global fold of input sequence
if global_refold == True:
#fold the full fasta input as a fold compound (full_fc) using model params (md)
print("Refolding full sequence using ScanFold results as constraints...")
print("\nRefolding full sequence using ScanFold results as constraints...")
print(f'Remaining time: {round((math.exp(length*0.0007))/60, 2)} minutes')
# elapsed_time = round((time.time() - start_time), 2)
# print("Elapsed time: "+str(elapsed_time)+"s")

Expand Down Expand Up @@ -1562,5 +1562,5 @@ def scramble(text, randomizations, type):
se.write('\n')

dbn_log_file.close()
print("ScanFold-Fold analysis complete! Refresh page to ensure proper loading of IGV")
print("IGV-ScanFold analysis complete! please report any issues at https://github.com/ResearchIT/IGV-ScanFold/issues\n")
#print(url)
8 changes: 4 additions & 4 deletions ScanFold/ScanFold-Scan_IGV.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def transcribe(seq):
length = len(seq)
record_name = name

print("Sequence Length: "+str(len(seq))+"nt")
print("\n\nScanFold-Scan running now. \nSequence Length: "+str(len(seq))+"nt")
number_windows = ((length+1)-window_size)/step_size
#print(number_windows)
if number_windows < float(1.0):
Expand Down Expand Up @@ -460,13 +460,13 @@ def transcribe(seq):
if split == "on":
print("Completed ScanFold-Scan, intial results shown below.\n ScanFold-Fold is running now")

elapsed_time = round((time.time() - start_time), 2)
print(f'Elapsed time: {round(elapsed_time/60, 2)} minutes')
print(f'\nScanFold-Fold running now - Remaining time: {round(((int(length)*0.05)/60), 2)} minutes')


print("Mean MFE = "+str(mean_MFE))
print("Mean Z-score = "+str(mean_zscore))
print("Mean P-value = "+str(mean_pscore))
print("Mean Ensemble Diversity = "+str(mean_ED))
print("ScanFold-Scan complete, find output files below")
elapsed_time = round((time.time() - start_time), 2)
print(f'Elapsed time: {round(elapsed_time/60, 2)} minutes')
print(f'\nScanFold-Fold running now - Remaining time: {round(((int(length)*0.05)/60), 2)} minutes')
4 changes: 2 additions & 2 deletions ScanFold/ScanFoldSharedIGV.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def makedbn(ctfile, name, dbnfullname):
icoord = int(rows[0])
jcoord = int(rows[-2])
if len(rows[1]) > 1:
print("skipping header")
#print("skipping header")
continue

elif int(rows[-2]) == 0:
Expand All @@ -293,7 +293,7 @@ def makedbn(ctfile, name, dbnfullname):
if lcoord == 0:
pass
elif lcoord < icoord:
print('Non-nested pair found: '+str(lcoord)+' to '+str(kcoord))
#print('Non-nested pair found: '+str(lcoord)+' to '+str(kcoord))
dot += '<'
break
else:
Expand Down

0 comments on commit 82e0211

Please sign in to comment.