I have been trying to get this short script to print out a suffix tree to a .txt file, so that I might process the tree (looking for the longest repeated subsequence). On Windows XP:
The script comes packaged (as a Synopsis) with davido's SuffixTree.pm. It works fine but outputs only to the screen. I tried to print $tree to a .txt file as shown above, and got this output:#!/usr/bin/perl; use SuffixTree; use warnings; use strict; my $filename7 = "C:\\MB\\Cp\\mississippi_out_7.txt"; open(MY7, ">>$filename7") or die "Unable to open $filename7: $!\n"; my $str="catgatgttttccctatgggatttttgaa"; my $tree=create_tree($str); print_tree($tree); my $position = find_substring($tree, "ttttg"); printf("\nPosition of (ttttg) in the sequence is %ld.\n\n", $p +osition); print MY7 "$tree"; #tried to output to .txt print MY7 "${$tree}"; #tried to dereference exit 0;
The attempt to dereference and output yielded:_p_SUFFIX_TREE=SCALAR(0x224fa4)
to <STDIN> and to the output file.2273160
Is there a simple way to do this?
Many thanks,
fdillon
In reply to Printing out to a .txt file. by fdillon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |