Skip to content
Snippets Groups Projects
Commit 2ec44620 authored by Gervaise Henry's avatar Gervaise Henry :cowboy:
Browse files

Auto pep8'd all python code

parent b2f6e30d
Branches
Tags
2 merge requests!58Develop,!45Resolve "Move references to GUDMAP/RBK"
Pipeline #8149 canceled with stages
in 5 minutes and 56 seconds
Showing
with 176 additions and 108 deletions
...@@ -5,15 +5,18 @@ import pandas as pd ...@@ -5,15 +5,18 @@ import pandas as pd
import warnings import warnings
warnings.simplefilter(action='ignore', category=FutureWarning) warnings.simplefilter(action='ignore', category=FutureWarning)
def get_args(): def get_args():
parser = argparse.ArgumentParser() 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() args = parser.parse_args()
return args return args
def main(): def main():
args = get_args() args = get_args()
refQuery=pd.read_json("refQuery.json") refQuery = pd.read_json("refQuery.json")
if refQuery["File_URL"].count() == 1: if refQuery["File_URL"].count() == 1:
if args.returnParam == "URL": if args.returnParam == "URL":
print(refQuery["File_URL"].values[0]) print(refQuery["File_URL"].values[0])
...@@ -23,7 +26,8 @@ def main(): ...@@ -23,7 +26,8 @@ def main():
print(refQuery["File_MD5"].values[0]) print(refQuery["File_MD5"].values[0])
else: else:
raise Exception("Multple references found: \n%s" % raise Exception("Multple references found: \n%s" %
refQuery["RID"]) refQuery["RID"])
if __name__ == '__main__': if __name__ == '__main__':
main() main()
...@@ -5,52 +5,61 @@ import pandas as pd ...@@ -5,52 +5,61 @@ import pandas as pd
import warnings import warnings
warnings.simplefilter(action='ignore', category=FutureWarning) warnings.simplefilter(action='ignore', category=FutureWarning)
def get_args(): def get_args():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('-r', '--repRID',help="The replicate RID.",required=True) parser.add_argument(
parser.add_argument('-m', '--metaFile',help="The metadata file to extract.",required=True) '-r', '--repRID', help="The replicate RID.", required=True)
parser.add_argument('-p', '--parameter',help="The parameter to extract.",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() args = parser.parse_args()
return args return args
def main(): def main():
args = get_args() 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' # Check replicate RID metadata from 'File.csv'
if (args.parameter == "repRID"): if (args.parameter == "repRID"):
if (len(metaFile.Replicate_RID.unique()) > 1): 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) exit(1)
if not (metaFile.Replicate_RID.unique() == args.repRID): 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) exit(1)
else: else:
rep=metaFile["Replicate_RID"].unique()[0] rep = metaFile["Replicate_RID"].unique()[0]
print(rep) print(rep)
if (len(metaFile[metaFile["File_Type"] == "FastQ"]) > 2): 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) exit(1)
# Check experiment RID metadata from 'Experiment.csv' # Check experiment RID metadata from 'Experiment.csv'
if (args.parameter == "expRID"): if (args.parameter == "expRID"):
if (len(metaFile.Experiment_RID.unique()) > 1): 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) exit(1)
else: else:
exp=metaFile["Experiment_RID"].unique()[0] exp = metaFile["Experiment_RID"].unique()[0]
print(exp) print(exp)
# Check study RID metadata from 'Experiment.csv' # Check study RID metadata from 'Experiment.csv'
if (args.parameter == "studyRID"): if (args.parameter == "studyRID"):
if (len(metaFile.Study_RID.unique()) > 1): 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) exit(1)
else: else:
study=metaFile["Study_RID"].unique()[0] study = metaFile["Study_RID"].unique()[0]
print(study) print(study)
# Get endedness metadata from 'Experiment Settings.csv' # Get endedness metadata from 'Experiment Settings.csv'
if (args.parameter == "endsMeta"): if (args.parameter == "endsMeta"):
if (metaFile.Paired_End.unique() == "Single End"): if (metaFile.Paired_End.unique() == "Single End"):
...@@ -60,7 +69,7 @@ def main(): ...@@ -60,7 +69,7 @@ def main():
else: else:
endsMeta = "uk" endsMeta = "uk"
print(endsMeta) print(endsMeta)
# Manually get endness count from 'File.csv' # Manually get endness count from 'File.csv'
if (args.parameter == "endsManual"): if (args.parameter == "endsManual"):
if (len(metaFile[metaFile["File_Type"] == "FastQ"]) == 1): if (len(metaFile[metaFile["File_Type"] == "FastQ"]) == 1):
...@@ -68,7 +77,7 @@ def main(): ...@@ -68,7 +77,7 @@ def main():
elif (len(metaFile[metaFile["File_Type"] == "FastQ"]) == 2): elif (len(metaFile[metaFile["File_Type"] == "FastQ"]) == 2):
endsManual = "pe" endsManual = "pe"
print(endsManual) print(endsManual)
# Get strandedness metadata from 'Experiment Settings.csv' # Get strandedness metadata from 'Experiment Settings.csv'
if (args.parameter == "stranded"): if (args.parameter == "stranded"):
if (metaFile.Has_Strand_Specific_Information.unique() == "yes"): if (metaFile.Has_Strand_Specific_Information.unique() == "yes"):
...@@ -76,10 +85,11 @@ def main(): ...@@ -76,10 +85,11 @@ def main():
elif (metaFile.Has_Strand_Specific_Information.unique() == "no"): elif (metaFile.Has_Strand_Specific_Information.unique() == "no"):
stranded = "unstranded" stranded = "unstranded"
else: 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) exit(1)
print(stranded) print(stranded)
# Get spike-in metadata from 'Experiment Settings.csv' # Get spike-in metadata from 'Experiment Settings.csv'
if (args.parameter == "spike"): if (args.parameter == "spike"):
if (metaFile.Used_Spike_Ins.unique() == "yes"): if (metaFile.Used_Spike_Ins.unique() == "yes"):
...@@ -87,7 +97,8 @@ def main(): ...@@ -87,7 +97,8 @@ def main():
elif (metaFile.Used_Spike_Ins.unique() == "no"): elif (metaFile.Used_Spike_Ins.unique() == "no"):
spike = "no" spike = "no"
else: 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) exit(1)
print(spike) print(spike)
...@@ -98,7 +109,8 @@ def main(): ...@@ -98,7 +109,8 @@ def main():
elif (metaFile.Species.unique() == "Homo sapiens"): elif (metaFile.Species.unique() == "Homo sapiens"):
species = "Homo sapiens" species = "Homo sapiens"
else: else:
print("Species metadata not match expected options: " + metaFile.Species.unique()) print("Species metadata not match expected options: " +
metaFile.Species.unique())
exit(1) exit(1)
print(species) print(species)
...@@ -107,5 +119,6 @@ def main(): ...@@ -107,5 +119,6 @@ def main():
readLength = metaFile.Read_Length.unique() readLength = metaFile.Read_Length.unique()
print(str(readLength).strip('[]')) print(str(readLength).strip('[]'))
if __name__ == '__main__': if __name__ == '__main__':
main() main()
...@@ -5,20 +5,25 @@ import pandas as pd ...@@ -5,20 +5,25 @@ import pandas as pd
import warnings import warnings
warnings.simplefilter(action='ignore', category=FutureWarning) warnings.simplefilter(action='ignore', category=FutureWarning)
def get_args(): def get_args():
parser = argparse.ArgumentParser() 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() args = parser.parse_args()
return args return args
def main(): def main():
args = get_args() args = get_args()
studyRID=pd.read_json(args.studyRID+"_studyRID.json") studyRID = pd.read_json(args.studyRID+"_studyRID.json")
if studyRID["RID"].count() > 0: 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: else:
raise Exception("No associated replicates found: %s" % raise Exception("No associated replicates found: %s" %
studyRID) studyRID)
if __name__ == '__main__': if __name__ == '__main__':
main() main()
...@@ -6,38 +6,47 @@ import numpy as np ...@@ -6,38 +6,47 @@ import numpy as np
import warnings import warnings
warnings.simplefilter(action='ignore', category=FutureWarning) warnings.simplefilter(action='ignore', category=FutureWarning)
def get_args(): def get_args():
parser = argparse.ArgumentParser() 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() args = parser.parse_args()
return args return args
def main(): def main():
args = get_args() args = get_args()
tin = pd.read_csv(args.repRID + '.sorted.deduped.tin.xls',sep="\t",header=0) 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)
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} - {1}".format(i, i + 9) for i in range(1, 100, 10)]
#labels[0] = '0 - 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 = tin.assign(Bins=lambda x: pd.cut(tin['TIN'], range(
binned['chrom'] = binned['chrom'] = binned['chrom'].replace('chr1','chr01') 0, 105, 10), labels=labels, include_lowest=False, right=True))
binned['chrom'] = binned['chrom'].replace('chr2','chr02') binned['chrom'] = binned['chrom'] = binned['chrom'].replace(
binned['chrom'] = binned['chrom'].replace('chr3','chr03') 'chr1', 'chr01')
binned['chrom'] = binned['chrom'].replace('chr4','chr04') binned['chrom'] = binned['chrom'].replace('chr2', 'chr02')
binned['chrom'] = binned['chrom'].replace('chr5','chr05') binned['chrom'] = binned['chrom'].replace('chr3', 'chr03')
binned['chrom'] = binned['chrom'].replace('chr6','chr06') binned['chrom'] = binned['chrom'].replace('chr4', 'chr04')
binned['chrom'] = binned['chrom'].replace('chr7','chr07') binned['chrom'] = binned['chrom'].replace('chr5', 'chr05')
binned['chrom'] = binned['chrom'].replace('chr8','chr08') binned['chrom'] = binned['chrom'].replace('chr6', 'chr06')
binned['chrom'] = binned['chrom'].replace('chr9','chr09') binned['chrom'] = binned['chrom'].replace('chr7', 'chr07')
hist = pd.pivot_table(binned, values='geneID', index = 'Bins', columns = 'chrom', aggfunc=np.size) 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['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.T.fillna(0.0).astype(int)
#hist = hist.apply(lambda x: x/x.sum()*100, axis=1) #hist = hist.apply(lambda x: x/x.sum()*100, axis=1)
hist.to_csv(args.repRID + '.tin.hist.tsv',sep='\t') hist.to_csv(args.repRID + '.tin.hist.tsv', sep='\t')
medFile = open(args.repRID + '.tin.med.csv',"w") medFile = open(args.repRID + '.tin.med.csv', "w")
medFile.write(str(round(tin['TIN'][(tin['TIN']!=0)].median(),2))) medFile.write(str(round(tin['TIN'][(tin['TIN'] != 0)].median(), 2)))
medFile.close() medFile.close()
if __name__ == '__main__': if __name__ == '__main__':
main() main()
#!/usr/bin/env python3 #!/usr/bin/env python3
#
# * --------------------------------------------------------------------------
# * Licensed under MIT (https://git.biohpc.swmed.edu/BICF/Astrocyte/chipseq_analysis/LICENSE.md)
# * --------------------------------------------------------------------------
#
'''General utilities.'''
import shlex import shlex
import logging import logging
import subprocess import subprocess
...@@ -32,7 +23,8 @@ def run_pipe(steps, outfile=None): ...@@ -32,7 +23,8 @@ def run_pipe(steps, outfile=None):
if n == first_step_n: if n == first_step_n:
if n == last_step_n and outfile: # one-step pipeline with outfile if n == last_step_n and outfile: # one-step pipeline with outfile
with open(outfile, 'w') as fh: 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) p = Popen(shlex.split(step), stdout=fh)
break break
print("first step shlex to stdout: %s" % (shlex.split(step))) print("first step shlex to stdout: %s" % (shlex.split(step)))
...@@ -40,12 +32,14 @@ def run_pipe(steps, outfile=None): ...@@ -40,12 +32,14 @@ def run_pipe(steps, outfile=None):
p = Popen(shlex.split(step), stdout=PIPE) 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 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: 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_last = Popen(shlex.split(step), stdin=p.stdout, stdout=fh)
p.stdout.close() p.stdout.close()
p = p_last p = p_last
else: # handles intermediate steps and, in the case of a pipe to stdout, the last step 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_next = Popen(shlex.split(step), stdin=p.stdout, stdout=PIPE)
p.stdout.close() p.stdout.close()
p = p_next p = p_next
...@@ -54,7 +48,8 @@ def run_pipe(steps, outfile=None): ...@@ -54,7 +48,8 @@ def run_pipe(steps, outfile=None):
def block_on(command): 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''): for line in iter(process.stdout.readline, b''):
sys.stdout.write(line.decode('utf-8')) sys.stdout.write(line.decode('utf-8'))
process.communicate() process.communicate()
...@@ -77,7 +72,7 @@ def count_lines(filename): ...@@ -77,7 +72,7 @@ def count_lines(filename):
"compress", "compress",
"bzip2", "bzip2",
"gzip" "gzip"
] ]
mime_type = mimetypes.guess_type(filename)[1] mime_type = mimetypes.guess_type(filename)[1]
if mime_type in compressed_mimetypes: if mime_type in compressed_mimetypes:
catcommand = 'gzip -dc' catcommand = 'gzip -dc'
...@@ -86,7 +81,7 @@ def count_lines(filename): ...@@ -86,7 +81,7 @@ def count_lines(filename):
out, err = run_pipe([ out, err = run_pipe([
'%s %s' % (catcommand, filename), '%s %s' % (catcommand, filename),
'wc -l' 'wc -l'
]) ])
return int(out) return int(out)
......
...@@ -6,18 +6,24 @@ import os ...@@ -6,18 +6,24 @@ import os
import utils import utils
data_output_path = os.path.dirname(os.path.abspath(__file__)) + \ data_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../../' '/../../'
@pytest.mark.alignData @pytest.mark.alignData
def test_alignData_se(): 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(
assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.se.sorted.bam')) 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.bai')) 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 @pytest.mark.alignData
def test_alignData_pe(): 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(
assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.pe.sorted.bam')) 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.bai')) 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'))
...@@ -6,19 +6,24 @@ from io import StringIO ...@@ -6,19 +6,24 @@ from io import StringIO
import os import os
test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../../' '/../../'
@pytest.mark.consistencySE @pytest.mark.consistencySE
def test_consistencySE(): def test_consistencySE():
assert os.path.exists(os.path.join(test_output_path, 'SE_multiqc_data.json')) assert os.path.exists(os.path.join(
assert readAssigned("assignedSE.txt","assignedExpectSE.txt") test_output_path, 'SE_multiqc_data.json'))
assert readAssigned("assignedSE.txt", "assignedExpectSE.txt")
@pytest.mark.consistencyPE @pytest.mark.consistencyPE
def test_consistencyPE(): def test_consistencyPE():
assert os.path.exists(os.path.join(test_output_path, 'PE_multiqc_data.json')) assert os.path.exists(os.path.join(
assert readAssigned("assignedPE.txt","assignedExpectPE.txt") test_output_path, 'PE_multiqc_data.json'))
assert readAssigned("assignedPE.txt", "assignedExpectPE.txt")
def readAssigned(fileAssigned,fileExpectAssigned): def readAssigned(fileAssigned, fileExpectAssigned):
data = False data = False
assigned = open(fileAssigned, "r") assigned = open(fileAssigned, "r")
expect = open(fileExpectAssigned, "r") expect = open(fileExpectAssigned, "r")
......
...@@ -6,12 +6,16 @@ from io import StringIO ...@@ -6,12 +6,16 @@ from io import StringIO
import os import os
test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../../' '/../../'
@pytest.mark.dataQC @pytest.mark.dataQC
def test_dataQC(): def test_dataQC():
assert os.path.exists(os.path.join(test_output_path, 'Q-Y5F6_1M.se.sorted.deduped.tin.xls')) assert os.path.exists(os.path.join(
assert countLines(os.path.join(test_output_path, 'Q-Y5F6_1M.se.sorted.deduped.tin.xls')) 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): def countLines(fileName):
data = False data = False
......
...@@ -6,16 +6,24 @@ import os ...@@ -6,16 +6,24 @@ import os
import utils import utils
data_output_path = os.path.dirname(os.path.abspath(__file__)) + \ data_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../../' '/../../'
@pytest.mark.dedupData @pytest.mark.dedupData
def test_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(
assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.bam.bai')) 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.chr8.bam')) assert os.path.exists(os.path.join(
assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chr8.bam.bai')) 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.chr4.bam')) assert os.path.exists(os.path.join(
assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chr4.bam.bai')) 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.chrY.bam')) assert os.path.exists(os.path.join(
assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chrY.bam.bai')) 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'))
...@@ -6,8 +6,9 @@ from io import StringIO ...@@ -6,8 +6,9 @@ from io import StringIO
import os import os
test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../../' '/../../'
@pytest.mark.downsampleData @pytest.mark.downsampleData
def test_downsampleData(): def test_downsampleData():
assert os.path.exists(os.path.join(test_output_path, 'sampled.1.fq')) assert os.path.exists(os.path.join(test_output_path, 'sampled.1.fq'))
\ No newline at end of file
...@@ -6,8 +6,10 @@ from io import StringIO ...@@ -6,8 +6,10 @@ from io import StringIO
import os import os
test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../../' '/../../'
@pytest.mark.fastqc @pytest.mark.fastqc
def test_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'))
...@@ -6,8 +6,10 @@ from io import StringIO ...@@ -6,8 +6,10 @@ from io import StringIO
import os import os
test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../../' '/../../'
@pytest.mark.getBag @pytest.mark.getBag
def test_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'))
...@@ -6,9 +6,12 @@ from io import StringIO ...@@ -6,9 +6,12 @@ from io import StringIO
import os import os
test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../../' '/../../'
@pytest.mark.getData @pytest.mark.getData
def test_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(
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')) 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'))
...@@ -6,9 +6,10 @@ from io import StringIO ...@@ -6,9 +6,10 @@ from io import StringIO
import os import os
test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../../' '/../../'
@pytest.mark.inferMetadata @pytest.mark.inferMetadata
def test_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'))
...@@ -6,7 +6,7 @@ import os ...@@ -6,7 +6,7 @@ import os
import utils import utils
data_output_path = os.path.dirname(os.path.abspath(__file__)) + \ data_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../../' '/../../'
@pytest.mark.makeBigWig @pytest.mark.makeBigWig
......
...@@ -6,11 +6,14 @@ import os ...@@ -6,11 +6,14 @@ import os
import utils import utils
data_output_path = os.path.dirname(os.path.abspath(__file__)) + \ data_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../../' '/../../'
@pytest.mark.makeFeatureCounts @pytest.mark.makeFeatureCounts
def test_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(
assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.se.countTable.csv')) data_output_path, 'Q-Y5F6_1M.se.countData'))
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.countTable.csv'))
assert os.path.exists(os.path.join(
data_output_path, 'Q-Y5F6_1M.se.tpmTable.csv'))
...@@ -6,7 +6,8 @@ from io import StringIO ...@@ -6,7 +6,8 @@ from io import StringIO
import os import os
test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../../' '/../../'
@pytest.mark.outputBag @pytest.mark.outputBag
def test_outputBag(): def test_outputBag():
......
...@@ -6,13 +6,15 @@ from io import StringIO ...@@ -6,13 +6,15 @@ from io import StringIO
import os import os
test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../../' '/../../'
@pytest.mark.parseMetadata @pytest.mark.parseMetadata
def test_parseMetadata(): def test_parseMetadata():
assert os.path.exists(os.path.join(test_output_path, 'design.csv')) assert os.path.exists(os.path.join(test_output_path, 'design.csv'))
assert readLine(os.path.join(test_output_path, 'design.csv')) assert readLine(os.path.join(test_output_path, 'design.csv'))
def readLine(fileName): def readLine(fileName):
data = False data = False
file = open(fileName, "r") file = open(fileName, "r")
......
...@@ -6,14 +6,18 @@ from io import StringIO ...@@ -6,14 +6,18 @@ from io import StringIO
import os import os
test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../../' '/../../'
@pytest.mark.trimData @pytest.mark.trimData
def test_trimData_se(): 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 @pytest.mark.trimData
def test_trimData_pe(): 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(
assert os.path.exists(os.path.join(test_output_path, 'Q-Y5F6_1M.pe_R2_val_2.fq.gz')) 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'))
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment