aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Sommrey <28217714+jo-37@users.noreply.github.com>2020-12-07 16:25:26 +0100
committerJörg Sommrey <28217714+jo-37@users.noreply.github.com>2020-12-09 16:38:21 +0100
commit5e03fe60134769d22eb9c118ea88f737593b2c04 (patch)
treef5db1d39f49dee8b45e390c50df9de1ccb8215ea
parent931e28a9fe63ad0942cf9f3099191a0e21a978c2 (diff)
downloadperlweeklychallenge-club-5e03fe60134769d22eb9c118ea88f737593b2c04.tar.gz
perlweeklychallenge-club-5e03fe60134769d22eb9c118ea88f737593b2c04.tar.bz2
perlweeklychallenge-club-5e03fe60134769d22eb9c118ea88f737593b2c04.zip
Solution to task 1
-rwxr-xr-xchallenge-090/jo-37/perl/ch-1.pl26
1 files changed, 26 insertions, 0 deletions
diff --git a/challenge-090/jo-37/perl/ch-1.pl b/challenge-090/jo-37/perl/ch-1.pl
new file mode 100755
index 0000000000..d19e66e524
--- /dev/null
+++ b/challenge-090/jo-37/perl/ch-1.pl
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+use Test2::V0;
+
+# Count nucleotides and generate complement
+sub complement_dna {
+ local $_ = shift;
+
+ # Create the complement (providing the count) and return this as
+ # the final return value.
+ (y/TAGC/ATCG/, $_);
+}
+
+
+is [complement_dna(
+ 'GTAAACCCCTTTTCATTTAGACAGATCGACTCCTTATCCATTCTCAGAGATGTGTTGCTGGTCGCCG')],
+ [67, 'CATTTGGGGAAAAGTAAATCTGTCTAGCTGAGGAATAGGTAAGAGTCTCTACACAACGACCAGCGGC'],
+ 'count and complement';
+
+is complement_dna(
+ 'GTAAACCCCTTTTCATTTAGACAGATCGACTCCTTATCCATTCTCAGAGATGTGTTGCTGGTCGCCG'),
+ 'CATTTGGGGAAAAGTAAATCTGTCTAGCTGAGGAATAGGTAAGAGTCTCTACACAACGACCAGCGGC',
+ 'complement only';
+
+
+done_testing;