def main():
    install_path = snakemake.config['paths']['install']+"/tools/"

    raw_name="ngs_te_mapper-da9b7915b0b2fcd4daf70989d55755a03c3f73ea"
    method_name = "ngs_te_mapper2"

    mccutils.remove(snakemake.params.zipfile)
    download_success = mccutils.download(snakemake.params.url, snakemake.params.zipfile, md5=snakemake.params.md5, max_attempts=3)

    if not download_success:
        print(method_name+" download failed... exiting...")
        print("try running --install with --clean for clean installation")
        sys.exit(1)

    mccutils.remove(snakemake.config['paths']['install']+raw_name)
    command = ["unzip", snakemake.params.zipfile]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path+raw_name)
    command = ["mv", snakemake.config['paths']['install']+raw_name, install_path]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path+method_name)
    mccutils.mkdir(install_path+method_name)
    for f in os.listdir(install_path+raw_name):
        command = ["mv", install_path+raw_name+"/"+f, install_path+method_name]
        mccutils.run_command(command, log=snakemake.params.log)  


    mccutils.remove(install_path+raw_name)
    mccutils.remove(snakemake.params.zipfile)
Exemple #2
0
def main():
    install_path = snakemake.config['paths']['install']+"/tools/"
    mccutils.remove(snakemake.params.zipfile)
    download_success = mccutils.download(snakemake.params.url, snakemake.params.zipfile, md5=snakemake.params.md5, max_attempts=3)

    if not download_success:
        print("retroseq download failed... exiting...")
        print("try running --install with --clean for clean installation")
        sys.exit(1)

    extracted_file_name = "RetroSeq-9d4f3b5270af2383f40e6e7ea1204ea718365db2"

    mccutils.remove(snakemake.config['paths']['install']+extracted_file_name)
    command = ["unzip", snakemake.params.zipfile]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path+extracted_file_name)
    command = ["mv", snakemake.config['paths']['install']+extracted_file_name, install_path]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path+"retroseq")
    mccutils.mkdir(install_path+"retroseq")
    for f in os.listdir(install_path+extracted_file_name):
        command = ["mv", install_path+extracted_file_name+"/"+f, install_path+"retroseq"]
        mccutils.run_command(command, log=snakemake.params.log)
    
    mccutils.remove(install_path+extracted_file_name)
    mccutils.remove(snakemake.params.zipfile)
Exemple #3
0
def main():
    install_path = snakemake.config['paths']['install']+"/tools/"
    raw_name = "jitterbug-b6b3f9c7ee4af042d4410137269f174a1399b752"
    mod_name = "jitterbug"

    mccutils.remove(snakemake.params.zipfile)
    download_success = mccutils.download(snakemake.params.url, snakemake.params.zipfile, md5=snakemake.params.md5, max_attempts=3)

    if not download_success:
        print(mod_name+" download failed... exiting...")
        print("try running --install with --clean for clean installation")
        sys.exit(1)

    mccutils.remove(snakemake.config['paths']['install']+raw_name)
    command = ["unzip", snakemake.params.zipfile]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path+raw_name)
    command = ["mv", snakemake.config['paths']['install']+raw_name, install_path]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path+mod_name)
    mccutils.mkdir(install_path+mod_name)

    for f in os.listdir(install_path+raw_name):
        command = ["mv", install_path+raw_name+"/"+f, install_path+mod_name]
        mccutils.run_command(command, log=snakemake.params.log)

    command = ["patch", "-i", snakemake.params.patch, install_path+mod_name+"/jitterbug.py"]
    mccutils.run_command(command, log=snakemake.params.log)
    mccutils.remove(install_path+raw_name)
    mccutils.remove(snakemake.params.zipfile)
