Skip to content

Commit

Permalink
Version up, update viennarna
Browse files Browse the repository at this point in the history
  • Loading branch information
croots committed Aug 5, 2024
1 parent d9a779f commit 0a99c04
Show file tree
Hide file tree
Showing 10 changed files with 384 additions and 373 deletions.
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ channels:
- defaults
dependencies:
- python>=3.8.1
- viennarna==2.4.18
- viennarna==2.6.4
- setuptools
- wheel
- numpy
16 changes: 12 additions & 4 deletions ostir/ViennaRNA.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import sys
import re
import RNA

import time

# On import check dependencies
dependencies = [which('RNAfold') is not None,
Expand Down Expand Up @@ -98,7 +98,15 @@ def subopt(sequences, constraints, energy_gap, temp = 37.0, dangles = "some"):
constraints = constraints + "."*len(sequences[1])
rna.hc_add_from_db(constraints)

vienna_subopt = rna.subopt(int((energy_gap+2.481)*100))
# Get ahead of VRNA adjustment to suppress warning
_, _, mfe_energy = mfe(sequences, constraints, temp, dangles)
threshold = int((energy_gap+2.481)*100)
if threshold+mfe_energy*100 > 10_000_000:
threshold = -1

vienna_subopt = rna.subopt(threshold)

time.sleep(1)
subopt_output = [[str(output.structure), str(round(output.energy, 3))] for output in vienna_subopt]

subopt_energy = []
Expand All @@ -111,7 +119,7 @@ def subopt(sequences, constraints, energy_gap, temp = 37.0, dangles = "some"):
subopt_output = process_fold_outputs(subopt_output, multi_sequence=False)

for finding in subopt_output:

subopt_energy.append(float(finding[1]))
subopt_basepairing_x.append(finding[2])
subopt_basepairing_y.append(finding[3])
Expand All @@ -120,7 +128,7 @@ def subopt(sequences, constraints, energy_gap, temp = 37.0, dangles = "some"):
return subopt_energy, subopt_basepairing_x, subopt_basepairing_y


def energy(sequences, base_pairing_x, base_pairing_y, Temp, dangles):
def energy(sequences, base_pairing_x, base_pairing_y, Temp, dangles):
if Temp <= 0: raise ValueError("The specified temperature must be greater than zero.")
temp = Temp

Expand Down
10 changes: 6 additions & 4 deletions ostir/ostir.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
rprint = None

OSTIR_VERSION = '1.1.1'
OLDEST_VIENNA = '2.4.18'
OLDEST_VIENNA = '2.6.4'

# The E. coli sequence
Ecoli_anti_Shine_Dalgarno = 'ACCTCCTTA'
Expand Down Expand Up @@ -246,7 +246,7 @@ def _print_output(outdict):
str(start['dG_start_codon']))

console.print(table)

def save_to_csv(column_names, outdict, outfile):
with open(outfile, 'w', encoding='utf8') as output_file:
dict_writer = csv.DictWriter(output_file, column_names, lineterminator="\n")
Expand Down Expand Up @@ -298,7 +298,7 @@ def main():
dest='v',
required=False,
default="1",
help="Sets the verbosity level. Default 0 is quiet, 1 is normal, 2 is verbose",
help="Sets the verbosity level. 0 is quiet, default 1 is normal, 2 is verbose",
)

