-
Notifications
You must be signed in to change notification settings - Fork 0
/
RNAprobing.pl
executable file
·733 lines (636 loc) · 25.1 KB
/
RNAprobing.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
#!/usr/bin/env perl
#===============================================================================
#
# FILE: RNAprobing.pl
#
# USAGE: ./RNAprobing.pl
#
# DESCRIPTION: this script generates a RDAT file given a RNA sequence in FASTA
# format and a file describing the reactivities of a chemical
#
# OPTIONS: -h, --help Display help message
# --fasta Fasta file containing RNA sequence to be probed
# --chemical Chemical file describing the reactivities of the
# probing reagent
# -v, --verbose
#
# REQUIREMENTS: RNAlib Perl bindings
# BUGS:
# NOTES:
# AUTHOR: Christoph Kaempf (CK), [email protected]
# ORGANIZATION:
# VERSION: 1.0
# CREATED: 12.09.2012 12:53:10
# REVISION:
#===============================================================================
use strict;
use warnings;
use utf8;
use Getopt::Long;
use Data::Dumper;
use File::Basename;
use Log::Log4perl qw(get_logger :levels);
use Path::Class;
use Pod::Usage;
use RNA;
use Scalar::Util;
use Scalar::Util::Numeric;
my $module_dir = dirname(__FILE__);
push(@INC, $module_dir);
################################################################################
#
# Options section
#
################################################################################
my $help = 0;
my $man = 0;
my $rdat_file;
my $fasta_file;
my $chemical_file;
my $dbn_file;
my $samples = 1000;
my $offset = 0;
my ($seqpos_begin, $seqpos_end);
my $verbose = 0;
GetOptions(
"help|h" => \$help,
"man|m" => \$man,
"fasta|f=s" => \$fasta_file,
"chemical|c=s" => \$chemical_file,
"dbn|d=s" => \$dbn_file,
"samples=i" => \$samples,
"offset|o=i" => \$offset,
"begin|b=i" => \$seqpos_begin,
"end|e=i" => \$seqpos_end,
"verbose|v+" => \$verbose);
if ( $help ){
pod2usage( { -verbose => 1,
-message => "Use this script like this:\n"});
} elsif ( !(defined $fasta_file || defined $dbn_file)
|| (defined $fasta_file && defined $dbn_file) ) {
pod2usage( { -verbose => 1,
-message => "Either --fasta or --dbn must be set. Not both:\n"});
} elsif ( !(defined $chemical_file) ) {
pod2usage( { -verbose => 1,
-message => "Please set --chemical:\n"});
} elsif ($man) {
pod2usage( { -verbose => 2});
}
###############################################################################
#
# Logger initiation
#
###############################################################################
my $this_file = __FILE__;
my $log4perl_conf = file(dirname($this_file), "RNAprobing.log.conf");
# Apply configuration to the logger
Log::Log4perl->init("$log4perl_conf");
# Get the loggerperl file
my $logger_name = "RNAprobing";
my $logger = &configureLogger($verbose, $logger_name);
$logger->info("++++ ".__FILE__." has been started. ++++");
# require RNAprobing classes just after logger initialization
require RNAprobing::Chemical;
require RNAprobing::RDATFile;
require RNAprobing::RDATFile::Annotation;
require RNAprobing::RDATFile::Data;
require RNAprobing::OFFFile;
###############################################################################
#
# Program logic
#
###############################################################################
# Input needed is a FASTA file and a reactivity file
my ($fasta, $chemical);
if (defined $fasta_file) {
$fasta = RNAprobing::OFFFile->new($fasta_file);
$fasta->read_file();
$logger->debug("Loaded fasta file ".$fasta_file);
}
if (defined $dbn_file) {
$fasta = RNAprobing::OFFFile->new($dbn_file);
$fasta->read_file();
$logger->debug("Loaded dot-bracket notation file ".$dbn_file);
}
if (defined $chemical_file) {
$chemical = RNAprobing::Chemical->new($chemical_file);
$chemical->read_file();
$logger->debug("Loaded chemical file ".$chemical_file);
}
## Sanity check of input parameter: --samples
my $sample_size; # number of stochastically sampled RNA structures to probe
if (! defined($samples)) {
$logger->error("--samples not used. Please provide positive integer ".
"value via '--samples' option.");
exit 1;
} elsif (Scalar::Util::looks_like_number($samples) &&
Scalar::Util::Numeric::isint($samples) ) {
if ($samples <= 0) {
$logger->error("Sample size is set to ".$samples.". Please provide ".
"positive integer value via '--samples' option.");
exit 1;
} else {
$sample_size = $samples;
$logger->debug("--samples has value: ".$sample_size);
}
} else {
$logger->error("Sample size must be a positive integer. ".
"Set via '--samples' option.");
exit 1;
}
## Sanity check of input parameters:
# --offset
if ( ! (Scalar::Util::Numeric::isint($offset)) ) {
$logger->error("Please provide valid integer value via '--offset' option'");
exit 1;
}
# --begin
if (defined $seqpos_begin &&
! (Scalar::Util::Numeric::isint($seqpos_begin)) ) {
$logger->error("Please provide valid integer value via '--begin' option'");
exit 1;
}
# --end
if (defined $seqpos_end &&
! (Scalar::Util::Numeric::isint($seqpos_end)) ) {
$logger->error("Please provide integer value via '--end' option'");
exit 1;
}
# === Perform the probing ===
my ($seq, @structures);
if ( defined $fasta_file ) {
$seq = $fasta->sequence();
@structures = &stochastic_sampling($seq, $sample_size);
} elsif ( defined $dbn_file ){
$seq = $fasta->sequence();
@structures = ($fasta->structure) x $sample_size;
}
$seq = uc($seq);
$logger->debug($seq);
my @probing_profile = (0) x length($seq);
#my $length = scalar(@probing_profile);
# my @structure_description = &dot_bracket_to_structure_description(@structures);
@probing_profile = &simulate_probing(\@structures, \@probing_profile,
$seq, $chemical);
#print(Dumper($bp_per_structure[1]));
# === Log Result if needed ===
# Should be logged instead of printed
$logger->info("=== Results ===");
#for (my $i = 0; $i < scalar(@structures); $i++) {
# $logger->info("$i. Structure:\n$structures[$i]\n$structure_description[$i]");
#}
$logger->info(join(",", @probing_profile));
# === Fiddle around with offset, seqpos_begin and seqpos_start ===
my ($reactivity_begin, $reactivity_end);
if (defined($seqpos_begin) && defined($seqpos_end) &&
# EITHER $seqpos_begin and $seqpos_end are set via options ...
$offset < $seqpos_begin && $seqpos_begin < $seqpos_end &&
$seqpos_end < length($seq)+$offset
# ... and they obey the rules ...
) {
# ... new $reactivity_begin and $reactivity_end of REACTIVITY are calculated, ...
## $offset minus $seqpos_* is fine, but for instance first nucleotide would be 1
## so we need to substract 1 to get a fine array index
$reactivity_begin = abs($offset - $seqpos_begin ) - 1;
$reactivity_end = abs($offset - $seqpos_end) - 1;
} else {
# ... OR $seqpos_begin and $seqpos_end are set here.
## f**k you RDAT indices
## sequence enumeration starts at OFFSET plus 1
## and SEQPOS is 1-indexed
$seqpos_begin = 1 + $offset;
## length() starts counting at 1 so no need for extra addition
$seqpos_end = length($seq) + $offset;
## $reactivity_begin and reactivity_end are array indices
## so substract one from the $seqpos_* values
$reactivity_begin = $seqpos_begin - 1;
$reactivity_end = $seqpos_end - 1;
}
# Fill @reactivity with the correct values depending on $offset and $seqpos_begin
# and $seqpos_end
my @reactivity = @probing_profile[$reactivity_begin..$reactivity_end];
# === Assemble the RDAT file ===
my $fasta_id = $fasta->fasta_id();
$fasta_id =~ s/\.\w*$//g;
my $rdat_file_name = $fasta_id."_".$chemical->probe_name()."_".$sample_size.".rdat";
$rdat_file_name =~ s/\s//g;
$logger->info("++++ ".$rdat_file_name." ++++");
my $rdat_out = RNAprobing::RDATFile->new($rdat_file_name);
my $construct_name = $fasta->fasta_id()."_in_silico_probed_using_".$chemical->probe_name();
$rdat_out->name($construct_name);
$rdat_out->sequence($seq);
my ($struct, $mfe) = RNA::fold($seq); # predict mfe structure of $seq
$rdat_out->structure($struct);
$rdat_out->offset($offset);
$rdat_out->seqpos([$seqpos_begin..$seqpos_end]);
$rdat_out->data()->reactivity(1, \@reactivity); # 1 is the index of the DATA line
$rdat_out->write_file();
################################################################################
################################################################################
##
## Subroutines
##
################################################################################
################################################################################
################################################################################
##
## &configureLogger($verbosityLevel)
## - Configures and initialzes the Logger
## - $verbosityLevel = scalar value that sets log level
## -- 0 => $ERROR
## -- 1 => $WARN
## -- 2 => $INFO
## -- >2 => $DEBUG
##
################################################################################
sub configureLogger{
## Configure the logger ##
my $verbose = shift;
my $logger_name = shift;
my $logger = get_logger($logger_name);
$logger->info("Verbosity level: $verbose");
SELECT:{
if ($verbose == 0){
$logger->level($ERROR);
$logger->debug("Log level is ERROR");
last SELECT;
} elsif ($verbose == 1){
$logger->level($WARN);
$logger->debug("Log level is WARN");
last SELECT;
} elsif ($verbose == 2){
$logger->level($INFO);
$logger->debug("Log level is INFO");
last SELECT;}
else {
$logger->level($DEBUG);
$logger->debug("Log level is DEBUG");
last SELECT;
}
}
return $logger;
}
################################################################################
#
# Stochastic sampling of RNA secondary structures
#
################################################################################
sub stochastic_sampling {
my ($seq, $sample_size) = @_;
# compute partition function and pair pobabilities
my $structure;
$RNA::st_back = 1;
my $gfe = RNA::pf_fold($seq, $structure);
my @structures;
for (my $i = 0; $i < $sample_size; $i++){
push( @structures, RNA::pbacktrack($seq) );
}
return @structures;
}
################################################################################
#
# Convert Dot-Bracket into structure description
#
################################################################################
sub dot_bracket_to_structure_description {
my ($structure) = @_;
my $structure_description = "";
my @db = split('', $structure);
my @dots = (-1);
my @opening_br = (-1);
# at first we expect every nucleotide to be unpaired "U"
my @struc_dec = ("U") x length($structure);
# fill arrays with positions
for (my $i = 0; $i < scalar(@db); $i++) {
push(@dots, $i) if ( $db[$i] eq "." );
push(@opening_br, $i) if ( $db[$i] eq "(" );
# closing bracket found, so lets classify enclosed unpaired nucleotides
# if there are any
# if clause leads to errors, if @db contains substrings like "()"
if ( $db[$i] eq ")" && $dots[$#dots] > $opening_br[$#opening_br] ) {
# declare enclosing bracket positions
my $op_br_pos = pop(@opening_br);
my $cl_br_pos = $i;
# Declare paired nucleotides
$struc_dec[$op_br_pos] = "P";
$struc_dec[$cl_br_pos] = "P";
my @enclosed_dots = ();
# count the number of stems enclosed by the unpaired nucleotides
my $enclosed_stems = 0;
# collect all enclosed nucleotides in @enclosed_dots
while ( $dots[$#dots] > $op_br_pos ) {
push(@enclosed_dots, pop(@dots));
# stop if the last enclosed nucleotide is reached
last if ($dots[$#dots] < $op_br_pos);
# if found non-continous numbers we found an enclosed stem
if ( $dots[$#dots]+1 < $enclosed_dots[$#enclosed_dots]) {
$enclosed_stems++;
}
}
# Hairpin or bulge detected
if ( $enclosed_stems == 0 ) {
# Hairpin detected if the enclosed dots reach from opening to
# closing bracket
if ($op_br_pos + 1 == $enclosed_dots[$#enclosed_dots] &&
$cl_br_pos - 1 == $enclosed_dots[0] ) {
foreach (@enclosed_dots) { $struc_dec[$_] = "H" }
}
# bulge detected if the enclosed dots just touch one bracket
elsif ( $op_br_pos + 1 == $enclosed_dots[$#enclosed_dots] ||
$cl_br_pos - 1 == $enclosed_dots[0] ) {
foreach (@enclosed_dots) { $struc_dec[$_] = "B" }
}
}
# Multi loop with two included stems or an interior loop detected
elsif ( $enclosed_stems == 1 ) {
# Interior loop detected if the enclosed dots reach from opening
# to closing bracket
if ($op_br_pos + 1 == $enclosed_dots[$#enclosed_dots] &&
$cl_br_pos - 1 == $enclosed_dots[0] ) {
foreach (@enclosed_dots) { $struc_dec[$_] = "I" }
}
# Multi loop with two stems detected if the enclosed dots just
# touch one bracket
elsif ( $op_br_pos + 1 == $enclosed_dots[$#enclosed_dots] ||
$cl_br_pos - 1 == $enclosed_dots[0] ) {
foreach (@enclosed_dots) { $struc_dec[$_] = "M" }
}
}
# Multi loop detected if more than one stem is enclosed
elsif( $enclosed_stems > 1 ) {
foreach (@enclosed_dots) { $struc_dec[$_] = "M" }
}
}
# No enclosed unpaired nucleotides so lets declare the base pair
elsif ( $db[$i] eq ")" ) {
$struc_dec[$i] = "P";
my $rel_open_br = pop(@opening_br);
$struc_dec[$rel_open_br] = "P";
}
}
$structure_description = join("",@struc_dec);
return $structure_description;
}
sub create_bp_hash {
my ($structure) = @_;
my %base_base_pairings = ();
my @db = split('', $structure);
my @dots = (-1);
my @opening_br = (-1);
my @closing_br = (-1);
# fill arrays with positions
for (my $i = 0; $i < scalar(@db); $i++) {
push(@dots, $i) if ( $db[$i] eq "." );
push(@opening_br, $i) if ( $db[$i] eq "(" );
if ( $db[$i] eq ")" ){
my $five_prime_pos = pop(@opening_br);
my $three_prime_pos = $i;
$base_base_pairings{$three_prime_pos} = $five_prime_pos;
$base_base_pairings{$five_prime_pos} = $three_prime_pos;
}
}
return %base_base_pairings;
}
################################################################################
#
# Probe sequence and secondary structure
#
################################################################################
sub simulate_probing {
my ($structures, $probing_profile, $seq, $chemical) = @_;
for ( my $i = 0; $i < scalar(@{$chemical->probe_reac()}); $i++ ) {
my $prob_reac = ${$chemical->probe_reac()}[$i];
my $prob_seq = @{$chemical->probe_seq()}[$i];
my $prob_str = @{$chemical->probe_str()}[$i];
my $prob_mod = @{$chemical->probe_mod()}[$i];
my $prob_mod_pos = @{$chemical->probe_mod_pos()}[$i];
my %block_connect = &find_str_block_connect($prob_str);
# because @prob_seq, @prob_str, @prob_mod, and @prob_mod_pos have equal
# length I can iterate over one of them
my (@seq_regexp, @str_regexp);
for ( my $i=0; $i < scalar(@{$prob_seq}); $i++) {
# create regexp for sequence given in chemical file
my $seq_re = '';
my %letter2nucleotides = &single_letter_codes_for_nucleotides();
foreach my $nuc ( split('', $prob_seq->[$i]) ) {
$seq_re .= '['.$letter2nucleotides{$nuc}.']';
}
push(@seq_regexp, $seq_re);
}
for ( my $i=0; $i < scalar(@{$prob_str}); $i++) {
# create regexp for structure given in chemical file
my $str_re = '';
my %letter2structure = &letter_codes_for_structure_elements();
foreach my $str ( split('', $prob_str->[$i]) ) {
$str_re .= '['.$letter2structure{$str}.']';
}
push(@str_regexp, $str_re);
}
foreach my $structure (@{$structures}) {
my $str_desc =
&dot_bracket_to_structure_description($structure);
my (@seq_matches, @str_matches);
# find all matching positions for sequence regexp
foreach my $seq_re (@seq_regexp) {
my @matches = &match_all_positions($seq_re, $seq);
push(@seq_matches, \@matches);
}
# find all matching positions for the structure regexp
foreach my $str_re (@str_regexp) {
my @matches = &match_all_positions($str_re, $str_desc);
push(@str_matches, \@matches);
}
my @block_match;
# find identical matches in @seq_matches and @str_matches
for (my $j = 0; $j < scalar(@seq_matches); $j++ ) {
my @matching_positions =();
my ($str_el, $seq_el) = (0, 0);
my $seq_block_matches = $seq_matches[$j];
my $str_block_matches = $str_matches[$j];
while ( $seq_el < scalar(@{$seq_block_matches}) &&
$str_el < scalar(@{$str_block_matches}) ) {
if ( $seq_block_matches->[$seq_el] <
$str_block_matches->[$str_el] ) {
$seq_el++;
} elsif ( $seq_block_matches->[$seq_el] >
$str_block_matches->[$str_el] ) {
$str_el++;
} elsif ($seq_block_matches->[$seq_el] ==
$str_block_matches->[$str_el] ) {
push(@matching_positions, $seq_block_matches->[$seq_el]);
$str_el++;
$seq_el++;
}
}
push(@block_match, \@matching_positions);
# print("Matches: ".join(",", @matching_positions)."\n");
}
# check if found matches for each block are connected by base pairs
my %bp_per_structure = &create_bp_hash($structure);
## At first check if all requirements are fulfilled ...
# variables for later use
my $matching_blocks = 0;
my @matching_positions;
# ... each block must have matched ...
for ( my $j = 0; $j < scalar(@block_match); $j++) {
# check if there has something been found for block $j
$matching_blocks++ if (@{$block_match[$j]});
}
# ... and only matches which obey the rules are passed on ...
if ( %block_connect ) {
foreach my $key ( keys(%block_connect) ){
my @key_pos = split(",", $key);
my @val_pos = split(",", $block_connect{$key});
foreach my $key_offset ( @{$block_match[$key_pos[0]]} ){
my $key_base_pos = $key_offset + $key_pos[1];
foreach my $val_offset (@{$block_match[$val_pos[0]]}){
my $val_base_pos = $val_offset + $val_pos[1];
if ( $bp_per_structure{$key_base_pos} ==
$val_base_pos ) {
# need to calculate the modification point
foreach my $mod_pos (@{$prob_mod_pos->[$key_pos[0]]} ) {
# print(Dumper($prob_mod_pos));
# print("Modification point: $mod_pos\n");
my $prob_pos = $key_offset + $mod_pos;
# print("Found a valid bp: $key_base_pos"
# ."/$val_base_pos\n");
# print("Probed position: $prob_pos\n");
push(@matching_positions, $prob_pos);
}
}
}
}
}
} else {
for ( my $j = 0; $j < scalar(@block_match); $j++) {
foreach my $offset ( @{$block_match[$j]} ) {
foreach my $mod_pos (@{$prob_mod_pos->[$j]}) {
my $prob_pos = $offset + $mod_pos;
push(@matching_positions, $prob_pos);
}
}
}
}
# print(Dumper(\%block_connect));
# print("Found matches for "
# .$matching_blocks."/".scalar(@{$prob_seq})
# ." blocks\n");
## Finally modify the probing profile if all blocks matched
if ( $matching_blocks == scalar(@{$prob_seq}) ) {
foreach my $prob_pos (@matching_positions) {
$probing_profile->[$prob_pos] += $prob_reac;
$logger->info( "Probing profile:\n".
join(",",@{$probing_profile})."\n" );
}
}
}
}
return @{$probing_profile};
}
sub match_all_positions {
my ($regex, $string) = @_;
my @ret;
while ($string =~ /(?=$regex)/g) {
push(@ret, $-[0]);
}
return @ret;
}
sub find_str_block_connect {
my ($prob_str) = @_;
my (@op_br, @cl_br, %block_connect);
for (my $i=0; $i < scalar(@{$prob_str}); $i++ ) {
my @str = split('', $prob_str->[$i]);
for (my $j=0; $j < scalar(@str); $j++ ) {
if ( $str[$j] eq '(' ) {
# create unique key for opening bracket:
# * key = block,position
my $op_br_pos = join(",", $i, $j);
# save position on stack
push( @op_br, $op_br_pos);
}
if ( $str[$j] eq ')' ) {
# create unique key for closing bracket
# * key = block,position
my $cl_br_pos = join( ",", $i, $j);
# get associated opening bracket
my $op_br_pos = pop( @op_br );
# fill hash with coordinates
$block_connect{$op_br_pos} = $cl_br_pos;
$block_connect{$cl_br_pos} = $op_br_pos;
}
}
}
return %block_connect;
}
sub single_letter_codes_for_nucleotides {
my %letter2nucleotides = (
A => 'A',
C => 'C',
G => 'G',
T => 'T',
U => 'U',
M => 'AC',
R => 'AG',
W => 'ATU',
S => 'CG',
Y => 'CTU',
K => 'GTU',
V => 'ACG',
H => 'ACTU',
D => 'AGTU',
B => 'CGTU',
N => 'ACGTU' );
return %letter2nucleotides;
}
sub letter_codes_for_structure_elements {
my %letter2structure = (
'B' => 'B',
'H' => 'H',
'I' => 'I',
'M' => 'M',
'P' => 'P',
'U' => 'HBIMU',
'(' => 'P',
')' => 'P' );
return %letter2structure;
}
__END__
=head1 NAME
sample - Using GetOpt::Long and Pod::Usage
=head1 SYNOPSIS
RNAprobing.pl [options] --fasta F<fasta-file> --chemical F<chemical-file>
=head1 DESCRIPTION
This script creates a RDAT file, containing the results of I<in silico> probing experiment.
To perform a probing reaction it needs to be provided with a RNA sequence stored in a FASTA file and the reactivity rules in a special file format that looks like this:
=head2 EXAMPLE REACTIVITY FILE
> U2 nuclease # Name of reagent
1.0 # modification strength
A # specific RNA sequence
U # specific sec. structure
| # modification point
0.9
G # specific RNA sequence
U # specific sec. structure
| # modification point
0.2
C # specific RNA sequence
U # specific sec. structure
| # modification point
0.1
U # specific RNA sequence
U # specific sec. structure
| # modification point
=head1 OPTIONS
=over 8
=item B<-h, --help>
Display help message
=item B<-f, --fasta>
Fasta file containing RNA sequence to be probed
=item B<-c, --chemical>
Chemical file describing the reactivities of the probing reagent
=item B<--samples>
Sets value for Boltzmann ensemble sampling. Expects positive integer value as parameter. Default=1000
=item B<-v, --verbose>
Increases the verbosity level. Can be used multiple times (highest level if used 3 or more times)
=back
=cut