Skip to content

Commit

Permalink
update cellrange multi to handle both fb and ch
Browse files Browse the repository at this point in the history
  • Loading branch information
CuijieLu committed Dec 30, 2024
1 parent 0c91752 commit 724afce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
7 changes: 3 additions & 4 deletions scripts/cellranger_multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def update_fastq_location(self, sub_sample_name, destination):
# read ch file from shared drive and generate config/ch file per sample and return sample to sub sample info also
# default all hash tag are totalseq B from biolegend
def ch_file_generation(project_id, sample_name):
in_file_location = DRIVE_LOCATION + project_id + "/" + os.listdir(DRIVE_LOCATION + project_id)[0]
in_file_location = glob.glob("{}{}/*cell_hash.xlsx".format(DRIVE_LOCATION, project_id))[0]
with open(in_file_location, "rb") as f:
df = pd.read_excel(f, engine="openpyxl")
line_number = df[df[df.columns[0]] == "Your Submission:"].index.values
Expand Down Expand Up @@ -219,7 +219,7 @@ def ch_file_generation(project_id, sample_name):

# create fb template from user submitted file
def fb_file_generation(project_ID):
file_path = DRIVE_LOCATION + project_ID + "/" + os.listdir(DRIVE_LOCATION + project_ID)[0]
file_path = glob.glob("{}{}/*feature_barcoding.xlsx".format(DRIVE_LOCATION, project_ID))[0]
with open(file_path, "rb") as f:
df = pd.read_excel(f, engine="openpyxl")
line_number = df[df[df.columns[0]] == "Your Submission:"].index.values
Expand Down Expand Up @@ -258,8 +258,7 @@ def gather_config_info(sample_dict, genome, IGO_ID):

# if feature barcoding invovled, add feature list file path and create fb template
if "fb" in sample_dict.keys():
if "ch" not in sample_dict.keys():
fb_file_generation(project_ID)
fb_file_generation(project_ID)
config.features = CONFIG_AREA + "Project_{}/Project_{}_fb.csv".format(project_ID, project_ID)

# if cell hashing invovled, add cmo-set file path and get sample info from file, id as sample name and name as hashtag name
Expand Down
12 changes: 6 additions & 6 deletions stats_by_project_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ def run_stats(ds, **kwargs):
file_type = scripts.cellranger_multi.check_file_type(file_path)
if file_type == "ch":
ch = True
cmd = "mv {} {}/{}_cell_hash.xlsx".format(file_path, file_prefix, project_id)
print(cmd)
subprocess.run(cmd, shell=True)
ch_file_name = "{}/{}_cell_hash.xlsx".format(file_prefix, project_id)
os.rename(file_path, ch_file_name)
print(f"File renamed from {file_path} to {ch_file_name}")
elif file_type == "fb":
fb = True
cmd = "mv {} {}/{}_feature_barcoding.xlsx".format(file_path, file_prefix, project_id)
print(cmd)
subprocess.run(cmd, shell=True)
fb_file_name = "{}/{}_feature_barcoding.xlsx".format(file_prefix, project_id)
os.rename(file_path, fb_file_name)
print(f"File renamed from {file_path} to {fb_file_name}")

os.chdir(scripts.cellranger_multi.STATS_AREA)
# gather sample set info from LIMS for each sample
Expand Down

0 comments on commit 724afce

Please sign in to comment.