Skip to content

Commit

Permalink
Removed the output option, enahcned the README.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattions committed Feb 11, 2016
1 parent 7519417 commit 241f532
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
8 changes: 4 additions & 4 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ Now our scripts are dockerized and we can use it directly from the image.

# Push our image to the SevenBridges registry

First we need to tag the image
First we need to tag the image. Make sure you have create a dev project called `dna2protein`, otherwise you will
not be able to push the image.

docker tag mmattioni/dna2protein images.sbgenomics.com/mmattioni/dna2protein

Now we login and push it to the registry
Now we login and push it to the registry. Note: you have to provide you API TOKEN, not the password you use to log
on the Seven Bridges Platform.

docker login --username <SBG_USERNAME> --email <SBG_EMAIL> --password <SBG_API_TOKEN> images.sbgenomics.com
docker push mmattioni/dna2protein






10 changes: 5 additions & 5 deletions transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import re
import sys

VERSION = "0.5.1"
VERSION = "0.5.2.dev"
FILENAME_OUTPUT = "rna.txt"

def transcribe(args):
# create a transcription map and use regex to translate
Expand All @@ -15,17 +16,16 @@ def transcribe(args):

print "Welcome to transcribe, version: {0}".format(VERSION)
if args['verbose']:
print ("Your original DNA sequence: {0}".format(DNA))
print ("Your translated mRNA sequence: {0}".format(mRNA))
with open(args['output'], "w") as output:
print "mRNA has been translated. Result in {0}".format(FILENAME_OUTPUT)
with open(FILENAME_OUTPUT, "w") as output:
output.write(mRNA)
print "Done."

if __name__ == "__main__":
""" Parse the command line arguments """
parser = argparse.ArgumentParser(description="Translates a DNA input test into a RNA",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("dna", type=argparse.FileType("r"))
parser.add_argument("--output", "-o", default="rna.txt")
parser.add_argument("-v", "--verbose", action="store_true", default=False)
parser.add_argument("--version", action='version', version=VERSION)
args = vars(parser.parse_args())
Expand Down
11 changes: 6 additions & 5 deletions translate.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python
import argparse
import sys
from transcribe import VERSION

FILENAME_OUTPUT = "peptide.txt"

def translate(args):

print "Welcome to translate, version: {0}".format(VERSION)
Expand Down Expand Up @@ -32,22 +33,22 @@ def translate(args):
protein += codon_map[mRNA[start:start+3]]
start += 3
protein = protein[:protein.find('STOP')]
with open(args['output'], "w") as output:
with open(FILENAME_OUTPUT, "w") as output:
output.write(protein)
if args['verbose']:
print "Protein has been transcribed. Result in {0}".format(args['output'])
print "Protein has been transcribed. Result in {0}".format(FILENAME_OUTPUT)

else:
msg = "No AUG found as starting codon in your mRNA input. This program translates only mRNA "
msg += "from eukaryotes: https://en.wikipedia.org/wiki/Start_codon"
print msg
print "Done."

if __name__ == "__main__":
""" Parse the command line arguments """
parser = argparse.ArgumentParser(description="Transcribe the provided mRNA into a peptide.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("mRNA", type=argparse.FileType('r'), help="mRNA to transcribe")
parser.add_argument("--output", "-o", default="peptide.txt")
parser.add_argument("--verbose", "-v", help="Run in verbose mode", action="store_true")
parser.add_argument("--version", action='version', version=VERSION)
args = vars(parser.parse_args())
Expand Down

0 comments on commit 241f532

Please sign in to comment.