# HG changeset patch # User superyuan # Date 1402563370 14400 # Node ID 9259f293935793a95d990f452603d3a3dc8b7bed add refeditor into galaxy toolshed diff -r 000000000000 -r 9259f2939357 tool_conf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_conf.xml Thu Jun 12 04:56:10 2014 -0400 @@ -0,0 +1,7 @@ + + +
+ + +
+
diff -r 000000000000 -r 9259f2939357 tools/refeditor/DiploidConstructor.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/refeditor/DiploidConstructor.py Thu Jun 12 04:56:10 2014 -0400 @@ -0,0 +1,84 @@ +# Filename: DiploidConstructor.py +# Author: Shuai Yuan +# Version: 05/27/2012 +# +# This script is a wrapper for DiploidConstructor +# +# DiploidConstructor is launched based on these inputs: +# -r haploid reference genome file +# -g genotypes file +# -l read length +# -d maximal deletion in a read and mapped to alternative alleles [default=0] +# -s sex of the individual [default="m"] +# -o output diploid reference genome file + +import sys +import os +import re +import string +import commands +from tempfile import NamedTemporaryFile + +# This function is exceedingly useful, perhaps package for reuse? +def getopts(argv): + opts = {} + while argv: + if argv[0][0] == '-': + opts[argv[0]] = argv[1] + argv = argv[2:] + else: + argv = argv[1:] + return opts + +def main(): + args = sys.argv[1:] + + try: + opts = getopts(args) + except IndexError: + print "Usage:" + return 0 + + hg19 = opts.get("-r") + if hg19 == None: + print "No reference file specified." + return -1 + + genotypes = opts.get("-g") + if genotypes == None: + print "No genotypes file specified." + return -2 + + length = opts.get("-l") + if length == None: + print "No read length specified." + return -3 + + indel = opts.get("-d") + if indel == None: + print "No max deletion specified." + return -4 + + gender = opts.get("-d") + if gender == None: + print "No gender specified." + return -5 + + outputfile = opts.get("-o") + if outputfile == None: + print "No output file specified." + return -6 + + +# All inputs have been specified at this point, now validate. + + #generate command + commandline = "DiploidConstructor -r %s -g %s -l %s -d %s -s %s -o %s " % (hg19, genotypes, length, indel, gender, outputfile) + #run + errorcode, stdout = commands.getstatusoutput(commandline) + + #return error code + return errorcode + +if __name__ == "__main__": + main() diff -r 000000000000 -r 9259f2939357 tools/refeditor/DiploidConstructor.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/refeditor/DiploidConstructor.xml Thu Jun 12 04:56:10 2014 -0400 @@ -0,0 +1,27 @@ + + Constructs Diploid Reference Genome + DiploidConstructor.py + -r '$input' + -g '$genotypes' + -l '$length' + -d '$indel' + -s '$gender' + -o $out_file1 + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 9259f2939357 tools/refeditor/MappingConverter.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/refeditor/MappingConverter.py Thu Jun 12 04:56:10 2014 -0400 @@ -0,0 +1,66 @@ +# Filename: MappingConverter.py +# Author: Shuai Yuan +# Version: 05/27/2012 +# +# This script is a wrapper for MappingConvertor +# +# MappingConvertor is launched based on these inputs: +# -i input intermediate SAM file +# -m dipmap file generated with diploid reference genome +# -o output final SAM file + +import sys +import os +import re +import string +import commands +from tempfile import NamedTemporaryFile + +# This function is exceedingly useful, perhaps package for reuse? +def getopts(argv): + opts = {} + while argv: + if argv[0][0] == '-': + opts[argv[0]] = argv[1] + argv = argv[2:] + else: + argv = argv[1:] + return opts + +def main(): + args = sys.argv[1:] + + try: + opts = getopts(args) + except IndexError: + print "Usage:" + return 0 + + hg19di = opts.get("-m") + if hg19di == None: + print "No dipmap file specified." + return -1 + + samfile = opts.get("-i") + if samfile == None: + print "No SAM file specified." + return -2 + + outputfile = opts.get("-o") + if outputfile == None: + print "No output file specified." + return -6 + + +# All inputs have been specified at this point, now validate. + + #generate command + commandline = "MappingConvertor -i %s -m %s.dipmap -o %s " % (samfile, hg19di, outputfile) + #run + errorcode, stdout = commands.getstatusoutput(commandline) + + #return error code + return errorcode + +if __name__ == "__main__": + main() diff -r 000000000000 -r 9259f2939357 tools/refeditor/MappingConverter.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/refeditor/MappingConverter.xml Thu Jun 12 04:56:10 2014 -0400 @@ -0,0 +1,18 @@ + + Converts intermediate SAM file to final SAM file + MappingConverter.py + -i '$input' + -m '$hg19di' + -o $out_file1 + + + + + + + + + + + +