Exemple #4
0
def main():
    install_path = snakemake.config['paths']['install'] + "/tools/"

    mccutils.remove(snakemake.params.zipfile)
    download_success = mccutils.download(snakemake.params.url,
                                         snakemake.params.zipfile,
                                         md5=snakemake.params.md5,
                                         max_attempts=3)

    if not download_success:
        print("teflon download failed... exiting...")
        print("try running --install with --clean for clean installation")
        sys.exit(1)

    mccutils.remove(snakemake.config['paths']['install'] +
                    "TEFLoN-3e2d67886b70644fd1f7d79263b3c8dbed639e46")
    command = ["unzip", snakemake.params.zipfile]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path +
                    "TEFLoN-3e2d67886b70644fd1f7d79263b3c8dbed639e46")
    command = [
        "mv", snakemake.config['paths']['install'] +
        "TEFLoN-3e2d67886b70644fd1f7d79263b3c8dbed639e46", install_path
    ]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + "teflon")
    mccutils.mkdir(install_path + "teflon")

    for f in os.listdir(install_path +
                        "TEFLoN-3e2d67886b70644fd1f7d79263b3c8dbed639e46"):
        command = [
            "mv", install_path +
            "TEFLoN-3e2d67886b70644fd1f7d79263b3c8dbed639e46/" + f,
            install_path + "teflon"
        ]
        mccutils.run_command(command, log=snakemake.params.log)

    command = [
        "patch", "-i", snakemake.params.pseudo2refConvert_patch,
        install_path + "teflon/teflon_scripts/pseudo2refConvert.py"
    ]
    mccutils.run_command(command, log=snakemake.params.log)

    command = [
        "patch", "-i", snakemake.params.teflon_patch,
        install_path + "teflon/teflon.v0.4.py"
    ]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path +
                    "TEFLoN-3e2d67886b70644fd1f7d79263b3c8dbed639e46")
    mccutils.remove(snakemake.params.zipfile)

    # write version to file
    with open(
            snakemake.config['paths']['install'] + "/tools/teflon/version.log",
            "w") as version:
        version.write(snakemake.params.md5)
Exemple #5
0
def main():
    install_path = snakemake.config['paths']['install'] + "/tools/"

    mccutils.remove(snakemake.params.zipfile)
    download_success = mccutils.download(snakemake.params.url,
                                         snakemake.params.zipfile,
                                         md5=snakemake.params.md5,
                                         max_attempts=3)

    if not download_success:
        print("popoolationte download failed... exiting...")
        print("try running --install with --clean for clean installation")
        sys.exit(1)

    mccutils.remove(snakemake.config['paths']['install'] + "popoolationte")
    command = ["unzip", snakemake.params.zipfile]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + "popoolationte")
    mccutils.mkdir(install_path + "popoolationte")
    for f in os.listdir(snakemake.config['paths']['install'] +
                        "popoolationte"):
        command = [
            "mv", snakemake.config['paths']['install'] + "popoolationte/" + f,
            install_path + "popoolationte"
        ]
        mccutils.run_command(command, log=snakemake.params.log)

    command = [
        "patch", "-i", snakemake.params.patch1,
        install_path + "popoolationte/Modules/TEInsertUtility.pm"
    ]
    mccutils.run_command(command, log=snakemake.params.log)
    command = [
        "patch", "-i", snakemake.params.patch2,
        install_path + "popoolationte/Modules/TEInsert.pm"
    ]
    mccutils.run_command(command, log=snakemake.params.log)
    command = [
        "patch", "-i", snakemake.params.patch3,
        install_path + "popoolationte/samro.pl"
    ]
    mccutils.run_command(command, log=snakemake.params.log)
    command = [
        "patch", "-i", snakemake.params.patch4,
        install_path + "popoolationte/identify-te-insertsites.pl"
    ]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(snakemake.params.zipfile)
    mccutils.remove(snakemake.config['paths']['install'] + "popoolationte")

    # write version to file
    with open(
            snakemake.config['paths']['install'] +
            "/tools/popoolationte/version.log", "w") as version:
        version.write(snakemake.params.md5)
