Skip to content

Instantly share code, notes, and snippets.

@caner-ercan
Created October 23, 2024 23:16
Show Gist options
  • Select an option

  • Save caner-ercan/4b2c2ed4b2851a93996e49cdbbb2f6d3 to your computer and use it in GitHub Desktop.

Select an option

Save caner-ercan/4b2c2ed4b2851a93996e49cdbbb2f6d3 to your computer and use it in GitHub Desktop.
#QuPath HPC project run
base_path = "B:/data/BE/cell_detect/acformer/"
collected_data = NULL
for (dataset in c("NU_dataset_rois","MDA1_dataset_rois","MDA2_dataset_rois")){
txt_path = paste(base_path,dataset ,"img_list.txt",sep="/")
print(txt_path)
txt_table = read.table(txt_path)
txt_table[2] <- dataset
if (is.null(collected_data)){
collected_data <- txt_table
}else{
collected_data <- rbind(collected_data, txt_table )
}
}
write.csv(collected_data, paste0(base_path,"/img_list.csv"))
#!/bin/bash
#!################################################################################
#!#### Modify the options in this section as appropriate ######
#!#### Change path to log files to your desired location ######
#!#### rds-cache path: /rsrch6/scratch/trans_mol_path/YOURNAME/aitil/logs/ ######
#!################################################################################
#BSUB -J qupath_export
#BSUB -W 0:30
#BSUB -o /rsrch5/home/trans_mol_path/cercan/data/BE/cell_detect/acformer/NU_dataset_rois/scripts/logs/%J_%I_lsf.out
#BSUB -e /rsrch5/home/trans_mol_path/cercan/data/BE/cell_detect/acformer/NU_dataset_rois/scripts/logs/%J_%I_lsf.err
#BSUB -cwd /rsrch5/home/trans_mol_path/cercan/code/Barretts/CLAM/
#BSUB -q short
#BSUB -n 4
#BSUB -M 2
#BSUB -R rusage[mem=64]
#BSUB -B
#BSUB -N
#BSUB –u [email protected]
#BSUB -J "patch[1-1484:1]"
#!### you need to change the end index ####
#!###### you need to change this part #####################
#cd /rsrch5/home/trans_mol_path/cercan/code/Barretts/CLAM/
#module load singularity/3.7.0
#module load cuda10.0/toolkit/10.0.130
# module load anaconda3/2023.07-2
# source activate clam_albm_tf
QUPATH=/rsrch5/home/trans_mol_path/cercan/app/QuPath044/QuPath/bin/QuPath.sh
base_folder=/rsrch5/home/trans_mol_path/cercan/data/BE/cell_detect/acformer/
csv_file=$base_folder/img_list.csv
proj=$(awk -F',' "NR==$LSB_JOBINDEX {print \$2}" "$csv_file"| tr -d '[:space:]')
img_name=$(awk -F',' "NR==$LSB_JOBINDEX {print \$1}" "$csv_file"| tr -d '[:space:]')
project_file=$base_folder/$proj/project.qpproj
scipt_path=$base_folder/NU_dataset_rois/scripts/export_tissue_tile_acformer.groovy
echo "LSB_JOBINDEX : $LSB_JOBINDEX"
echo "project_file : $project_file"
echo "img_name : $img_name"
echo "scipt_path : $scipt_path"
$QUPATH script -p "$project_file" -i "$img_name" "$scipt_path"
def outputPath = buildFilePath(PROJECT_BASE_DIR,"img_list.txt")
def imgList = getProject().getImageList()
def file = new File(outputPath)
file.withWriter { writer ->
imgList.each { value ->
writer.writeLine(value.toString())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment