diff --git a/workflow/scripts/extractRefData.py b/workflow/scripts/extractRefData.py index fb3668e546ddf4a6ede435580e036b629587b2e0..bf06c95696354e6fe5d445718fbfb0769df4182d 100644 --- a/workflow/scripts/extractRefData.py +++ b/workflow/scripts/extractRefData.py @@ -5,15 +5,18 @@ import pandas as pd import warnings warnings.simplefilter(action='ignore', category=FutureWarning) + def get_args(): parser = argparse.ArgumentParser() - parser.add_argument('-r', '--returnParam',help="The parameter to return (URL or MD5).",required=True) + parser.add_argument('-r', '--returnParam', + help="The parameter to return (URL or MD5).", required=True) args = parser.parse_args() return args + def main(): args = get_args() - refQuery=pd.read_json("refQuery.json") + refQuery = pd.read_json("refQuery.json") if refQuery["File_URL"].count() == 1: if args.returnParam == "URL": print(refQuery["File_URL"].values[0]) @@ -23,7 +26,8 @@ def main(): print(refQuery["File_MD5"].values[0]) else: raise Exception("Multple references found: \n%s" % - refQuery["RID"]) + refQuery["RID"]) + if __name__ == '__main__': main() diff --git a/workflow/scripts/parseMeta.py b/workflow/scripts/parseMeta.py index 500054264f7c8c50310da92d9995f432930318d3..16411df357555991fefdcbd65a6cf0f1f0667017 100644 --- a/workflow/scripts/parseMeta.py +++ b/workflow/scripts/parseMeta.py @@ -5,52 +5,61 @@ import pandas as pd import warnings warnings.simplefilter(action='ignore', category=FutureWarning) + def get_args(): parser = argparse.ArgumentParser() - parser.add_argument('-r', '--repRID',help="The replicate RID.",required=True) - parser.add_argument('-m', '--metaFile',help="The metadata file to extract.",required=True) - parser.add_argument('-p', '--parameter',help="The parameter to extract.",required=True) + parser.add_argument( + '-r', '--repRID', help="The replicate RID.", required=True) + parser.add_argument('-m', '--metaFile', + help="The metadata file to extract.", required=True) + parser.add_argument('-p', '--parameter', + help="The parameter to extract.", required=True) args = parser.parse_args() return args def main(): args = get_args() - metaFile = pd.read_csv(args.metaFile,sep=",",header=0) + metaFile = pd.read_csv(args.metaFile, sep=",", header=0) # Check replicate RID metadata from 'File.csv' if (args.parameter == "repRID"): if (len(metaFile.Replicate_RID.unique()) > 1): - print("There are multiple replicate RID's in the metadata: " + " ".join(metaFile.Replicate_RID.unique())) + print("There are multiple replicate RID's in the metadata: " + + " ".join(metaFile.Replicate_RID.unique())) exit(1) if not (metaFile.Replicate_RID.unique() == args.repRID): - print("Replicate RID in metadata does not match run parameters: " + metaFile.Replicate_RID.unique() + " vs " + args.repRID) + print("Replicate RID in metadata does not match run parameters: " + + metaFile.Replicate_RID.unique() + " vs " + args.repRID) exit(1) else: - rep=metaFile["Replicate_RID"].unique()[0] + rep = metaFile["Replicate_RID"].unique()[0] print(rep) if (len(metaFile[metaFile["File_Type"] == "FastQ"]) > 2): - print("There are more then 2 fastq's in the metadata: " + " ".join(metaFile[metaFile["File_Type"] == "FastQ"].RID)) + print("There are more then 2 fastq's in the metadata: " + + " ".join(metaFile[metaFile["File_Type"] == "FastQ"].RID)) exit(1) # Check experiment RID metadata from 'Experiment.csv' if (args.parameter == "expRID"): if (len(metaFile.Experiment_RID.unique()) > 1): - print("There are multiple experoment RID's in the metadata: " + " ".join(metaFile.Experiment_RID.unique())) + print("There are multiple experoment RID's in the metadata: " + + " ".join(metaFile.Experiment_RID.unique())) exit(1) else: - exp=metaFile["Experiment_RID"].unique()[0] + exp = metaFile["Experiment_RID"].unique()[0] print(exp) # Check study RID metadata from 'Experiment.csv' if (args.parameter == "studyRID"): if (len(metaFile.Study_RID.unique()) > 1): - print("There are multiple study RID's in the metadata: " + " ".join(metaFile.Study_RID.unique())) + print("There are multiple study RID's in the metadata: " + + " ".join(metaFile.Study_RID.unique())) exit(1) else: - study=metaFile["Study_RID"].unique()[0] + study = metaFile["Study_RID"].unique()[0] print(study) - + # Get endedness metadata from 'Experiment Settings.csv' if (args.parameter == "endsMeta"): if (metaFile.Paired_End.unique() == "Single End"): @@ -60,7 +69,7 @@ def main(): else: endsMeta = "uk" print(endsMeta) - + # Manually get endness count from 'File.csv' if (args.parameter == "endsManual"): if (len(metaFile[metaFile["File_Type"] == "FastQ"]) == 1): @@ -68,7 +77,7 @@ def main(): elif (len(metaFile[metaFile["File_Type"] == "FastQ"]) == 2): endsManual = "pe" print(endsManual) - + # Get strandedness metadata from 'Experiment Settings.csv' if (args.parameter == "stranded"): if (metaFile.Has_Strand_Specific_Information.unique() == "yes"): @@ -76,10 +85,11 @@ def main(): elif (metaFile.Has_Strand_Specific_Information.unique() == "no"): stranded = "unstranded" else: - print("Stranded metadata not match expected options: " + metaFile.Has_Strand_Specific_Information.unique()) + print("Stranded metadata not match expected options: " + + metaFile.Has_Strand_Specific_Information.unique()) exit(1) print(stranded) - + # Get spike-in metadata from 'Experiment Settings.csv' if (args.parameter == "spike"): if (metaFile.Used_Spike_Ins.unique() == "yes"): @@ -87,7 +97,8 @@ def main(): elif (metaFile.Used_Spike_Ins.unique() == "no"): spike = "no" else: - print("Spike-ins metadata not match expected options: " + metaFile.Used_Spike_Ins.unique()) + print("Spike-ins metadata not match expected options: " + + metaFile.Used_Spike_Ins.unique()) exit(1) print(spike) @@ -98,7 +109,8 @@ def main(): elif (metaFile.Species.unique() == "Homo sapiens"): species = "Homo sapiens" else: - print("Species metadata not match expected options: " + metaFile.Species.unique()) + print("Species metadata not match expected options: " + + metaFile.Species.unique()) exit(1) print(species) @@ -107,5 +119,6 @@ def main(): readLength = metaFile.Read_Length.unique() print(str(readLength).strip('[]')) + if __name__ == '__main__': main() diff --git a/workflow/scripts/splitStudy.py b/workflow/scripts/splitStudy.py index 82ffc2881857dd5d1d27eee5ea6a381b02d0e9f5..bf1129eb4913efe366f6fc148b55474d934b72a9 100644 --- a/workflow/scripts/splitStudy.py +++ b/workflow/scripts/splitStudy.py @@ -5,20 +5,25 @@ import pandas as pd import warnings warnings.simplefilter(action='ignore', category=FutureWarning) + def get_args(): parser = argparse.ArgumentParser() - parser.add_argument('-s', '--studyRID',help="The study RID.",required=True) + parser.add_argument('-s', '--studyRID', + help="The study RID.", required=True) args = parser.parse_args() return args + def main(): args = get_args() - studyRID=pd.read_json(args.studyRID+"_studyRID.json") + studyRID = pd.read_json(args.studyRID+"_studyRID.json") if studyRID["RID"].count() > 0: - studyRID["RID"].to_csv(args.studyRID+"_studyRID.csv",header=False,index=False) + studyRID["RID"].to_csv( + args.studyRID+"_studyRID.csv", header=False, index=False) else: raise Exception("No associated replicates found: %s" % - studyRID) + studyRID) + if __name__ == '__main__': main() diff --git a/workflow/scripts/tinHist.py b/workflow/scripts/tinHist.py index 3d292c2eb8cadb3b16466c6b19d0574184d439d7..a95a9c23b4cf5ac3b25c85580a7b2c326bcb0eb1 100644 --- a/workflow/scripts/tinHist.py +++ b/workflow/scripts/tinHist.py @@ -6,38 +6,47 @@ import numpy as np import warnings warnings.simplefilter(action='ignore', category=FutureWarning) + def get_args(): parser = argparse.ArgumentParser() - parser.add_argument('-r', '--repRID',help="The replicate RID.",required=True) + parser.add_argument( + '-r', '--repRID', help="The replicate RID.", required=True) args = parser.parse_args() return args + def main(): args = get_args() - tin = pd.read_csv(args.repRID + '.sorted.deduped.tin.xls',sep="\t",header=0) - - hist = pd.cut(tin['TIN'],bins=pd.interval_range(start=0,freq=10,end=100,closed='right')).value_counts(sort=False) + tin = pd.read_csv(args.repRID + '.sorted.deduped.tin.xls', + sep="\t", header=0) + + hist = pd.cut(tin['TIN'], bins=pd.interval_range( + start=0, freq=10, end=100, closed='right')).value_counts(sort=False) labels = ["{0} - {1}".format(i, i + 9) for i in range(1, 100, 10)] #labels[0] = '0 - 10' - binned = tin.assign(Bins=lambda x: pd.cut(tin['TIN'],range(0,105,10),labels=labels,include_lowest=False,right=True)) - binned['chrom'] = binned['chrom'] = binned['chrom'].replace('chr1','chr01') - binned['chrom'] = binned['chrom'].replace('chr2','chr02') - binned['chrom'] = binned['chrom'].replace('chr3','chr03') - binned['chrom'] = binned['chrom'].replace('chr4','chr04') - binned['chrom'] = binned['chrom'].replace('chr5','chr05') - binned['chrom'] = binned['chrom'].replace('chr6','chr06') - binned['chrom'] = binned['chrom'].replace('chr7','chr07') - binned['chrom'] = binned['chrom'].replace('chr8','chr08') - binned['chrom'] = binned['chrom'].replace('chr9','chr09') - hist = pd.pivot_table(binned, values='geneID', index = 'Bins', columns = 'chrom', aggfunc=np.size) + binned = tin.assign(Bins=lambda x: pd.cut(tin['TIN'], range( + 0, 105, 10), labels=labels, include_lowest=False, right=True)) + binned['chrom'] = binned['chrom'] = binned['chrom'].replace( + 'chr1', 'chr01') + binned['chrom'] = binned['chrom'].replace('chr2', 'chr02') + binned['chrom'] = binned['chrom'].replace('chr3', 'chr03') + binned['chrom'] = binned['chrom'].replace('chr4', 'chr04') + binned['chrom'] = binned['chrom'].replace('chr5', 'chr05') + binned['chrom'] = binned['chrom'].replace('chr6', 'chr06') + binned['chrom'] = binned['chrom'].replace('chr7', 'chr07') + binned['chrom'] = binned['chrom'].replace('chr8', 'chr08') + binned['chrom'] = binned['chrom'].replace('chr9', 'chr09') + hist = pd.pivot_table(binned, values='geneID', + index='Bins', columns='chrom', aggfunc=np.size) hist['TOTAL'] = hist.sum(axis=1) - hist = hist[['TOTAL'] + [ i for i in hist.columns if i != 'TOTAL']] + hist = hist[['TOTAL'] + [i for i in hist.columns if i != 'TOTAL']] hist = hist.T.fillna(0.0).astype(int) #hist = hist.apply(lambda x: x/x.sum()*100, axis=1) - hist.to_csv(args.repRID + '.tin.hist.tsv',sep='\t') - medFile = open(args.repRID + '.tin.med.csv',"w") - medFile.write(str(round(tin['TIN'][(tin['TIN']!=0)].median(),2))) + hist.to_csv(args.repRID + '.tin.hist.tsv', sep='\t') + medFile = open(args.repRID + '.tin.med.csv', "w") + medFile.write(str(round(tin['TIN'][(tin['TIN'] != 0)].median(), 2))) medFile.close() + if __name__ == '__main__': main() diff --git a/workflow/scripts/utils.py b/workflow/scripts/utils.py index 5e4478e3b1cef96e9b4c05033f75122f87aad06e..548b84c0642ee1479c1ac2e968ba1cd1aa9ed660 100644 --- a/workflow/scripts/utils.py +++ b/workflow/scripts/utils.py @@ -1,14 +1,5 @@ #!/usr/bin/env python3 -# -# * -------------------------------------------------------------------------- -# * Licensed under MIT (https://git.biohpc.swmed.edu/BICF/Astrocyte/chipseq_analysis/LICENSE.md) -# * -------------------------------------------------------------------------- -# - -'''General utilities.''' - - import shlex import logging import subprocess @@ -32,7 +23,8 @@ def run_pipe(steps, outfile=None): if n == first_step_n: if n == last_step_n and outfile: # one-step pipeline with outfile with open(outfile, 'w') as fh: - print("one step shlex: %s to file: %s" % (shlex.split(step), outfile)) + print("one step shlex: %s to file: %s" % + (shlex.split(step), outfile)) p = Popen(shlex.split(step), stdout=fh) break print("first step shlex to stdout: %s" % (shlex.split(step))) @@ -40,12 +32,14 @@ def run_pipe(steps, outfile=None): p = Popen(shlex.split(step), stdout=PIPE) elif n == last_step_n and outfile: # only treat the last step specially if you're sending stdout to a file with open(outfile, 'w') as fh: - print("last step shlex: %s to file: %s" % (shlex.split(step), outfile)) + print("last step shlex: %s to file: %s" % + (shlex.split(step), outfile)) p_last = Popen(shlex.split(step), stdin=p.stdout, stdout=fh) p.stdout.close() p = p_last else: # handles intermediate steps and, in the case of a pipe to stdout, the last step - print("intermediate step %d shlex to stdout: %s" % (n, shlex.split(step))) + print("intermediate step %d shlex to stdout: %s" % + (n, shlex.split(step))) p_next = Popen(shlex.split(step), stdin=p.stdout, stdout=PIPE) p.stdout.close() p = p_next @@ -54,7 +48,8 @@ def run_pipe(steps, outfile=None): def block_on(command): - process = subprocess.Popen(shlex.split(command), stderr=subprocess.STDOUT, stdout=subprocess.PIPE) + process = subprocess.Popen(shlex.split( + command), stderr=subprocess.STDOUT, stdout=subprocess.PIPE) for line in iter(process.stdout.readline, b''): sys.stdout.write(line.decode('utf-8')) process.communicate() @@ -77,7 +72,7 @@ def count_lines(filename): "compress", "bzip2", "gzip" - ] + ] mime_type = mimetypes.guess_type(filename)[1] if mime_type in compressed_mimetypes: catcommand = 'gzip -dc' @@ -86,7 +81,7 @@ def count_lines(filename): out, err = run_pipe([ '%s %s' % (catcommand, filename), 'wc -l' - ]) + ]) return int(out) diff --git a/workflow/tests/test_alignReads.py b/workflow/tests/test_alignReads.py index eae8780f5641404ac9caabe32089369a3b0b1ea2..11f0f3d0d09236a3f3494a2c851fb4294f2a1323 100644 --- a/workflow/tests/test_alignReads.py +++ b/workflow/tests/test_alignReads.py @@ -6,18 +6,24 @@ import os import utils data_output_path = os.path.dirname(os.path.abspath(__file__)) + \ - '/../../' + '/../../' @pytest.mark.alignData def test_alignData_se(): - assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.se.unal.gz')) - assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.se.sorted.bam')) - assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.se.sorted.bam.bai')) + assert os.path.exists(os.path.join( + data_output_path, 'Q-Y5F6_1M.se.unal.gz')) + assert os.path.exists(os.path.join( + data_output_path, 'Q-Y5F6_1M.se.sorted.bam')) + assert os.path.exists(os.path.join( + data_output_path, 'Q-Y5F6_1M.se.sorted.bam.bai')) @pytest.mark.alignData def test_alignData_pe(): - assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.pe.unal.gz')) - assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.pe.sorted.bam')) - assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.pe.sorted.bam.bai')) + assert os.path.exists(os.path.join( + data_output_path, 'Q-Y5F6_1M.pe.unal.gz')) + assert os.path.exists(os.path.join( + data_output_path, 'Q-Y5F6_1M.pe.sorted.bam')) + assert os.path.exists(os.path.join( + data_output_path, 'Q-Y5F6_1M.pe.sorted.bam.bai')) diff --git a/workflow/tests/test_consistency.py b/workflow/tests/test_consistency.py index 073b12826b798ac94d16fda4291dfba2c1a42203..49991489ef71eccb2a88a039420661dfc1f0a303 100644 --- a/workflow/tests/test_consistency.py +++ b/workflow/tests/test_consistency.py @@ -6,19 +6,24 @@ from io import StringIO import os test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ - '/../../' + '/../../' + @pytest.mark.consistencySE def test_consistencySE(): - assert os.path.exists(os.path.join(test_output_path, 'SE_multiqc_data.json')) - assert readAssigned("assignedSE.txt","assignedExpectSE.txt") + assert os.path.exists(os.path.join( + test_output_path, 'SE_multiqc_data.json')) + assert readAssigned("assignedSE.txt", "assignedExpectSE.txt") + @pytest.mark.consistencyPE def test_consistencyPE(): - assert os.path.exists(os.path.join(test_output_path, 'PE_multiqc_data.json')) - assert readAssigned("assignedPE.txt","assignedExpectPE.txt") + assert os.path.exists(os.path.join( + test_output_path, 'PE_multiqc_data.json')) + assert readAssigned("assignedPE.txt", "assignedExpectPE.txt") + -def readAssigned(fileAssigned,fileExpectAssigned): +def readAssigned(fileAssigned, fileExpectAssigned): data = False assigned = open(fileAssigned, "r") expect = open(fileExpectAssigned, "r") diff --git a/workflow/tests/test_dataQC.py b/workflow/tests/test_dataQC.py index e77d4680fd8eac61c3a9b9a8fd175136a61244b9..55df66deaeda6dac18ea26455dd1e3948ceb28ba 100644 --- a/workflow/tests/test_dataQC.py +++ b/workflow/tests/test_dataQC.py @@ -6,12 +6,16 @@ from io import StringIO import os test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ - '/../../' + '/../../' + @pytest.mark.dataQC def test_dataQC(): - assert os.path.exists(os.path.join(test_output_path, 'Q-Y5F6_1M.se.sorted.deduped.tin.xls')) - assert countLines(os.path.join(test_output_path, 'Q-Y5F6_1M.se.sorted.deduped.tin.xls')) + assert os.path.exists(os.path.join( + test_output_path, 'Q-Y5F6_1M.se.sorted.deduped.tin.xls')) + assert countLines(os.path.join(test_output_path, + 'Q-Y5F6_1M.se.sorted.deduped.tin.xls')) + def countLines(fileName): data = False diff --git a/workflow/tests/test_dedupReads.py b/workflow/tests/test_dedupReads.py index 49cf420e2f0e2de923ae580c51dcdf42549f0713..89fc2b10fa4db847ccc16d5cce664bf551b29ee3 100644 --- a/workflow/tests/test_dedupReads.py +++ b/workflow/tests/test_dedupReads.py @@ -6,16 +6,24 @@ import os import utils data_output_path = os.path.dirname(os.path.abspath(__file__)) + \ - '/../../' + '/../../' @pytest.mark.dedupData def test_dedupData(): - assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.bam')) - assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.bam.bai')) - assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chr8.bam')) - assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chr8.bam.bai')) - assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chr4.bam')) - assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chr4.bam.bai')) - assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chrY.bam')) - assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chrY.bam.bai')) + assert os.path.exists(os.path.join( + data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.bam')) + assert os.path.exists(os.path.join( + data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.bam.bai')) + assert os.path.exists(os.path.join( + data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chr8.bam')) + assert os.path.exists(os.path.join( + data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chr8.bam.bai')) + assert os.path.exists(os.path.join( + data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chr4.bam')) + assert os.path.exists(os.path.join( + data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chr4.bam.bai')) + assert os.path.exists(os.path.join( + data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chrY.bam')) + assert os.path.exists(os.path.join( + data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chrY.bam.bai')) diff --git a/workflow/tests/test_downsampleData.py b/workflow/tests/test_downsampleData.py index fd42c49e169e387dd9662903b20866c40aec8907..6d98ad656b0bcb0a3e8aee5507149cdcf3cec5f0 100644 --- a/workflow/tests/test_downsampleData.py +++ b/workflow/tests/test_downsampleData.py @@ -6,8 +6,9 @@ from io import StringIO import os test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ - '/../../' + '/../../' + @pytest.mark.downsampleData def test_downsampleData(): - assert os.path.exists(os.path.join(test_output_path, 'sampled.1.fq')) \ No newline at end of file + assert os.path.exists(os.path.join(test_output_path, 'sampled.1.fq')) diff --git a/workflow/tests/test_fastqc.py b/workflow/tests/test_fastqc.py index 89303fe78e081a26fd6a8ea633997dffb8f920a6..07e76108fbfc92f945060d8e5d1e1ea8f74e6a4a 100644 --- a/workflow/tests/test_fastqc.py +++ b/workflow/tests/test_fastqc.py @@ -6,8 +6,10 @@ from io import StringIO import os test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ - '/../../' + '/../../' + @pytest.mark.fastqc def test_fastqc(): - assert os.path.exists(os.path.join(test_output_path, 'Q-Y5F6_1M.R1_fastqc.zip')) + assert os.path.exists(os.path.join( + test_output_path, 'Q-Y5F6_1M.R1_fastqc.zip')) diff --git a/workflow/tests/test_getBag.py b/workflow/tests/test_getBag.py index 1c63c9d95ac33aceeaa965852ede7bfc5e86bdc7..a99acc6963e51bd27b8e7acf0865e182876dbd01 100644 --- a/workflow/tests/test_getBag.py +++ b/workflow/tests/test_getBag.py @@ -6,8 +6,10 @@ from io import StringIO import os test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ - '/../../' + '/../../' + @pytest.mark.getBag def test_getBag(): - assert os.path.exists(os.path.join(test_output_path, 'Replicate_Q-Y5F6.zip')) + assert os.path.exists(os.path.join( + test_output_path, 'Replicate_Q-Y5F6.zip')) diff --git a/workflow/tests/test_getData.py b/workflow/tests/test_getData.py index a14be93ea8103aadf44aca3156ee28036cb6113e..95e2018eb5de04c55bdd8c6a118c961065add807 100644 --- a/workflow/tests/test_getData.py +++ b/workflow/tests/test_getData.py @@ -6,9 +6,12 @@ from io import StringIO import os test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ - '/../../' + '/../../' + @pytest.mark.getData def test_getData(): - assert os.path.exists(os.path.join(test_output_path, 'Replicate_Q-Y5F6/bagit.txt')) - assert os.path.exists(os.path.join(test_output_path, 'Replicate_Q-Y5F6/data/assets/Study/Q-Y4GY/Experiment/Q-Y4DP/Replicate/Q-Y5F6/mMARIS_Six2-#3.gene.rpkm.txt')) + assert os.path.exists(os.path.join( + test_output_path, 'Replicate_Q-Y5F6/bagit.txt')) + assert os.path.exists(os.path.join( + test_output_path, 'Replicate_Q-Y5F6/data/assets/Study/Q-Y4GY/Experiment/Q-Y4DP/Replicate/Q-Y5F6/mMARIS_Six2-#3.gene.rpkm.txt')) diff --git a/workflow/tests/test_inferMetadata.py b/workflow/tests/test_inferMetadata.py index 518664ced5ab4dd4e713dede9c58b9d87594799a..7485163631e2604ac2d5477a5c27b2fc9b235b44 100644 --- a/workflow/tests/test_inferMetadata.py +++ b/workflow/tests/test_inferMetadata.py @@ -6,9 +6,10 @@ from io import StringIO import os test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ - '/../../' + '/../../' + @pytest.mark.inferMetadata def test_inferMetadata(): - assert os.path.exists(os.path.join(test_output_path, 'Q-Y5F6_1M.se.inferMetadata.log')) - + assert os.path.exists(os.path.join( + test_output_path, 'Q-Y5F6_1M.se.inferMetadata.log')) diff --git a/workflow/tests/test_makeBigWig.py b/workflow/tests/test_makeBigWig.py index 9292ac64714017fde8371927cee616374a457b3a..d8f62f5edfb3b57868d0b4b18ed6a0deb6bd651e 100644 --- a/workflow/tests/test_makeBigWig.py +++ b/workflow/tests/test_makeBigWig.py @@ -6,7 +6,7 @@ import os import utils data_output_path = os.path.dirname(os.path.abspath(__file__)) + \ - '/../../' + '/../../' @pytest.mark.makeBigWig diff --git a/workflow/tests/test_makeFeatureCounts.py b/workflow/tests/test_makeFeatureCounts.py index d33527a9c7bffcaa9919639b72842cc8cf63b14f..e67bca804a3a1bcf1787a55088a95528076f08fe 100644 --- a/workflow/tests/test_makeFeatureCounts.py +++ b/workflow/tests/test_makeFeatureCounts.py @@ -6,11 +6,14 @@ import os import utils data_output_path = os.path.dirname(os.path.abspath(__file__)) + \ - '/../../' + '/../../' @pytest.mark.makeFeatureCounts def test_makeFeatureCounts(): - assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.se.countData')) - assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.se.countTable.csv')) - assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.se.tpmTable.csv')) + assert os.path.exists(os.path.join( + data_output_path, 'Q-Y5F6_1M.se.countData')) + assert os.path.exists(os.path.join( + data_output_path, 'Q-Y5F6_1M.se.countTable.csv')) + assert os.path.exists(os.path.join( + data_output_path, 'Q-Y5F6_1M.se.tpmTable.csv')) diff --git a/workflow/tests/test_outputBag.py b/workflow/tests/test_outputBag.py index 4132d834996e5557024dbbf587d4aca41594bf9e..c73e6474efdb9093b0cc66c00b220426be707690 100644 --- a/workflow/tests/test_outputBag.py +++ b/workflow/tests/test_outputBag.py @@ -6,7 +6,8 @@ from io import StringIO import os test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ - '/../../' + '/../../' + @pytest.mark.outputBag def test_outputBag(): diff --git a/workflow/tests/test_parseMetadata.py b/workflow/tests/test_parseMetadata.py index 59677bbba7d40058bdeb78ccceeeeddba4565a14..fa488800e4b6aeb5b1be2685d75b2801667f0855 100644 --- a/workflow/tests/test_parseMetadata.py +++ b/workflow/tests/test_parseMetadata.py @@ -6,13 +6,15 @@ from io import StringIO import os test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ - '/../../' + '/../../' + @pytest.mark.parseMetadata def test_parseMetadata(): assert os.path.exists(os.path.join(test_output_path, 'design.csv')) assert readLine(os.path.join(test_output_path, 'design.csv')) + def readLine(fileName): data = False file = open(fileName, "r") diff --git a/workflow/tests/test_trimData.py b/workflow/tests/test_trimData.py index ba0eeda481262647abc9e4a8bf362515ac0dc0e7..40dd2dcb79c4f9d615e20f48364247aa61265f7f 100644 --- a/workflow/tests/test_trimData.py +++ b/workflow/tests/test_trimData.py @@ -6,14 +6,18 @@ from io import StringIO import os test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ - '/../../' + '/../../' + @pytest.mark.trimData def test_trimData_se(): - assert os.path.exists(os.path.join(test_output_path, 'Q-Y5F6_1M.se_trimmed.fq.gz')) + assert os.path.exists(os.path.join( + test_output_path, 'Q-Y5F6_1M.se_trimmed.fq.gz')) @pytest.mark.trimData def test_trimData_pe(): - assert os.path.exists(os.path.join(test_output_path, 'Q-Y5F6_1M.pe_R1_val_1.fq.gz')) - assert os.path.exists(os.path.join(test_output_path, 'Q-Y5F6_1M.pe_R2_val_2.fq.gz')) + assert os.path.exists(os.path.join( + test_output_path, 'Q-Y5F6_1M.pe_R1_val_1.fq.gz')) + assert os.path.exists(os.path.join( + test_output_path, 'Q-Y5F6_1M.pe_R2_val_2.fq.gz'))