Exemple #6
0
def main():
    install_path = snakemake.config['paths']['install'] + "/tools/"
    mccutils.remove(snakemake.params.zipfile)
    download_success = mccutils.download(snakemake.params.url,
                                         snakemake.params.zipfile,
                                         md5=snakemake.params.md5,
                                         max_attempts=3)

    if not download_success:
        print("RelocaTE2 download failed... exiting...")
        print("try running --install with --clean for clean installation")
        sys.exit(1)

    mccutils.remove(snakemake.config['paths']['install'] + "RelocaTE2-2.0.1")
    command = ["unzip", snakemake.params.zipfile]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + "RelocaTE2-2.0.1")
    command = [
        "mv", snakemake.config['paths']['install'] + "RelocaTE2-2.0.1",
        install_path
    ]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + "relocate2")
    mccutils.mkdir(install_path + "relocate2")
    for f in os.listdir(install_path + "RelocaTE2-2.0.1"):
        command = [
            "mv", install_path + "RelocaTE2-2.0.1/" + f,
            install_path + "relocate2"
        ]
        mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + "RelocaTE2-2.0.1")
    mccutils.remove(snakemake.params.zipfile)

    tools = [
        "bwa", "bowtie2", "bowtie2_build", "blat", "samtools", "bedtools",
        "seqtk"
    ]

    with open(install_path + "relocate2/CONFIG", "w") as config_file:
        config_file.write("#tools\n")
        for tool in tools:
            if tool == "bowtie2_build":
                tool_bin = "bowtie2-build"
            else:
                tool_bin = tool
            output = subprocess.Popen(["which", tool_bin],
                                      stdout=subprocess.PIPE,
                                      stderr=subprocess.PIPE)
            path = output.stdout.read()
            path = path.decode()
            line = tool + "=" + path
            config_file.write(line)
Exemple #7
0
def main():
    install_path = snakemake.config['paths']['install'] + "/tools/"

    mccutils.remove(snakemake.params.zipfile)
    download_success = mccutils.download(snakemake.params.url,
                                         snakemake.params.zipfile,
                                         md5=snakemake.params.md5,
                                         max_attempts=3)

    if not download_success:
        print("teflon download failed... exiting...")
        print("try running --install with --clean for clean installation")
        sys.exit(1)

    mccutils.remove(snakemake.config['paths']['install'] +
                    "TEFLoN-9eca0152f3dd9dc6c44787a30d590f7e321b442c")
    command = ["unzip", snakemake.params.zipfile]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path +
                    "TEFLoN-9eca0152f3dd9dc6c44787a30d590f7e321b442c")
    command = [
        "mv", snakemake.config['paths']['install'] +
        "TEFLoN-9eca0152f3dd9dc6c44787a30d590f7e321b442c", install_path
    ]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + "teflon")
    mccutils.mkdir(install_path + "teflon")

    for f in os.listdir(install_path +
                        "TEFLoN-9eca0152f3dd9dc6c44787a30d590f7e321b442c"):
        command = [
            "mv", install_path +
            "TEFLoN-9eca0152f3dd9dc6c44787a30d590f7e321b442c/" + f,
            install_path + "teflon"
        ]
        mccutils.run_command(command, log=snakemake.params.log)

    command = [
        "patch", "-i", snakemake.params.pseudo2refConvert_patch,
        install_path + "teflon/teflon_scripts/pseudo2refConvert.py"
    ]
    mccutils.run_command(command, log=snakemake.params.log)

    command = [
        "patch", "-i", snakemake.params.teflon_patch,
        install_path + "teflon/teflon.v0.4.py"
    ]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path +
                    "TEFLoN-9eca0152f3dd9dc6c44787a30d590f7e321b442c")
    mccutils.remove(snakemake.params.zipfile)
Exemple #8
0
def main():
    download_success = mccutils.download(snakemake.params.url,
                                         snakemake.output[0],
                                         md5=snakemake.params.md5,
                                         max_attempts=3)
    if not download_success:
        print("popoolationTE2 download failed... exiting...")
        print("try running --install with --clean for clean installation")
        sys.exit(1)

    # write version to file
    with open(
            snakemake.config['paths']['install'] +
            "/tools/popoolationte2/version.log", "w") as version:
        version.write(snakemake.params.md5)
