Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: create an one-line format for this

by McA (Deacon)
on Oct 01, 2013 at 22:47 UTC ( #1056549=note: print w/ replies, xml ) Need Help??


in reply to create an one-line format for this

Hi,

this would be my approach based on that what you wrote:

#!/usr/bin/env perl use strict; use warnings; my $filename = 'file'; open my $fh, "<", $filename or die $!; local $/ = "//\n"; while(defined(my $line = <$fh>)) { chomp $line; my ($seq_length, $ID, $top, $seq); foreach my $part (split /\n/, $line) { if($part =~ /^(\d+)\s+(.*)$/) { $seq_length = $1; $ID = $2; next; } if($part =~ /^([S\.]+)$/) { $top .= $1; next; } $seq .= $part; } print ">$ID\n$seq\n$top\n"; } close $fh;

Best regards
McA


Comment on Re: create an one-line format for this
Download Code
Re^2: create an one-line format for this
by Anonymous Monk on Oct 01, 2013 at 22:55 UTC
    Thank you very much for your help!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1056549]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (12)
As of 2014-07-22 20:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (127 votes), past polls