commit a0484fbc035f101cabb64656aef6ebedfcc361ee
parent 2d59b72f91ec5fb72a69fc0b09ad5fba24807239
Author: Walther Chen <walther.chen@gmail.com>
Date: Fri, 1 Nov 2024 11:34:08 -0400
align problems to https://rosalind.info/problems/list-view/?location=bioinformatics-textbook-track
Diffstat:
5 files changed, 56 insertions(+), 56 deletions(-)
diff --git a/approximate_pattern_count.c3 b/approximate_pattern_count.c3
@@ -0,0 +1,22 @@
+// approximate pattern count
+
+module approximate_pattern_count;
+import std::io;
+import std::io::file;
+import std::collections;
+
+import util;
+
+fn void! main(String[] args) {
+ if (args.len != 2) {
+ io::eprintn("Please supply path to data file");
+ return IoError.FILE_NOT_FOUND?;
+ }
+ File f = file::open(args[1], "rb")!;
+ String pattern = io::treadline(&f)!;
+ String genome = io::treadline(&f)!;
+ String d_str = io::treadline(&f)!;
+ int d = d_str.to_integer(int)!;
+ int[] matches = util::approximate_pattern_matching(pattern, genome, d);
+ io::printfn("%d", matches.len);
+}
diff --git a/ba1i.c3 b/ba1i.c3
@@ -1,4 +1,4 @@
-// approximate pattern count
+// Frequent words with mismatches
module ba1i;
import std::io;
@@ -13,10 +13,14 @@ fn void! main(String[] args) {
return IoError.FILE_NOT_FOUND?;
}
File f = file::open(args[1], "rb")!;
- String pattern = io::treadline(&f)!;
String genome = io::treadline(&f)!;
- String d_str = io::treadline(&f)!;
- int d = d_str.to_integer(int)!;
- int[] matches = util::approximate_pattern_matching(pattern, genome, d);
- io::printfn("%d", matches.len);
+ String ints = io::treadline(&f)!;
+ String[] ints_split = ints.tsplit(" ");
+ int k = ints_split[0].to_integer(int)!;
+ int d = ints_split[1].to_integer(int)!;
+ String[] matches = util::frequent_words_with_mismatches(genome, k, d);
+ foreach (match : matches) {
+ io::printf("%s ", match);
+ }
}
+
diff --git a/ba1j.c3 b/ba1j.c3
@@ -1,26 +0,0 @@
-// Frequent words with mismatches
-
-module ba1j;
-import std::io;
-import std::io::file;
-import std::collections;
-
-import util;
-
-fn void! main(String[] args) {
- if (args.len != 2) {
- io::eprintn("Please supply path to data file");
- return IoError.FILE_NOT_FOUND?;
- }
- File f = file::open(args[1], "rb")!;
- String genome = io::treadline(&f)!;
- String ints = io::treadline(&f)!;
- String[] ints_split = ints.tsplit(" ");
- int k = ints_split[0].to_integer(int)!;
- int d = ints_split[1].to_integer(int)!;
- String[] matches = util::frequent_words_with_mismatches(genome, k, d);
- foreach (match : matches) {
- io::printf("%s ", match);
- }
-}
-
diff --git a/ba1l.c3 b/ba1l.c3
@@ -1,24 +0,0 @@
-// Neighbors
-
-module ba1l;
-import std::io;
-import std::io::file;
-import std::collections;
-
-import util;
-
-fn void! main(String[] args) {
- if (args.len != 2) {
- io::eprintn("Please supply path to data file");
- return IoError.FILE_NOT_FOUND?;
- }
- File f = file::open(args[1], "rb")!;
- String pattern = io::treadline(&f)!;
- int d = io::treadline(&f)!.to_integer(int)!;
- String[] matches = util::neighbors(pattern, d);
- foreach (match : matches) {
- io::printf("%s ", match);
- }
-}
-
-
diff --git a/ba1n.c3 b/ba1n.c3
@@ -0,0 +1,24 @@
+// Neighbors
+
+module ba1n;
+import std::io;
+import std::io::file;
+import std::collections;
+
+import util;
+
+fn void! main(String[] args) {
+ if (args.len != 2) {
+ io::eprintn("Please supply path to data file");
+ return IoError.FILE_NOT_FOUND?;
+ }
+ File f = file::open(args[1], "rb")!;
+ String pattern = io::treadline(&f)!;
+ int d = io::treadline(&f)!.to_integer(int)!;
+ String[] matches = util::neighbors(pattern, d);
+ foreach (match : matches) {
+ io::printf("%s ", match);
+ }
+}
+
+