File: joinDelimitedFasta.pl

package info (click to toggle)
rtax 0.984-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 316 kB
  • sloc: perl: 1,123; sh: 203; makefile: 2
file content (38 lines) | stat: -rwxr-xr-x 658 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/perl

use strict;
use warnings;

# make sure delimiter is properly escaped, e.g. for "+" we need "\+".
my $delimiter = $ARGV[0];
my $infileA = $ARGV[1];
my $infileB = $ARGV[2];
my $rc2 = $ARGV[3];

open(INA, $infileA) or die "Can't read $infileA\n";
open(INB, $infileB) or die "Can't read $infileB\n";

my $fastaHeader = "";

#sub revcompl {
#    return ((my $rev = reverse $_) =~ tr/ACGTacgt/TGCAtgca/); 
#}
	
while(<INA>)
	{
	my $a = $_;
	my $b = <INB>;
	chomp $a;
	chomp $b;
	if($rc2)
	    {
	    # $b = revcompl($b);
	    $b = reverse $b;
	    $b =~ tr/ACGTacgt/TGCAtgca/;
	    }
	
	print $a . $delimiter . $b . "\n";

	}
close INA;
close INB;