Skip to content

Commit

Permalink
Get run manifests from lims instead
Browse files Browse the repository at this point in the history
  • Loading branch information
ssjunnebo committed Sep 11, 2024
1 parent 1a43207 commit 38b3276
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 26 deletions.
30 changes: 17 additions & 13 deletions taca/analysis/analysis_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,25 @@ def _process(run):
if run.status_changed(current_run_status):
run.update_statusdb(current_run_status) #TODO: what info needs to be gathered and uploaded?
elif sequencing_done and demultiplexing_status == "not started": # Sequencing done. Start demux
if not run.manifest_exists():
if not run.manifest_exists(): #TODO: this should check for the zip file in lims output location
logger.warn(f"Run manifest is missing for {run.flowcell_id}")
#TODO: email operator warning
return
elif run.manifest_exists():
sample_info = run.get_sample_info_from_manifest()
sample_types = run.get_sample_types(sample_info)
if len(sample_types) == 1:
run.start_demux()
elif len(sample_types) > 1:
for sample_type in sample_types:
run.make_manifest(sample_info, sample_type)
run.start_demux()
else:
logger.warn(f"No samples were found in the sample manifest for run {run.flowcell_id}.")
#TODO: email operator warning
return
os.mkdir(run.demux_dir)
run.copy_manifests()
run_manifests = glob.glob(
os.path.join(run.run_dir, "RunManifest_*.csv")
) # TODO: is this filename right?
sub_demux_count = 0
for run_manifest in run_manifests.sort():
if len(run_manifests) == 1:
demux_dir = run.demux_dir
elif len(run_manifests) > 1:
demux_dir = f"Demultiplexing_{sub_demux_count}"
os.mkdir(demux_dir)
run.start_demux(run_manifest, demux_dir)
sub_demux_count += 1
current_run_status = "demultiplexing"
if run.status_changed(current_run_status):
run.update_statusdb(current_run_status)
Expand All @@ -56,6 +58,8 @@ def _process(run):
elif sequencing_done and demultiplexing_status == "finished":
transfer_file = CONFIG.get('Element').get('Aviti').get('transfer_log')
if not run.is_transferred(transfer_file) and not run.transfer_ongoing():
#TODO: if multiple demux dirs, aggregate the results into Demultiplexing?
run.aggregate_demux_results
run.sync_metadata()
run.make_transfer_indicator()
current_run_status = "transferring"
Expand Down
18 changes: 5 additions & 13 deletions taca/element/Element_Runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,11 @@ def update_statusdb(self, current_run_status):
pass

def manifest_exists(self):
return os.path.isfile(self.run_manifest_file)
return os.path.isfile(self.run_manifest_file) #TODO: still true?

def get_sample_info_from_manifest(self):
sample_info = {} #TODO: populate with sample info from manifest
return sample_info

def get_sample_types(self, sample_info):
sample_types = () #TODO: populate
return sample_types

def make_manifest(self, sample_info, sample_type):
#TODO: make a manifest for a sample_type based on sample_info
return
def copy_manifests():
#TODO: copy manifest zip file from lims location and unzip
pass

def generate_demux_command(self):
command = [
Expand All @@ -82,7 +74,7 @@ def generate_demux_command(self):
]
return command

def start_demux(self):
def start_demux(self, run_manifest, demux_dir):
with chdir(self.run_dir):
cmd = self.generate_demux_command()
misc.call_external_command_detached(
Expand Down

0 comments on commit 38b3276

Please sign in to comment.