Skip to content

Commit

Permalink
Merge pull request #9 from DOED-DAAD/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
mattheww95 authored Oct 22, 2024
2 parents 8d1c867 + ee200cb commit 304876d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/mikrokondo_tools/cli/samplesheet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
@click.option("-s", "--schema-input", "schema_input", type=click.Path(), default=None, help="An optional schema_input.json file pre-downloaded for mikrokondo.")
@click.argument("input_directory", type=click.Path(exists=True))
def samplesheet(output_sheet, read_1, read_2, input_directory, schema_input):
logger = u.get_logger()
logger = u.get_logger(__name__)
output_sheet = p.Path(output_sheet)
if output_sheet.is_file():
logger.error("Input sample sheet already exists, please re-name your new sheet or the existing one. %s", output_sheet)
sys.exit(e.EEXIST)

data = ss.get_samples(p.Path(input_directory))
ngs_data = ss.NGSData(data[0], data[1], read_1, read_2, p.Path(output_sheet), schema_input)
ngs_data = ss.NGSData(data[0], data[1], read_1, read_2, output_sheet, schema_input)
return ngs_data.create_sample_sheet()
7 changes: 4 additions & 3 deletions src/mikrokondo_tools/samplesheet/samplesheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,10 @@ def organize_data(self) -> t.Dict[str, t.List[SampleRow]]:
sample_sheet[k] = []
for idx in range(len(v[0])):
sample_sheet[k].append(SampleRow(sample=k, fastq_1=v[0][idx], fastq_2=v[1][idx]))

self.update_sample_sheet_se(sample_sheet, se_reads.items(), SampleRow.longreads_key())
self.update_sample_sheet_se(sample_sheet, assemblies.items(), SampleRow.assembly_key())
if se_reads:
self.update_sample_sheet_se(sample_sheet, se_reads.items(), SampleRow.longreads_key())
if assemblies:
self.update_sample_sheet_se(sample_sheet, assemblies.items(), SampleRow.assembly_key())
return sample_sheet

def update_sample_sheet_se(self, sample_sheet: t.Dict[str, t.List[SampleRow]], items: t.Iterable[t.Tuple[str, list]], field: str):
Expand Down

0 comments on commit 304876d

Please sign in to comment.