-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
425 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
all: | ||
morloc make main.loc | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf nexus.pl pool.cpp *out */nexus.pl */*out */pool.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# `morloc` DNA sequence example | ||
|
||
Before running this example, be sure you have followed the installation | ||
instructions in the top-level README. Then install the `cppbase` morloc module | ||
with `morloc install cppbase`. | ||
|
||
First open the `main.loc` file to see the top-level `morloc` program this we | ||
will build. Then build the project as follows: | ||
|
||
``` sh | ||
morloc make main.loc | ||
``` | ||
|
||
This should generate the following files: | ||
* pool.cpp - the generate C++ source code for (de)serialization and function composition | ||
* pool-cpp.out - the compiled code | ||
* nexus.pl - the user interface | ||
|
||
Feel free to skim the `pool.cpp` file to see what the morlocks are up to | ||
underground. You can also read the `nexus.pl` script (which is just a Perl | ||
script). Both of these files are generated based on the `morloc` template | ||
`main.loc`. | ||
|
||
To access the usage statement, run `./nexus.pl -h`. This will list all exported | ||
commands and the types of their input and output. Currently the help statement | ||
is pretty minimal, but I'll remedy this in the near future. | ||
|
||
Commands can be called as follows: | ||
|
||
``` sh | ||
$ ./nexus.pl fasta_revcom '"test.fasta"' | ||
">Unicorn | ||
TGTATCTGTATCTGTATCTGTATC | ||
>Dragon | ||
TGTATCTGTATCTGTATCTGTATCTGTATCTGTATCTGTATCTGTATC | ||
" | ||
``` | ||
|
||
Why the weird quoting? All inputs to a morloc program are (for now) raw JSON | ||
data. Raw string inputs need two levels of quotation since one level is removed | ||
by Bash (hence, '"test.fasta"'). The returned value is also a JSON string, so | ||
it is quoted. The `write_fasta` function could alternatively be written to | ||
print directly to STDOUT instead of returning a string. | ||
|
||
To learn more about module construction, visit the `bio` and `fasta` modules in | ||
this folder. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef __BIO_HPP__ | ||
#define __BIO_HPP__ | ||
|
||
#include <string> | ||
|
||
std::string revcom(std::string seq){ | ||
size_t N = seq.size(); | ||
std::string revSeq(N, '*'); | ||
for (size_t i = 0; i < N; i++){ | ||
switch(seq[i]){ | ||
case 'A': | ||
revSeq[N - i - 1] = 'T'; | ||
break; | ||
case 'T': | ||
revSeq[N - i - 1] = 'A'; | ||
break; | ||
case 'G': | ||
revSeq[N - i - 1] = 'C'; | ||
break; | ||
case 'C': | ||
revSeq[N - i - 1] = 'G'; | ||
break; | ||
default: | ||
revSeq[N - i - 1] = seq[i]; | ||
break; | ||
} | ||
} | ||
return revSeq; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module bio { | ||
|
||
export revcom | ||
|
||
source Cpp from "bio.hpp" ("revcom") | ||
|
||
-- Take the reverse complement of a DNA sequence | ||
revcom :: Str -> Str; | ||
revcom Cpp :: "std::string" -> "std::string"; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: bio | ||
version: 0.0.0 | ||
homepage: null | ||
synopsis: bioinformatics module | ||
description: Basic bioinformatics functions for genome analysis and all that. | ||
category: bioinformatics | ||
license: MIT | ||
author: "Zebulun Arendsee" | ||
maintainer: "[email protected]" | ||
github: null | ||
bug-reports: null |
Oops, something went wrong.