Esempio n. 1
0
])

# get useful logs
artifacts = f"{workdir}/artifacts/"
logs_list = [
    "/var/log/daemon.log",
    "/var/log/debug",
    "/var/log/middlewared.log",
    "/var/log/messages",
    "/var/log/syslog",
]

if not os.path.exists(artifacts):
    os.makedirs(artifacts)

for log in logs_list:
    get_file(log, artifacts, 'root', 'testing', ip)

# get dmesg and put it in artifacts
dmesg_option = '' if scale else ' -a'
results = SSH_TEST(f'dmesg{dmesg_option}', 'root', 'testing', ip)
dmsg = open(f'{artifacts}/dmesg', 'w')
dmsg.writelines(results['output'])
dmsg.close()

# get core.get_jobs and put it in artifacts
results = SSH_TEST('midclt call core.get_jobs | jq .', 'root', 'testing', ip)
dmsg = open(f'{artifacts}/core.get_jobs', 'w')
dmsg.writelines(results['output'])
dmsg.close()
Esempio n. 2
0
def home():
    if request.method == "POST":
        url = request.form['url']
        type_ = request.form['type']
        get_file(url, type_)
    return render_template("home.html")
Esempio n. 3
0
        call(["py.test-3.6", "-v", "--junitxml",
              f"{results_xml}{i}_tests_result.xml"] + (
                  ["-k", testexpr] if testexpr else []
        ) + [f"api2/{i}.py"])

# get useful logs
artifacts = f"{workdir}/artifacts/{api}"
logs_list = [
    "/var/log/middlewared.log",
    "/var/log/messages",
    "/var/log/debug.log",
    "/var/log/console.log"
]
if not path.exists(artifacts):
    makedirs(artifacts)

for log in logs_list:
    get_file(log, artifacts, 'root', 'testing', ip)

# get dmesg and put it in artifacs
results = SSH_TEST('dmesg -a', 'root', 'testing', ip)
dmsg = open(f'{artifacts}/dmesg', 'w')
dmsg.writelines(results['output'])
dmsg.close()

# get core.get_jobs and put it in artifacs
results = SSH_TEST('midclt call core.get_jobs | jq .', 'root', 'testing', ip)
dmsg = open(f'{artifacts}/core_get_job', 'w')
dmsg.writelines(results['output'])
dmsg.close()
Esempio n. 4
0
    #----------------
    elif x == 'help':
        logging.debug("print 'help_list'\n")
        print(help_list)

    #----------------
    elif x == 'clear':
        logging.debug("refresh window\n")
        os.system('cls')
        print('=' * 64 + f"\n{title}\n" + '=' * 64)

    #----------------
    elif 'load' in x:
        if 'from' in x:
            status_file = functions.get_file(x)
        else:
            status_file = 'status file.CSV'

        if change == True:
            print(
                "The function 'load' is block, because in this session status was changed!"
            )

        else:
            if os.path.isfile(status_file) == True:
                if change == True:
                    print("Warehouse status is changed!")

                if functions.confirm_choice() == True:
                    logging.debug(f"loading data form {status_file}")
    # write the integrated file
    integrated_coverage_file = "%s/genes_and_regions_coverage.tab"%cnv_outdir; integrated_coverage_file_tmp = "%s.tmp"%integrated_coverage_file
    if fun.file_is_empty(integrated_coverage_file) or opt.replace_cnv is True or opt.replace is True: 

       # integrate in one
        df_genes = pd.read_csv(gene_to_coverage_file, sep="\t")
        df_regions = pd.read_csv(gene_to_coverage_file_regions, sep="\t")
        df_integrated = df_genes.merge(df_regions, on="ID", validate="one_to_one", suffixes=("", "_+-10kb_region"))

        # write
        df_integrated.to_csv(integrated_coverage_file_tmp, sep="\t", header=True, index=False)
        os.rename(integrated_coverage_file_tmp, integrated_coverage_file)

    # remove everyhing that is not the coverage file
    for f in os.listdir(cnv_outdir): 
        if f not in {fun.get_file(gene_to_coverage_file), fun.get_file(gene_to_coverage_file_regions), fun.get_file(integrated_coverage_file)}: fun.delete_file_or_folder("%s/%s"%(cnv_outdir, f))
 
    # In Laia's script, she calculates coverage as the median reads per gene (cov per gene) / mean of the cov per gene across all genes

print("CNV analysis finished")


#####################################
##### STRUCTURAL VARIATION ##########
#####################################

if opt.run_gridss:

    print("Starting structural variation analysis with GRIDSS. This will call and annotate genomic rearrangements. This is not prepared for real work")

    # create the directories