#!/usr/bin/perl # Time-stamp: <2005-02-17 13:42:06 kasper> use warnings; use strict; use LFasta; use LFastaIO; use Getopt::Long; use constant USAGE =>< [infile2 [outfile]] DESCRIPTION: This script mergers the predictions of two infiles containing the same sequences in the same order. The merged predictions are returned together with the sequence and labels from the first infile. OPTIONS: --help Prints this help. EXAMPLES: lfamerge.pl infile1.lfa infile2.lfa outfile.lfa cat infile2.lfa | lfamerge.pl infile1.lfa > outfile.lfa DEPENDENCIES Classes LFasta and LFastaIO. AUTHOR: Kasper Munch COPYRIGHT: This program is free software. You may copy, modify, and redistribute it under the same terms as Perl itself. END my $help = 0; GetOptions( "help" => \$help, ) or die USAGE; $help and die USAGE; my $input1 = shift @ARGV or die USAGE; open my $in1, "$input1" or die "$input1: $!\n"; @ARGV = ('-') unless @ARGV; my $input2 = shift @ARGV; open my $in2, "$input2" or die "$input2: $!\n"; @ARGV = ('>&STDOUT') unless @ARGV; my $output = shift @ARGV; open my $out, ">$output" or die "$output: $!\n"; $in1 = LFastaIO->new(fh => $in1); $in2 = LFastaIO->new(fh => $in2); $out = LFastaIO->new(fh => $out); while (my $lfa1 = <$in1>) { my $lfa2 = <$in2>; die unless $lfa1->id eq $lfa2->id and $lfa1->seq eq $lfa2->seq; my $preds1 = $lfa1->preds; my $preds2 = $lfa2->preds; my $newpreds = [@$preds1, @$preds2]; $lfa1->preds($newpreds); print $out $lfa1; } =head1 SYNOPSIS: lfamerge.pl [OPTIONS] [infile2 [outfile]] =head1 DESCRIPTION: This script mergers the predictions of two infiles containing the same sequences in the same order. The merged predictions are returned together with the sequence and labels from the first infile. =head1 OPTIONS: =over 4 =item --help Prints this help. =back =head1 EXAMPLES: lfamerge.pl infile1.lfa infile2.lfa outfile.lfa cat infile2.lfa | lfamerge.pl infile1.lfa > outfile.lfa DEPENDENCIES Classes LFasta and LFastaIO. =head1 AUTHOR: Kasper Munch =head1 COPYRIGHT: This program is free software. You may copy, modify, and redistribute it under the same terms as Perl itself. =cut