File: consensus-preprocess.pl

package info (click to toggle)
nanopolish 0.14.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,760 kB
  • sloc: cpp: 22,200; ansic: 1,478; python: 814; makefile: 210; sh: 43; perl: 17
file content (26 lines) | stat: -rwxr-xr-x 603 bytes parent folder | download | duplicates (6)
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
#!/usr/bin/env perl
#
# Extract fast5 file names from a poretools fasta file and prepend an index to uniquify names
#
use strict;
use Bio::Perl;
use Getopt::Long;

my $inFile  = Bio::SeqIO->new(-file => $ARGV[0], '-format' => 'Fasta');
my $outFile = Bio::SeqIO->new(-fh => \*STDOUT, '-format' => 'Fasta');
open(FM, ">consensus_fast5.fofn");

my $id = 0;

while(my $seq = $inFile->next_seq())
{
    my $in_name = $seq->display_id();
    my $out_name = "$id.$in_name";
    my $desc = $seq->desc();
    
    print FM "$desc\n";

    $seq->display_id($out_name);
    $outFile->write_seq($seq);
    $id++;
}