Skip to content
Snippets Groups Projects
Commit 4c9bb1e9 authored by Holly Ruess's avatar Holly Ruess
Browse files

Fix Pool and Pseudoreps

parent 4e7b319a
Branches
Tags
1 merge request!12Resolve "Fix Pool and Pseudoreps"
......@@ -403,21 +403,26 @@ xcorDesign = xcorReads
// Make Experiment design files to be read in for downstream analysis
process defineExpDesignFiles {
publishDir "$baseDir/output/design", mode: 'copy'
publishDir "${outDir}/design", mode: 'copy'
input:
file xcorDesign
file xcorDesign
output:
file '*.tsv' into experimentObjs mode flatten
file '*.tsv' into experimentObjs mode flatten
script:
"""
python3 $baseDir/scripts/experiment_design.py -d $xcorDesign -a
"""
if (params.astrocyte == true) {
"""
module load python/3.6.1-2-anaconda
python3 ${baseDir}/scripts/experiment_design.py -d ${xcorDesign}
"""
}
else {
"""
python3 ${baseDir}/scripts/experiment_design.py -d ${xcorDesign}
"""
}
}
......@@ -427,28 +432,41 @@ process poolAndPsuedoReads {
tag "${experimentObjs.baseName}"
publishDir "$baseDir/output/design", mode: 'copy'
publishDir "${outDir}/design", mode: 'copy'
input:
file experimentObjs
file experimentObjs
output:
file '*.tsv' into experimentPoolObjs
file '*.tsv' into experimentPoolObjs
script:
if (pairedEnd) {
"""
python3 $baseDir/scripts/pool_and_psuedoreplicate.py -d $experimentObjs -p -a
"""
}
else {
"""
python3 $baseDir/scripts/pool_and_psuedoreplicate.py -d $experimentObjs -a
"""
}
if (params.astrocyte == true) {
if (pairedEnd) {
"""
module load python/3.6.1-2-anaconda
python3 ${baseDir}/scripts/pool_and_psuedoreplicate.py -d ${experimentObjs} -p
"""
}
else {
"""
module load python/3.6.1-2-anaconda
python3 ${baseDir}/scripts/pool_and_psuedoreplicate.py -d ${experimentObjs}
"""
}
}
else {
if (pairedEnd) {
"""
python3 ${baseDir}/scripts/pool_and_psuedoreplicate.py -d ${experimentObjs} -p
"""
}
else {
"""
python3 ${baseDir}/scripts/pool_and_psuedoreplicate.py -d ${experimentObjs}
"""
}
}
}
......
......@@ -30,33 +30,10 @@ def get_args():
help="The design file to make experiemnts (tsv format).",
required=True)
parser.add_argument('-a', '--atac',
help="True/False if ATAC-seq or ChIP-seq.",
default=False,
action='store_true')
args = parser.parse_args()
return args
def update_controls(design):
'''Update design file to append controls list.'''
logger.info("Running control file update.")
file_dict = design[['sample_id', 'tag_align']] \
.set_index('sample_id').T.to_dict()
design['control_tag_align'] = design['control_id'] \
.apply(lambda x: file_dict[x]['tag_align'])
logger.info("Removing rows that are there own control.")
design = design[design['control_id'] != design['sample_id']]
return design
def make_experiment_design(design):
'''Make design file by grouping for each experiment'''
......@@ -70,7 +47,6 @@ def make_experiment_design(design):
def main():
args = get_args()
design = args.design
atac = args.atac
# Create a file handler
handler = logging.FileHandler('experiment_generation.log')
......@@ -79,14 +55,8 @@ def main():
# Read files as dataframes
design_df = pd.read_csv(design, sep='\t')
# Update design file for check_controls
if not atac:
new_design_df = update_controls(design_df)
else:
new_design_df = design_df
# write out experiment design files
make_experiment_design(new_design_df)
make_experiment_design(design_df)
if __name__ == '__main__':
......
......@@ -43,11 +43,6 @@ def get_args():
help="Cutoff ratio used for choosing controls.",
default=1.2)
parser.add_argument('-a', '--atac',
help="True/False if ATAC-seq or ChIP-seq.",
default=False,
action='store_true')
args = parser.parse_args()
return args
......@@ -146,7 +141,6 @@ def main():
paired = args.paired
design = args.design
cutoff_ratio = args.cutoff
atac = args.atac
# Create a file handler
handler = logging.FileHandler('experiment_generation.log')
......
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