Exemple #9
0
def main():
    script_dir = os.path.dirname(os.path.abspath(__file__))
    
    # download fastq1
    fq1 = script_dir+"/SRR800842_1.fastq.gz"
    if os.path.exists(fq1):
        print(fq1+" already exists...skipping...")
    else:
        download_success = mccutils.download(url['fq1'], fq1, md5=md5['fq1'], timeout=22000)
        if not download_success:
            print("Download of SRR800842_1.fastq.gz failed...please rerun script to try again")
            mccutils.remove(fq1)
            sys.exit(1)

    # download fastq2
    fq2 = script_dir+"/SRR800842_2.fastq.gz"
    if os.path.exists(fq2):
        print(fq2+" already exists...skipping...")
    else:
        download_success = mccutils.download(url['fq2'], fq2, md5=md5['fq2'], timeout=22000)
        if not download_success:
            print("Download of SRR800842_2.fastq.gz failed...please rerun script to try again")
            mccutils.remove(fq2)
            sys.exit(1)
Exemple #10
0
def main():
    install_path = snakemake.config['paths']['install'] + "/tools/"
    mccutils.remove(snakemake.params.zipfile)
    download_success = mccutils.download(snakemake.params.url,
                                         snakemake.params.zipfile,
                                         md5=snakemake.params.md5,
                                         max_attempts=3)

    if not download_success:
        print("temp download failed... exiting...")
        print("try running --install with --clean for clean installation")
        sys.exit(1)

    extracted_file_name = "TEMP-4f67e1da836721a9f0999efa52e1e648fedb75fc"

    mccutils.remove(snakemake.config['paths']['install'] + extracted_file_name)
    command = ["unzip", snakemake.params.zipfile]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + extracted_file_name)
    command = [
        "mv", snakemake.config['paths']['install'] + extracted_file_name,
        install_path
    ]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + "temp")
    mccutils.mkdir(install_path + "temp")
    for f in os.listdir(install_path + extracted_file_name):
        command = [
            "mv", install_path + extracted_file_name + "/" + f,
            install_path + "temp"
        ]
        mccutils.run_command(command, log=snakemake.params.log)

    command = [
        "patch", "-i", snakemake.params.patch,
        install_path + "temp/scripts/TEMP_Absence.sh"
    ]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + extracted_file_name)
    mccutils.remove(snakemake.params.zipfile)

    # write version to file
    with open(snakemake.config['paths']['install'] + "/tools/temp/version.log",
              "w") as version:
        version.write(snakemake.params.md5)
Exemple #11
0
def main():
    mccutils.remove(snakemake.params.tar)
    download_success = mccutils.download(snakemake.params.url, snakemake.params.tar, md5=snakemake.params.md5, max_attempts=3)

    if not download_success:
        print("TE-Locate download failed... exiting...")
        print("try running --install with --clean for clean installation")
        sys.exit(1)


    command = ["tar", "-xvf", snakemake.params.tar, "-C", snakemake.config['paths']['install']+"/tools/te-locate/"]
    mccutils.run_command(command, log=snakemake.params.log)

    # write version to file
    with open(snakemake.config['paths']['install']+"/tools/te-locate/version.log","w") as version:
        version.write(snakemake.params.md5)
Exemple #12
0
def main():
    install_path = snakemake.config['paths']['install'] + "/tools/"
    mccutils.remove(snakemake.params.zipfile)
    download_success = mccutils.download(snakemake.params.url,
                                         snakemake.params.zipfile,
                                         md5=snakemake.params.md5,
                                         max_attempts=3)

    if not download_success:
        print("temp download failed... exiting...")
        print("try running --install with --clean for clean installation")
        sys.exit(1)

    mccutils.remove(snakemake.config['paths']['install'] +
                    "TEMP-d2500b904e2020d6a1075347b398525ede5feae1")
    command = ["unzip", snakemake.params.zipfile]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path +
                    "TEMP-d2500b904e2020d6a1075347b398525ede5feae1")
    command = [
        "mv", snakemake.config['paths']['install'] +
        "TEMP-d2500b904e2020d6a1075347b398525ede5feae1", install_path
    ]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + "temp")
    mccutils.mkdir(install_path + "temp")
    for f in os.listdir(install_path +
                        "TEMP-d2500b904e2020d6a1075347b398525ede5feae1"):
        command = [
            "mv", install_path +
            "TEMP-d2500b904e2020d6a1075347b398525ede5feae1/" + f,
            install_path + "temp"
        ]
        mccutils.run_command(command, log=snakemake.params.log)

    command = [
        "patch", "-i", snakemake.params.patch,
        install_path + "temp/scripts/TEMP_Absence.sh"
    ]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path +
                    "TEMP-d2500b904e2020d6a1075347b398525ede5feae1")
    mccutils.remove(snakemake.params.zipfile)
