Skip to content

Commit

Permalink
illumina.py: fixed small bug where exception was not raised for missi…
Browse files Browse the repository at this point in the history
…ng files (#926)

* illumina.py: fixed small bug where exception was not raised for missing files
  • Loading branch information
notestaff committed Feb 14, 2019
1 parent e922e7a commit aeb76dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
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

0 comments on commit aeb76dd

Please sign in to comment.