Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ Output base pairing probability matrix to a file with user specified name (overw
```
Outputs base pairing probability matrices to files with user specified prefix. (default False)
```
--unpaired FILE_NAME
```
Output unpaired probability for each nuc and average unpaired probability (AUP) to a file with user specified name. (default False)
```
--access_u or -U
```
Print the accessible U%. (default False)
```
--part or -p
```
Partition function calculation only. (default False)
Expand Down
15 changes: 13 additions & 2 deletions linearpartition
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def setgflags():
flags.DEFINE_boolean('fasta', False, "input is in fasta format") # FASTA format
flags.DEFINE_integer('dangles', 2, "the way to treat `dangling end' energies for bases adjacent to helices in free ends and multi-loops (only supporting `0' or `2', default=`2')", short_name="d")
flags.DEFINE_string('evaly', "", "batch eval all sequences against structure for p(y|x)", short_name='y') # p(y|x)
flags.DEFINE_string('unpaired', '', "output unpaired probability for each nuc and average unpaired probability (AUP)") # AUP
flags.DEFINE_boolean('access_u', False, "Output the percentage of unpaired U", short_name='U') # accessible U%
argv = FLAGS(sys.argv)

def main():
Expand All @@ -52,8 +54,11 @@ def main():
is_fasta = '1' if FLAGS.fasta else '0'
dangles = str(FLAGS.dangles)
evaly = FLAGS.evaly
unpaired_file = str(FLAGS.unpaired)
access_u = '1' if FLAGS.U else '0'

if FLAGS.p and (FLAGS.o or FLAGS.prefix):

if FLAGS.p and (FLAGS.o or FLAGS.prefix or FLAGS.unpaired):
print("\nWARNING: -p mode has no output for base pairing probability matrix!\n");

if FLAGS.o and FLAGS.r:
Expand Down Expand Up @@ -85,8 +90,14 @@ def main():
if FLAGS.evaly:
use_vienna = True # eval p(y|x) only in Vienna mode

if FLAGS.unpaired:
if os.path.exists(unpaired_file):
print("WARNING: unpaired output file already exists. Choose another name.\n")
print("Exit!\n")
exit()

path = os.path.dirname(os.path.abspath(__file__))
cmd = ["%s/%s" % (path, ('bin/linearpartition_v' if use_vienna else 'bin/linearpartition_c')), beamsize, is_sharpturn, is_verbose, bpp_file, bpp_prefix, pf_only, bpp_cutoff, forest_file, mea, gamma, TK, threshold, ThreshKnot_prefix, MEA_prefix, MEA_bpseq, shape_file_path, is_fasta, dangles, evaly]
cmd = ["%s/%s" % (path, ('bin/linearpartition_v' if use_vienna else 'bin/linearpartition_c')), beamsize, is_sharpturn, is_verbose, bpp_file, bpp_prefix, pf_only, bpp_cutoff, forest_file, mea, gamma, TK, threshold, ThreshKnot_prefix, MEA_prefix, MEA_bpseq, shape_file_path, is_fasta, dangles, evaly, unpaired_file, access_u]
subprocess.call(cmd, stdin=sys.stdin)

if __name__ == '__main__':
Expand Down
Loading