Exemple #13
0
def main():
    install_path = snakemake.config['paths']['install'] + "/tools/"

    raw_name = "tebreak-3f00badda822dcb6390bbea5a6a1e233cff3e99c"
    method_name = "tebreak"

    mccutils.remove(snakemake.params.zipfile)
    download_success = mccutils.download(snakemake.params.url,
                                         snakemake.params.zipfile,
                                         md5=snakemake.params.md5,
                                         max_attempts=3)

    if not download_success:
        print(method_name + " download failed... exiting...")
        print("try running --install with --clean for clean installation")
        sys.exit(1)

    mccutils.remove(snakemake.config['paths']['install'] + raw_name)
    command = ["unzip", snakemake.params.zipfile]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + raw_name)
    command = [
        "mv", snakemake.config['paths']['install'] + raw_name, install_path
    ]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + method_name)
    mccutils.mkdir(install_path + method_name)
    for f in os.listdir(install_path + raw_name):
        command = [
            "mv", install_path + raw_name + "/" + f, install_path + method_name
        ]
        mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + raw_name)
    mccutils.remove(snakemake.params.zipfile)

    # write version to file
    with open(install_path + "/" + method_name + "/version.log",
              "w") as version:
        version.write(snakemake.params.md5)
Exemple #14
0
def main():
    install_path = snakemake.config['paths']['install'] + "/tools/"

    raw_name = "ngs_te_mapper2-220619a3dd00b8c05c3b96328eb2424c6aad623e"
    method_name = "ngs_te_mapper2"

    mccutils.remove(snakemake.params.zipfile)
    download_success = mccutils.download(snakemake.params.url,
                                         snakemake.params.zipfile,
                                         md5=snakemake.params.md5,
                                         max_attempts=3)

    if not download_success:
        print(method_name + " download failed... exiting...")
        print("try running --install with --clean for clean installation")
        sys.exit(1)

    mccutils.remove(snakemake.config['paths']['install'] + raw_name)
    command = ["unzip", snakemake.params.zipfile]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + raw_name)
    command = [
        "mv", snakemake.config['paths']['install'] + raw_name, install_path
    ]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + method_name)
    mccutils.mkdir(install_path + method_name)
    for f in os.listdir(install_path + raw_name):
        command = [
            "mv", install_path + raw_name + "/" + f, install_path + method_name
        ]
        mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + raw_name)
    mccutils.remove(snakemake.params.zipfile)

    # write version to file
    with open(install_path + "/" + method_name + "/version.log",
              "w") as version:
        version.write(snakemake.params.md5)
Exemple #15
0
def main():
    install_path = snakemake.config['paths']['install'] + "/tools/"

    mccutils.remove(snakemake.params.zipfile)
    download_success = mccutils.download(snakemake.params.url,
                                         snakemake.params.zipfile,
                                         md5=snakemake.params.md5,
                                         max_attempts=3)

    if not download_success:
        print("ngs_te_mapper download failed... exiting...")
        print("try running --install with --clean for clean installation")
        sys.exit(1)

    mccutils.remove(snakemake.config['paths']['install'] +
                    "ngs_te_mapper-fb23590200666fe66f1c417c5d5934385cb77ab9")
    command = ["unzip", snakemake.params.zipfile]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path +
                    "ngs_te_mapper-fb23590200666fe66f1c417c5d5934385cb77ab9")
    command = [
        "mv", snakemake.config['paths']['install'] +
        "ngs_te_mapper-fb23590200666fe66f1c417c5d5934385cb77ab9", install_path
    ]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + "ngs_te_mapper")
    mccutils.mkdir(install_path + "ngs_te_mapper")
    for f in os.listdir(
            install_path +
            "ngs_te_mapper-fb23590200666fe66f1c417c5d5934385cb77ab9"):
        command = [
            "mv", install_path +
            "ngs_te_mapper-fb23590200666fe66f1c417c5d5934385cb77ab9/" + f,
            install_path + "ngs_te_mapper"
        ]
        mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path +
                    "ngs_te_mapper-fb23590200666fe66f1c417c5d5934385cb77ab9")
    mccutils.remove(snakemake.params.zipfile)
