Skip to content

Commit

Permalink
add function for archived projects to run cellranger multi
Browse files Browse the repository at this point in the history
  • Loading branch information
CuijieLu committed Dec 30, 2024
1 parent 724afce commit f782cf8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
15 changes: 10 additions & 5 deletions scripts/cellranger_multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@

# cellranger command line options
OPTIONS = " --nopreflight --jobmode=lsf --mempercore=64 --disable-ui --maxjobs=200"
def find_fastq_file(sample_ID_list):
def find_fastq_file(sample_ID_list, archive = False):
# get whole list of all fastq files that available with project folder as tag
path_prefix = "/igo/staging/FASTQ/"
if archive:
path_prefix = "/igo/delivery/FASTQ/"
else:
path_prefix = "/igo/staging/FASTQ/"

run_list = os.listdir(path_prefix)
# dictionary of run_ID->project_list
run_project_dict = {}
Expand Down Expand Up @@ -238,7 +242,7 @@ def fb_file_generation(project_ID):
for antibody in antibody_seq_dict.keys():
file.write("{},{},R2,5PNNNNNNNNNN(BC),{},Antibody Capture\n".format(antibody, antibody, antibody_seq_dict[antibody]))

def gather_config_info(sample_dict, genome, IGO_ID):
def gather_config_info(sample_dict, genome, IGO_ID, archive):
"""
sample_dict contains all the information about samples, sample name, project_ID and recipe name
example: {"ge":"LJ01_IGO_14396_1", "vdj": "LJ01_VDJ_IGO_14396_C_1", "fb":"", "ch":""}
Expand Down Expand Up @@ -274,7 +278,7 @@ def gather_config_info(sample_dict, genome, IGO_ID):
sample_list = []
for i in sample_dict.values():
sample_list.append(i)
fastq_list = find_fastq_file(sample_list)
fastq_list = find_fastq_file(sample_list, archive)
for key, value in sample_dict.items():
print("key: {}, value: {}".format(key, value))
if key == "ge":
Expand Down Expand Up @@ -487,6 +491,7 @@ def check_file_type(file_path):
parser.add_argument('-ch')
parser.add_argument('-fb')
parser.add_argument('-genome', help = 'Human or Mouse', required = True)
parser.add_argument('-archive', action='store_true', default=False)
args = parser.parse_args()
sample_dict = {"ge":args.ge}
if args.vdj:
Expand All @@ -500,7 +505,7 @@ def check_file_type(file_path):
ch_project_ID = "_".join(args.fb.split("IGO_")[1].split("_")[:-1])

genome = args.genome
config = gather_config_info(sample_dict, genome, args.ge)
config = gather_config_info(sample_dict, genome, args.ge, args.archive)
print(config.lirbaries)
project_ID = "_".join(args.ge.split("IGO_")[1].split("_")[:-1])
file_name = "{}Project_{}/{}.csv".format(CONFIG_AREA, project_ID, args.ge)
Expand Down
8 changes: 7 additions & 1 deletion stats_by_project_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ def run_stats(ds, **kwargs):

os.chdir(scripts.cellranger_multi.STATS_AREA)
# gather sample set info from LIMS for each sample
archive = False
if "delivery" in project_directory:
archive = True

sample_list_ori = os.listdir(project_directory)
sample_list = []
for sample in sample_list_ori:
Expand All @@ -87,8 +91,10 @@ def run_stats(ds, **kwargs):
if value is not None:
cmd = cmd + "-{}={} ".format(key, value)
cmd = cmd + "-genome={}".format(species)
if archive:
cmd = cmd + "-archive"
print(cmd)
# subprocess.run(cmd, shell=True)
subprocess.run(cmd, shell=True)

elif "SC_Chromium" in recipe:
scripts.cellranger.launch_cellranger_by_project_location(project_directory, recipe, species)
Expand Down

0 comments on commit f782cf8

Please sign in to comment.