/usr/bin/extract-transcript-to-gene-map-from-trinity is in rsem 1.2.31+dfsg-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 | #!/usr/bin/env perl
use strict;
if (scalar(@ARGV) != 2) {
print "Usage: extract-transcript-to-gene-map-from-trinity trinity_fasta_file map_file\n";
exit(-1);
}
open(INPUT, $ARGV[0]);
open(OUTPUT, ">$ARGV[1]");
my ($tag, $line);
$tag = <INPUT>; chomp($tag);
while (substr($tag, 0, 1) eq ">") {
$tag = substr($tag, 1);
my $cnt = 0;
while (($line = <INPUT>) && substr($line, 0, 1) ne ">") {
$cnt++;
}
if ($cnt == 0) { print "Warning: Fasta entry $tag has an empty sequence, it is omitted.\n"; }
else {
my ($tid, @tmp) = split(/ /, $tag);
my $pos = rindex($tid, "_");
my $gid = "";
if ($pos >= 0) { $gid = substr($tid, 0, $pos); }
else { $gid = $tid; }
print OUTPUT "$gid\t$tid\n";
}
$tag = $line; chomp($tag);
}
close(INPUT);
close(OUTPUT);
|