Exemple #16
0
def main():
    install_path = snakemake.config['paths']['install'] + "/tools/"

    raw_name = "TEMP2-4d25d050dc7832b82374502573e882a242457a0c"
    method_name = "temp2"

    mccutils.remove(snakemake.params.zipfile)
    download_success = mccutils.download(snakemake.params.url,
                                         snakemake.params.zipfile,
                                         md5=snakemake.params.md5,
                                         max_attempts=3)

    if not download_success:
        print(method_name + " download failed... exiting...")
        print("try running --install with --clean for clean installation")
        sys.exit(1)

    mccutils.remove(snakemake.config['paths']['install'] + raw_name)
    command = ["unzip", snakemake.params.zipfile]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + raw_name)
    command = [
        "mv", snakemake.config['paths']['install'] + raw_name, install_path
    ]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + method_name)
    mccutils.mkdir(install_path + method_name)
    for f in os.listdir(install_path + raw_name):
        command = [
            "mv", install_path + raw_name + "/" + f, install_path + method_name
        ]
        mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + raw_name)
    mccutils.remove(snakemake.params.zipfile)

    # write version to file
    with open(install_path + "/" + method_name + "/version.log",
              "w") as version:
        version.write(snakemake.params.md5)
def main():
    install_path = snakemake.config['paths']['install'] + "/tools/"

    raw_name = "ngs_te_mapper-f9f48996ac346ac86d57edbd00534aa1227b753e"

    mccutils.remove(snakemake.params.zipfile)
    download_success = mccutils.download(snakemake.params.url,
                                         snakemake.params.zipfile,
                                         md5=snakemake.params.md5,
                                         max_attempts=3)

    if not download_success:
        print("ngs_te_mapper download failed... exiting...")
        print("try running --install with --clean for clean installation")
        sys.exit(1)

    mccutils.remove(snakemake.config['paths']['install'] + raw_name)
    command = ["unzip", snakemake.params.zipfile]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + raw_name)
    command = [
        "mv", snakemake.config['paths']['install'] + raw_name, install_path
    ]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + "ngs_te_mapper")
    mccutils.mkdir(install_path + "ngs_te_mapper")
    for f in os.listdir(install_path + raw_name):
        command = [
            "mv", install_path + raw_name + "/" + f,
            install_path + "ngs_te_mapper"
        ]
        mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + raw_name)
    mccutils.remove(snakemake.params.zipfile)

    # write version to file
    with open(install_path + "ngs_te_mapper/version.log", "w") as version:
        version.write(snakemake.params.md5)
Exemple #18
0
def main():
    install_path = snakemake.config['paths']['install'] + "/tools/"
    mccutils.remove(snakemake.params.zipfile)
    download_success = mccutils.download(snakemake.params.url,
                                         snakemake.params.zipfile,
                                         md5=snakemake.params.md5,
                                         max_attempts=3)

    if not download_success:
        print("retroseq download failed... exiting...")
        print("try running --install with --clean for clean installation")
        sys.exit(1)

    mccutils.remove(snakemake.config['paths']['install'] +
                    "RetroSeq-700d4f76a3b996686652866f2b81fefc6f0241e0")
    command = ["unzip", snakemake.params.zipfile]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path +
                    "RetroSeq-700d4f76a3b996686652866f2b81fefc6f0241e0")
    command = [
        "mv", snakemake.config['paths']['install'] +
        "RetroSeq-700d4f76a3b996686652866f2b81fefc6f0241e0", install_path
    ]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + "retroseq")
    mccutils.mkdir(install_path + "retroseq")
    for f in os.listdir(install_path +
                        "RetroSeq-700d4f76a3b996686652866f2b81fefc6f0241e0"):
        command = [
            "mv", install_path +
            "RetroSeq-700d4f76a3b996686652866f2b81fefc6f0241e0/" + f,
            install_path + "retroseq"
        ]
        mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path +
                    "RetroSeq-700d4f76a3b996686652866f2b81fefc6f0241e0")
    mccutils.remove(snakemake.params.zipfile)