parser.add_argument(
Expand Down Expand Up @@ -439,6 +439,8 @@ def main():
sys.exit(1)
cmd_kwargs['verbosity'] = int(options.v)
verbosity = cmd_kwargs['verbosity']
else:
verbosity = 1

# Check if viennaRNA is installed
dependencies = [which('RNAfold') is not None,
Expand Down Expand Up @@ -632,7 +634,7 @@ def main():
value_dict['anti-Shine-Dalgarno'] = run_metadata[key].get('anti-Shine-Dalgarno') or run_metadata[key].get('asd') or cmd_kwargs.get('aSD')
result_set.append(value_dict)
results.extend(result_set)


## Output - for all ways of running ##############################################################
if outfile:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setuptools.setup(
name="OSTIR",
version="1.1.2",
version="1.1.3",
author="Cameron Roots, Alexandra Lukasiewicz, Jeffrey Barrick, ",
author_email="[email protected]",
description="Open Source Transcription Initiation Rates",
Expand Down
266 changes: 133 additions & 133 deletions tests/expected/Salis2009.csv

Large diffs are not rendered by default.

397 changes: 199 additions & 198 deletions tests/expected/T7_genome.csv

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions tests/expected/command_line_CSV_input.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name,start_codon,start_position,expression,RBS_distance_bp,dG_total,dG_rRNA:mRNA,dG_mRNA,dG_spacing,dG_standby,dG_start_codon
sequence_1,ATG,38,643.9384,4,2.0289,-8.381,-11.6,0.0039,0.0,-1.194
sequence_1,ATG,71,0.0558,1,25.4101,-4.381,-13.8,17.1851,0.0,-1.194
sequence_1,ATG,89,227.5882,4,4.6289,-0.681,-6.5,0.0039,0.0,-1.194
name,start_codon,start_position,expression,RBS_distance_bp,dG_total,dG_rRNA:mRNA,dG_mRNA,dG_spacing,dG_standby,dG_start_codon
sequence_1,ATG,38,643.9384,4,2.0289,-8.381,-11.6,0.0039,0.0,-1.194
sequence_1,ATG,71,0.0558,1,25.4101,-4.381,-13.8,17.1851,0.0,-1.194
sequence_1,ATG,89,227.5882,4,4.6289,-0.681,-6.5,0.0039,0.0,-1.194
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name,anti-Shine-Dalgarno,sequence,start_codon,start_position,expression,RBS_distance_bp,dG_total,dG_rRNA:mRNA,dG_mRNA,dG_spacing,dG_standby,dG_start_codon
first_sequence,ACCTCCTTA,TTCTAGActttaatttaacgtaaataaggaagtcattATGGCGAGCTCTGAAGACGTTATCAAAGAGTTCATGCGTTTCAAAGTTCGTATGGA,ATG,38,643.9384,4,2.0289,-8.381,-11.6,0.0039,0.0,-1.194
first_sequence,ACCTCCTTA,TTCTAGActttaatttaacgtaaataaggaagtcattATGGCGAGCTCTGAAGACGTTATCAAAGAGTTCATGCGTTTCAAAGTTCGTATGGA,ATG,71,0.0558,1,25.4101,-4.381,-13.8,17.1851,0.0,-1.194
first_sequence,ACCTCCTTA,TTCTAGActttaatttaacgtaaataaggaagtcattATGGCGAGCTCTGAAGACGTTATCAAAGAGTTCATGCGTTTCAAAGTTCGTATGGA,ATG,89,227.5882,4,4.6289,-0.681,-6.5,0.0039,0.0,-1.194
second_sequence,TCTGAAGAC,TTCTAGActttaatttaacgtaaataaggaagtcattATGGCGAGCTCTGAAGACGTTATCAAAGAGTTCATGCGTTTCAAAGTTCGTATGGA,ATG,38,34.6638,7,9.3332,-1.881,-11.6,0.8082,0.0,-1.194
second_sequence,TCTGAAGAC,TTCTAGActttaatttaacgtaaataaggaagtcattATGGCGAGCTCTGAAGACGTTATCAAAGAGTTCATGCGTTTCAAAGTTCGTATGGA,ATG,71,40.1662,6,8.9649,-3.981,-13.8,0.3399,0.0,-1.194
second_sequence,TCTGAAGAC,TTCTAGActttaatttaacgtaaataaggaagtcattATGGCGAGCTCTGAAGACGTTATCAAAGAGTTCATGCGTTTCAAAGTTCGTATGGA,ATG,89,460.8985,6,2.8649,-3.381,-6.5,0.3399,-0.6,-1.194
sequence_3,CCCCCCCCC,TTCTAGActttaatttaacgtaaataaggaagtcattATGGCGAGCTCTGAAGACGTTATCAAAGAGTTCATGCGTTTCAAAGTTCGTATGGA,ATG,38,44.2111,5,8.725,-1.681,-11.6,0.0,0.0,-1.194
sequence_3,CCCCCCCCC,TTCTAGActttaatttaacgtaaataaggaagtcattATGGCGAGCTCTGAAGACGTTATCAAAGAGTTCATGCGTTTCAAAGTTCGTATGGA,ATG,71,0.0017,22,34.1706,-1.681,-13.8,23.2456,0.0,-1.194
name,anti-Shine-Dalgarno,sequence,start_codon,start_position,expression,RBS_distance_bp,dG_total,dG_rRNA:mRNA,dG_mRNA,dG_spacing,dG_standby,dG_start_codon
first_sequence,ACCTCCTTA,TTCTAGActttaatttaacgtaaataaggaagtcattATGGCGAGCTCTGAAGACGTTATCAAAGAGTTCATGCGTTTCAAAGTTCGTATGGA,ATG,38,643.9384,4,2.0289,-8.381,-11.6,0.0039,0.0,-1.194
first_sequence,ACCTCCTTA,TTCTAGActttaatttaacgtaaataaggaagtcattATGGCGAGCTCTGAAGACGTTATCAAAGAGTTCATGCGTTTCAAAGTTCGTATGGA,ATG,71,0.0558,1,25.4101,-4.381,-13.8,17.1851,0.0,-1.194
first_sequence,ACCTCCTTA,TTCTAGActttaatttaacgtaaataaggaagtcattATGGCGAGCTCTGAAGACGTTATCAAAGAGTTCATGCGTTTCAAAGTTCGTATGGA,ATG,89,227.5882,4,4.6289,-0.681,-6.5,0.0039,0.0,-1.194
second_sequence,TCTGAAGAC,TTCTAGActttaatttaacgtaaataaggaagtcattATGGCGAGCTCTGAAGACGTTATCAAAGAGTTCATGCGTTTCAAAGTTCGTATGGA,ATG,38,34.6638,7,9.3332,-1.881,-11.6,0.8082,0.0,-1.194
second_sequence,TCTGAAGAC,TTCTAGActttaatttaacgtaaataaggaagtcattATGGCGAGCTCTGAAGACGTTATCAAAGAGTTCATGCGTTTCAAAGTTCGTATGGA,ATG,71,40.1662,6,8.9649,-3.981,-13.8,0.3399,0.0,-1.194
second_sequence,TCTGAAGAC,TTCTAGActttaatttaacgtaaataaggaagtcattATGGCGAGCTCTGAAGACGTTATCAAAGAGTTCATGCGTTTCAAAGTTCGTATGGA,ATG,89,460.8985,6,2.8649,-3.381,-6.5,0.3399,-0.6,-1.194
sequence_3,CCCCCCCCC,TTCTAGActttaatttaacgtaaataaggaagtcattATGGCGAGCTCTGAAGACGTTATCAAAGAGTTCATGCGTTTCAAAGTTCGTATGGA,ATG,38,44.2111,5,8.725,-1.681,-11.6,0.0,0.0,-1.194
sequence_3,CCCCCCCCC,TTCTAGActttaatttaacgtaaataaggaagtcattATGGCGAGCTCTGAAGACGTTATCAAAGAGTTCATGCGTTTCAAAGTTCGTATGGA,ATG,71,0.0017,22,34.1706,-1.681,-13.8,23.2456,0.0,-1.194
30 changes: 15 additions & 15 deletions tests/expected/command_line_FASTA_input.csv
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name,start_codon,start_position,expression,RBS_distance_bp,dG_total,dG_rRNA:mRNA,dG_mRNA,dG_spacing,dG_standby,dG_start_codon
Seq1-1,ATG,24,53.8087,0,8.2339,-15.981,-8.2,17.2089,0.0,-1.194
Seq1-1,ATG,57,0.0558,1,25.4101,-4.381,-13.8,17.1851,0.0,-1.194
Seq1-1,ATG,75,227.5882,4,4.6289,-0.681,-6.5,0.0039,0.0,-1.194
Seq1-2,ATG,25,54.3225,1,8.2101,-15.981,-8.2,17.1851,0.0,-1.194
Seq1-2,ATG,58,0.0558,1,25.4101,-4.381,-13.8,17.1851,0.0,-1.194
Seq1-2,ATG,76,227.5882,4,4.6289,-0.681,-6.5,0.0039,0.0,-1.194
Seq1-3,ATG,26,72.9191,2,7.4741,-15.981,-8.2,16.4491,0.0,-1.194
Seq1-3,ATG,59,0.0558,1,25.4101,-4.381,-13.8,17.1851,0.0,-1.194
Seq1-3,ATG,77,382.8221,4,3.3289,-0.681,-5.2,0.0039,0.0,-1.194
Seq1-4,ATG,27,6409.905,3,-3.7158,-15.981,-8.2,5.2592,0.0,-1.194
Seq1-4,ATG,60,0.0558,1,25.4101,-4.381,-13.8,17.1851,0.0,-1.194
Seq1-4,ATG,78,571.1179,4,2.3289,-0.681,-4.2,0.0039,0.0,-1.194
Seq1-5,ATG,28,52463.8398,4,-8.9711,-15.981,-8.2,0.0039,0.0,-1.194
Seq1-5,ATG,61,0.0558,1,25.4101,-4.381,-13.8,17.1851,0.0,-1.194
name,start_codon,start_position,expression,RBS_distance_bp,dG_total,dG_rRNA:mRNA,dG_mRNA,dG_spacing,dG_standby,dG_start_codon
Seq1-1,ATG,24,53.8087,0,8.2339,-15.981,-8.2,17.2089,0.0,-1.194
Seq1-1,ATG,57,0.0558,1,25.4101,-4.381,-13.8,17.1851,0.0,-1.194
Seq1-1,ATG,75,227.5882,4,4.6289,-0.681,-6.5,0.0039,0.0,-1.194
Seq1-2,ATG,25,54.3225,1,8.2101,-15.981,-8.2,17.1851,0.0,-1.194
Seq1-2,ATG,58,0.0558,1,25.4101,-4.381,-13.8,17.1851,0.0,-1.194
Seq1-2,ATG,76,227.5882,4,4.6289,-0.681,-6.5,0.0039,0.0,-1.194
Seq1-3,ATG,26,72.9191,2,7.4741,-15.981,-8.2,16.4491,0.0,-1.194
Seq1-3,ATG,59,0.0558,1,25.4101,-4.381,-13.8,17.1851,0.0,-1.194
Seq1-3,ATG,77,382.8221,4,3.3289,-0.681,-5.2,0.0039,0.0,-1.194
Seq1-4,ATG,27,6409.905,3,-3.7158,-15.981,-8.2,5.2592,0.0,-1.194
Seq1-4,ATG,60,0.0558,1,25.4101,-4.381,-13.8,17.1851,0.0,-1.194
Seq1-4,ATG,78,571.1179,4,2.3289,-0.681,-4.2,0.0039,0.0,-1.194
Seq1-5,ATG,28,52463.8398,4,-8.9711,-15.981,-8.2,0.0039,0.0,-1.194
Seq1-5,ATG,61,0.0558,1,25.4101,-4.381,-13.8,17.1851,0.0,-1.194
8 changes: 4 additions & 4 deletions tests/expected/command_line_string_input.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name,sequence,start_codon,start_position,expression,RBS_distance_bp,dG_total,dG_rRNA:mRNA,dG_mRNA,dG_spacing,dG_standby,dG_start_codon
unnamed,TTCTAGAAAAAAAATAAGGAGGTAAAATGGCGAGCTCTGAAGACGTTATCAAAGAGTTCATGCGTTTCAAAGTTCGTATG,ATG,27,6409.905,3,-3.7158,-15.981,-8.2,5.2592,0.0,-1.194
unnamed,TTCTAGAAAAAAAATAAGGAGGTAAAATGGCGAGCTCTGAAGACGTTATCAAAGAGTTCATGCGTTTCAAAGTTCGTATG,ATG,60,0.0558,1,25.4101,-4.381,-13.8,17.1851,0.0,-1.194
unnamed,TTCTAGAAAAAAAATAAGGAGGTAAAATGGCGAGCTCTGAAGACGTTATCAAAGAGTTCATGCGTTTCAAAGTTCGTATG,ATG,78,571.1179,4,2.3289,-0.681,-4.2,0.0039,0.0,-1.194
name,sequence,start_codon,start_position,expression,RBS_distance_bp,dG_total,dG_rRNA:mRNA,dG_mRNA,dG_spacing,dG_standby,dG_start_codon
unnamed,TTCTAGAAAAAAAATAAGGAGGTAAAATGGCGAGCTCTGAAGACGTTATCAAAGAGTTCATGCGTTTCAAAGTTCGTATG,ATG,27,6409.905,3,-3.7158,-15.981,-8.2,5.2592,0.0,-1.194
unnamed,TTCTAGAAAAAAAATAAGGAGGTAAAATGGCGAGCTCTGAAGACGTTATCAAAGAGTTCATGCGTTTCAAAGTTCGTATG,ATG,60,0.0558,1,25.4101,-4.381,-13.8,17.1851,0.0,-1.194
unnamed,TTCTAGAAAAAAAATAAGGAGGTAAAATGGCGAGCTCTGAAGACGTTATCAAAGAGTTCATGCGTTTCAAAGTTCGTATG,ATG,78,571.1179,4,2.3289,-0.681,-4.2,0.0039,0.0,-1.194

0 comments on commit 0a99c04

Please sign in to comment.