Skip to content
Snippets Groups Projects

Resolve "callPeaksMACS exits when data is bad"

Merged Venkat Malladi requested to merge 26-negative-fraglength into master
Compare and
5 files
+ 36
3
Preferences
File browser
Compare changes
@@ -138,8 +138,20 @@ def call_peaks_macs(experiment, xcor, control, prefix, genome_size, chrom_sizes)
@@ -138,8 +138,20 @@ def call_peaks_macs(experiment, xcor, control, prefix, genome_size, chrom_sizes)
with open(xcor, 'r') as xcor_fh:
with open(xcor, 'r') as xcor_fh:
firstline = xcor_fh.readline()
firstline = xcor_fh.readline()
frag_lengths = firstline.split()[2] # third column
frag_lengths = firstline.split()[2] # third column
fragment_length = frag_lengths.split(',')[0] # grab first value
frag_lengths_array = frag_lengths.split(',')
logger.info("Fraglen %s", fragment_length)
fragment_length = 0
 
fragment = False
 
# Loop through all values of fragment length
 
for f in frag_lengths.split(','):
 
fragment_length = f
 
logger.info("Fraglen %s", fragment_length)
 
if int(fragment_length) > 50:
 
fragment = True
 
break
 
 
if fragment == False:
 
logger.info('Error in cross-correlation analysis: %s', frag_lengths_array)
 
raise Exception("Error in cross-correlation analysis: %s" % frag_lengths_array)
# Generate narrow peaks and preliminary signal tracks
# Generate narrow peaks and preliminary signal tracks
@@ -3,10 +3,29 @@
@@ -3,10 +3,29 @@
import pytest
import pytest
import os
import os
import utils
import utils
 
from io import StringIO
 
import call_peaks_macs
test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../output/callPeaksMACS/'
'/../output/callPeaksMACS/'
 
test_data_path = os.path.dirname(os.path.abspath(__file__)) + \
 
'/../../test_data/'
 
 
 
@pytest.mark.unit
 
def test_fragment_length():
 
experiment = "experiment.tagAlign.gz"
 
control = "control.tagAlign.gz"
 
prefix = 'test'
 
genome_size = 'hs'
 
chrom_sizes = 'genomefile.txt'
 
cross_qc = os.path.join(test_data_path, 'test_cross.qc')
 
with pytest.raises(Exception) as excinfo:
 
call_peaks_macs.call_peaks_macs(experiment, cross_qc, control, prefix, genome_size, chrom_sizes)
 
assert str(excinfo.value) == "Error in cross-correlation analysis: ['0', '20', '33']"
 
 
@pytest.mark.singleend
@pytest.mark.singleend
def test_fc_signal_singleend():
def test_fc_signal_singleend():
+ 0
1
@@ -108,5 +108,4 @@ report*.html*
@@ -108,5 +108,4 @@ report*.html*
timeline*.html*
timeline*.html*
/workflow/output/*
/workflow/output/*
/work/*
/work/*
/test_data/*
/.nextflow/*
/.nextflow/*
+ 2
0
@@ -14,8 +14,10 @@ All notable changes to this project will be documented in this file.
@@ -14,8 +14,10 @@ All notable changes to this project will be documented in this file.
- Make gtf and geneName files as param inputs
- Make gtf and geneName files as param inputs
- Fix xcor to increase file size for --random-source
- Fix xcor to increase file size for --random-source
- Fix skip diff test for paired-end data
- Fix skip diff test for paired-end data
 
- Fix xcor to get lowest non zero value about 50
- Fix references to display in Multiqc report
- Fix references to display in Multiqc report
 
## [publish_1.0.6 ] - 2019-05-31
## [publish_1.0.6 ] - 2019-05-31
### Added
### Added
- MIT LICENSE
- MIT LICENSE