I have a file in rows as below and would like to convert into two column format.
>00000_x1688514
TGCTTGGACTACATATGGTTGAGGGTTGTA
>00001_x238968
TGCTTGGACTACATATTGTTGAGGGTTGTA
...
Desired output is
>00000_x1688514 TGCTTGGACTACATATGGTTGAGGGTTGTA
>00001_x238968 TGCTTGGACTACATATTGTTGAGGGTTGTA
...
I would appreciate any help. Thanks.
I don't know if you are aware of the BioPerl modules for reading/writing and other genetic functions. Your problem can be written like this.
#!/usr/bin/perl
use strict;
use warnings;
use Bio::SeqIO;
my $file = 'o33.txt';
my $in = Bio::SeqIO->new( -file => $file,
-format => 'fasta');
while ( my $seq = $in->next_seq() ) {
print $seq->id, "\t", $seq->seq, "\n";
}
__END__
00000_x1688514 TGCTTGGACTACATATGGTTGAGGGTTGTA
00001_x238968 TGCTTGGACTACATATTGTTGAGGGTTGTA
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With