forked from sjackman/fastascripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfakmer
executable file
·40 lines (35 loc) · 863 Bytes
/
fakmer
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
39
40
#!/usr/bin/perl
# Generate tiled k-mers
# Copyright 2012 Shaun Jackman
use strict;
use Getopt::Std 'getopts';
my %opt;
getopts('k:', \%opt);
my $opt_k = $opt{'k'};
my $id;
while (<>) {
chomp;
if (/^>/) {
$id = $_;
next;
}
my $l = length;
for my $i (0..($l - $opt_k)) {
#print '>', $., ':', $i, "\n", substr($_, $i, $opt_k), "\n";
#print $id, ':', $i, "\n", substr($_, $i, $opt_k), "\n";
#my $seq = substr($_, $i, $opt_k);
#if ($seq =~ /N/) {
# print STDERR "skipping N\n";
# next;
#}
#my ($chr, $rest) = split ':', substr $id, 1;
#my ($pos, $comment) = split ' ', $rest;
#my $kpos = $pos + $i;
##my $kid = "$chr:$kpos $comment:$i\n";
#my $kid = ">$comment:$i $chr:$kpos\n";
#print $kid, $seq, "\n";
my ($tag, $comment) = split ' ', $id;
print $tag, ':', $i, , ' ', $comment, "\n",
substr($_, $i, $opt_k), "\n";
}
}