示例#1
0
    def test_polysolver(self):
        command = ['source /Users/schubert/Dropbox/phd/software/polysolver/scripts/config.bash && env']
        proc = subprocess.Popen(command, stdout = subprocess.PIPE,shell=True)
        for line in proc.stdout:
            (key, _, value) = line.partition("=")
            os.environ[key] = value.strip()
        proc.communicate()
        origin = "/Users/schubert/Dropbox/phd/software/polysolver/scripts/"
        os.environ["PATH"] += os.pathsep + origin
        pprint.pprint(dict(os.environ))



        command = ["/Users/schubert/Dropbox/phd/software/polysolver/debugg.sh"]
        proc = subprocess.Popen(command, stdout = subprocess.PIPE,shell=True)

        print "SAMTool call"
        print "\n".join( l for l in proc.stdout)
        print
        print str(proc.stderr)
        proc.communicate()
        #sys.exit()
        polysolver = HLATypingFactory("polysolver")
        print polysolver.predict("/Users/schubert/Dropbox/phd/software/polysolver/test/test.bam",
                                 "/Users/schubert/Dropbox/phd/software/polysolver/debugging2/", options="Unknown 1 hg19 STDFQ 0",
                                 delete=False,
                                 command=origin+"shell_call_hla_type")
示例#2
0
 def test_athlates(self):
     origin = "/Users/schubert/Dropbox/PhD/software/Athlates_2014_04_26/bin"
     os.environ["PATH"] += os.pathsep + origin
     atlates = HLATypingFactory("athlates")
     print atlates.predict("/Users/schubert/Dropbox/PhD/software/Athlates_2014_04_26/demo/HG01756/HG01756_a.sort.bam",
                           "/Users/schubert/Dropbox/PhD/software/Athlates_2014_04_26/demo/output/Fred2_",
                           options="-msa /Users/schubert/Dropbox/PhD/software/Athlates_2014_04_26/db/msa/A_nuc.txt",
                           delete=False)
示例#3
0
def main():
    #Specify CTD interface
    # Every CTD Model has to have at least a name and a version, plus any of the optional attributes below them.
    model = argparse.ArgumentParser(
        description='Commandline tool for HLA typing', )

    model.add_argument('-m',
                       '--method',
                       type=str,
                       choices=HLATypingFactory.available_methods().keys(),
                       default="optitype",
                       help='The name of the prediction method')

    model.add_argument('-v',
                       '--version',
                       type=str,
                       default="",
                       help='The version of the prediction method')

    model.add_argument('-i',
                       '--input',
                       type=str,
                       required=True,
                       help='Path to the input file')

    model.add_argument('-p',
                       '--paired',
                       type=str,
                       default="",
                       help="Additional input for paired-end typing")

    model.add_argument('-r',
                       '--reference',
                       type=str,
                       choices=["rna", "dna"],
                       default="dna",
                       help='The reference type to use')

    model.add_argument('-o',
                       '--output',
                       type=str,
                       required=True,
                       help='Path to the output file')

    args = model.parse_args()

    version = "" if args.version == "" else args.version
    if args.method == "optitype":
        options = "--" + args.reference if args.paired == "" else args.paired + " " + "--" + args.reference
    else:
        options = "" if args.paired == "" else "-2 " + args.paired
    genotype = HLATypingFactory(args.method).predict(args.input,
                                                     "/tmp/",
                                                     options=options)
    with open(args.output, "w") as f:
        f.write("\n".join("HLA-" + a.name for a in genotype))

    return 0
示例#4
0
 def test_seq2HLA(self):
     origin = "/home/schubert/Dropbox/PhD/software/seq2hla"
     os.environ["PATH"] += os.pathsep + origin
     seq2HLA = HLATypingFactory("Seq2HLA")
     print(
         seq2HLA.predict(
             "/home/schubert/Desktop/ERR009105_1.fastq.gz",
             origin + "/delete",
             options="-2 /home/schubert/Desktop/ERR009105_2.fastq.gz"))
示例#5
0
 def test_optitype(self):
     os.environ[
         "PATH"] += os.pathsep + "/Users/schubert/Dropbox/PhD/Porgramming/OptiType/"
     #print os.environ["PATH"]
     opti = HLATypingFactory("OptiType")
     print(
         opti.predict(
             "/Users/schubert/Dropbox/PhD/Porgramming/OptiType/test/exome/NA11995_SRR766010_1_fished.fastq",
             "/tmp/",
             options="-d"))
示例#6
0
 def test_seq2HLA(self):
     origin = "/home/schubert/Dropbox/PhD/software/seq2hla"
     os.environ["PATH"] += os.pathsep + origin
     seq2HLA = HLATypingFactory("Seq2HLA")
     print seq2HLA.predict("/home/schubert/Desktop/ERR009105_1.fastq.gz", origin+"/delete", options="-2 /home/schubert/Desktop/ERR009105_2.fastq.gz")
示例#7
0
 def test_optitype(self):
     os.environ["PATH"] += os.pathsep + "/Users/schubert/Dropbox/PhD/Porgramming/OptiType/"
     #print os.environ["PATH"]
     opti = HLATypingFactory("OptiType")
     print opti.predict("/Users/schubert/Dropbox/PhD/Porgramming/OptiType/test/exome/NA11995_SRR766010_1_fished.fastq", "/tmp/", options="-d")
示例#8
0
def main():
#Specify CTD interface
    # Every CTD Model has to have at least a name and a version, plus any of the optional attributes below them.
    model = argparse.ArgumentParser(
        description='Commandline tool for HLA typing',
        )

    model.add_argument('-m',
        '--method',
        type=str,
        choices=HLATypingFactory.available_methods().keys(),
        default="optitype",
        help='The name of the prediction method'
        )

    model.add_argument('-v',
        '--version',
        type=str,
        default="",
        help='The version of the prediction method'
        )

    model.add_argument('-i',
        '--input',
        type=str,
        required=True,
        help='Path to the input file'
        )

    model.add_argument('-p',
        '--paired',
        type=str,
        default="",
        help="Additional input for paired-end typing"
    )

    model.add_argument('-r',
        '--reference',
        type=str,
        choices=["rna", "dna"],
        default="dna",
        help='The reference type to use'
        )

    model.add_argument('-o',
        '--output',
        type=str,
        required=True,
        help='Path to the output file'
        )

    args = model.parse_args()

    version = "" if args.version == "" else args.version
    if args.method == "optitype":
        options = "--"+args.reference if args.paired == "" else args.paired+" "+"--"+args.reference
    else:
        options = "" if args.paired == "" else "-2 "+args.paired
    genotype = HLATypingFactory(args.method).predict(args.input, "/tmp/", options=options)
    with open(args.output, "w") as f:
        f.write("\n".join("HLA-"+a.name for a in genotype))

    return 0