Skip to content

Commit

Permalink
add 10X multi to stats by project dag
Browse files Browse the repository at this point in the history
  • Loading branch information
CuijieLu committed Oct 12, 2023
1 parent dfc9073 commit 57a476e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scripts/cellranger_multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def cellragner_ch_vdj(config, file_name, ch_project_ID, project_ID, ge):
subprocess.run(cmd, shell=True)
# update new fastq file path after bam2fastq for each sub sample
config.update_fastq_location(key, destination_bam)

# TODO change working directory before starting last command
config.new_config_and_generate_cmd()

# for case of ch + fb - vdj
Expand Down
28 changes: 27 additions & 1 deletion stats_by_project_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def run_stats(ds, **kwargs):
import scripts.calculate_stats
import scripts.cellranger
import subprocess
import scripts.cellranger_multi
import os

project_directory = kwargs["params"]["project_directory"]
recipe = kwargs["params"]["recipe"]
Expand All @@ -29,7 +31,31 @@ def run_stats(ds, **kwargs):

# main process of calling stats here
# let's go ahead and run stats by project
if "10X_" in recipe:
# add multi process, use recipe as 10X_multi
if recipe == "10X_multi":
project_id = project_directory.split("/")[-1]
# copy the multi config from shared drive to cluster
cmd = "cp -R {}{} {}".format(scripts.cellranger_multi.ORIGIN_DRIVE_LOCATION, project_id[8:], scripts.cellranger_multi.DRIVE_LOCATION)
print(cmd)
# subprocess.run(cmd, shell=True)
os.chdir(scripts.cellranger_multi.STATS_AREA)
# gather sample set info from LIMS for each sample
sample_list_ori = os.listdir(project_directory)
sample_list = []
for sample in sample_list_ori:
# remove Sample_ prefix
sample_list.append(sample[7:])
for sample in sample_list:
sample_set = scripts.cellranger_multi.gather_sample_set_info(sample)
cmd = "bsub -J {}_multi -o {}_multi.out python /igo/work/igo/igo-demux/scripts/cellranger_multi.py ".format(sample, sample)
for key, value in sample_set.items():
if value is not None:
cmd = cmd + "-{}={} ".format(key, value)
cmd = cmd + "-genome={}".format(species)
print(cmd)
# subprocess.run(cmd, shell=True)

elif "10X_" in recipe:
scripts.cellranger.lanuch_by_project(project_directory, recipe, species)
elif "ONT" in recipe:
cmd = "bsub -J ont_stats -n 8 -M 8 python /igo/work/igo/igo-demux/scripts/ont_stats.py {}".format(project_directory)
Expand Down

0 comments on commit 57a476e

Please sign in to comment.