in reply to Converting fasta (with multiple sequences) into tabular using perl

G'day rarenas,

Welcome to the Monastery.

I'd probably use a technique more along these lines:

#!/usr/bin/env perl use 5.014; use strict; use warnings; { local $/ = "\n>"; while (<DATA>) { chomp; substr $_, 0, 1, '' if $. == 1; my ($head, $seq) = split /\n/, $_, 2; printf "%-15s %s\n", $head, $seq =~ y/\n//dr; } } __DATA__ >SEQ1 AAA >SEQ2 AAA CCC >SEQ3 AAA CCC GGG >SEQ4 plus ... AAA CCC GGG TTT

Output:

SEQ1 AAA SEQ2 AAACCC SEQ3 AAACCCGGG SEQ4 plus ... AAACCCGGGTTT

Notes:

— Ken

Replies are listed 'Best First'.
Re^2: Converting fasta (with multiple sequences) into tabular using perl
by rarenas (Acolyte) on Dec 14, 2017 at 10:50 UTC

    Thank you Ken!