Exemple #19
0
def main():
    install_path = snakemake.config['paths']['install'] + "/tools/"
    mccutils.remove(snakemake.params.zipfile)
    download_success = mccutils.download(snakemake.params.url,
                                         snakemake.params.zipfile,
                                         md5=snakemake.params.md5,
                                         max_attempts=3)

    if not download_success:
        print("relocaTE download failed... exiting...")
        print("try running --install with --clean for clean installation")
        sys.exit(1)

    mccutils.remove(snakemake.config['paths']['install'] +
                    "RelocaTE-ce3a2066e15f5c14e2887fdf8dce0485e1750e5b")
    command = ["unzip", snakemake.params.zipfile]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path +
                    "RelocaTE-ce3a2066e15f5c14e2887fdf8dce0485e1750e5b")
    command = [
        "mv", snakemake.config['paths']['install'] +
        "RelocaTE-ce3a2066e15f5c14e2887fdf8dce0485e1750e5b", install_path
    ]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path + "relocate")
    mccutils.mkdir(install_path + "relocate/")
    for f in os.listdir(install_path +
                        "RelocaTE-ce3a2066e15f5c14e2887fdf8dce0485e1750e5b"):
        command = [
            "mv", install_path +
            "RelocaTE-ce3a2066e15f5c14e2887fdf8dce0485e1750e5b/" + f,
            install_path + "relocate/"
        ]
        mccutils.run_command(command, log=snakemake.params.log)

    command = [
        "patch", "-i", snakemake.params.patch,
        install_path + "relocate/scripts/relocaTE_insertionFinder.pl"
    ]
    mccutils.run_command(command, log=snakemake.params.log)

    mccutils.remove(install_path +
                    "RelocaTE-ce3a2066e15f5c14e2887fdf8dce0485e1750e5b")
    mccutils.remove(snakemake.params.zipfile)

    output = subprocess.Popen(["which", "perl"],
                              stdout=subprocess.PIPE,
                              stderr=subprocess.PIPE)
    perl_path = output.stdout.read()
    perl_path = perl_path.decode()

    for f in os.listdir(install_path + "relocate/scripts/"):
        if "pl" == f.split(".")[-1]:
            with open(install_path + "tmp", "w") as tmp:
                with open(install_path + "relocate/scripts/" + f,
                          "r") as script:
                    for line in script:
                        if "#!/usr/bin/perl" in line:
                            # line = "#!"+perl_path
                            line = "#!/usr/bin/env perl\n"
                        elif "defined @" in line:
                            line = line.replace("defined @", "@")

                        elif "$scripts/" in line and "perl" not in line and "relocaTE.pl" in f:
                            line = line.replace("$scripts/", "perl $scripts/")

                        tmp.write(line)

            mccutils.run_command([
                "mv", install_path + "tmp",
                install_path + "relocate/scripts/" + f
            ])

    # write version to file
    with open(
            snakemake.config['paths']['install'] +
            "/tools/relocate/version.log", "w") as version:
        version.write(snakemake.params.md5)
Exemple #20
0
def main():
    download_success = mccutils.download(snakemake.params.url, snakemake.output[0], md5=snakemake.params.md5, max_attempts=3)
    if not download_success:
        print("popoolationTE2 download failed... exiting...")
        print("try running --install with --clean for clean installation")
        sys.exit(1)