One, called "2CU3.html", contained the output of Data::Dumper, as expected; this was a fairly big file, and probably not the one that you really intend to use with any sort of text editor.
The other, whose file name was this long url string:
was pretty small (188 bytes), containing just the following four lines of plain text:downloadFile.do?fileFormat=FASTA&compression=NO&structureId=2CU3
This latter file was perfectly legible with TextEdit on my mac (osx 10.6.4) -- that is, when I just cat the file content out in a Terminal window (which is where the above lines were copy/pasted from), it looks the same as when I open it in TextEdit.>2CU3:B|PDBID|CHAIN|SEQUENCE MVWLNGEPRPLEGKTLKEVLEEMGVELKGVAVLLNEEAFLGLEVPDRPLRDGDVVEVVALMQGG >2CU3:A|PDBID|CHAIN|SEQUENCE MVWLNGEPRPLEGKTLKEVLEEMGVELKGVAVLLNEEAFLGLEVPDRPLRDGDVVEVVALMQGG
I've never used TextWrangler (don't have it installed), so I don't know if it would look any different there. But I don't see a need to try, since TextEdit seems to be showing me the exact content of the FASTA file, without any trouble.
So, what do you mean, exactly, when you say "it's just junk in textedit"?
BTW, I would suggest that you change your method of coming up with an output file name for the FASTA files. Having question marks and ampersands in file names can be a real drag if you ever end up doing command-line shell operations on them. It might be sufficient just to add one line of code:
If any of the urls ever contain a space, asterisk, semi-colon, exclamation mark, vertical-bar (|), parens, brackets, or single or double quotes, you'll want to add those to ? and & in the tr/// statement, as well.$filename =~ s[^.+/][]; # you have this one already $filename =~ tr/?&/_/; # just add this one (turns all ? and & int +o _)
One last point -- I don't know for sure, but maybe if you added a ".txt" extension to the output FASTA file name, your TextEdit might behave better? (When I used TextEdit, it opened the file just fine as-is, but I could imagine the possibility of "user preferences" having some unexpected side-effect...)
In reply to Re: using WWW::Mechanize to download a link, opened fine in TextWrangler but as junk in TextEdit
by graff
in thread using WWW::Mechanize to download a link, opened fine in TextWrangler but as junk in TextEdit
by nurulnad
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |