Skip to content

Instantly share code, notes, and snippets.

@grondilu
Created December 8, 2012 18:33
Show Gist options
  • Save grondilu/4241253 to your computer and use it in GitHub Desktop.
Save grondilu/4241253 to your computer and use it in GitHub Desktop.
Rosalind: de brujin graph
use strict;
use warnings;
my @sample = map { chomp; $_ } <>; #qw{TGAT CATG TCAT ATGC CATC CATC};
sub revc { my $_ = join '', reverse split //, shift; tr/ACGT/TGCA/; $_ }
my %SSrc; $SSrc{$_}++ for @sample, map { revc($_) } @sample;
for (keys %SSrc) {
printf "(%s, %s)\n", substr($_, 0, -1), substr($_, 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment