Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

illumina.py: fixed small bug where exception was not raised for missing files #926

Merged
merged 4 commits into from
Feb 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions illumina.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,13 +596,17 @@ def close(self):
self.tempDir = None

def get_RunInfo(self):
if self.runinfo is None and os.path.isfile(os.path.join(self.path, 'RunInfo.xml')):
self.runinfo = RunInfo(os.path.join(self.path, 'RunInfo.xml'))
if self.runinfo is None:
runinfo_file = os.path.join(self.path, 'RunInfo.xml')
util.file.check_paths(runinfo_file)
self.runinfo = RunInfo(runinfo_file)
return self.runinfo

def get_SampleSheet(self, only_lane=None):
if self.samplesheet is None and os.path.isfile(os.path.join(self.path, 'SampleSheet.csv')):
self.samplesheet = SampleSheet(os.path.join(self.path, 'SampleSheet.csv'), only_lane=only_lane)
if self.samplesheet is None:
samplesheet_file = os.path.join(self.path, 'SampleSheet.csv')
util.file.check_paths(samplesheet_file)
self.samplesheet = SampleSheet(samplesheet_file, only_lane=only_lane)
return self.samplesheet

def get_intensities_dir(self):
Expand Down
4 changes: 2 additions & 2 deletions test/unit/test_illumina.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ def test_tarball_run_info(self):
def test_tarball_fail_missing_data(self):
inDir = util.file.get_test_input_path(self)
with illumina.IlluminaDirectory(os.path.join(inDir, 'bcl-runinfo.tar.gz')) as idir:
self.assertRaises(Exception, idir.get_SampleSheet())
self.assertRaises(Exception, idir.get_SampleSheet)
with illumina.IlluminaDirectory(os.path.join(inDir, 'bcl-samplesheet.tar.gz')) as idir:
self.assertRaises(Exception, idir.get_RunInfo())
self.assertRaises(Exception, idir.get_RunInfo)


class TestDifficultSampleNames(TestCaseWithTmp):
Expand Down