STOmics / SAW

GNU General Public License v3.0
145 stars 34 forks source link

SAW ipr2img failed #151

Closed Clouate closed 1 month ago

Clouate commented 2 months ago
          running code  
echo `date` "=> image processing and registration start......."
export HDF5_USE_FILE_LOCKING=FALSE
dataDir='/xskydata/project/spatialTranscriptomics/2024/Q3/spatial_transcript_mus.2024.9.23/QC/bgi/WK010'

imageTarFile='/xskydata/project/spatialTranscriptomics/2024/Q3/spatial_transcript_mus.2024.9.23/rawData/musBrain_WK010/ImageStudio_QC/D03257E614_20240822_114652/D03257E614_SC_20240822_114652_3.0.4.tar.gz'

iprFile='/xskydata/project/spatialTranscriptomics/2024/Q3/spatial_transcript_mus.2024.9.23/rawData/musBrain_WK010/ImageStudio_QC/D03257E614_20240822_114652/D03257E614_SC_20240822_114652_3.0.4.ipr'

#iprFile='/xskydata/project/spatialTranscriptomics/2024/Q3/spatial_transcript_mus.2024.9.23/QC/bgi/WK010/03.register/manual_ipr/D03257E614_SC_20240925_111918_3.0.4.ipr'

registJson='/xskydata/project/spatialTranscriptomics/2024/Q3/spatial_transcript_mus.2024.9.23/QC/bgi/WK010/03.register/manual_register/20240925093324.regist.json'

imgTarDIR=$(dirname $imageTarFile)
iprDIR=$(dirname $iprFile)
SN='D03257E614'

sif='/xskydata/apps/singularity/SAW/SAW_7.1.sif'

export SINGULARITY_BIND=$outDir,$imgTarDIR,$iprDIR,$dataDir

cp -rf ${iprFile} ${dataDir}/03.register/${SN}.reregist.ipr

offsetX=`cat ${registJson} | sed 's/,/\n/g' | grep "offsetX" | sed 's/:/\n/g' | sed '1d' | sed 's/}//g'|sed 's/"//g'`
offsetY=`cat ${registJson} | sed 's/,/\n/g' | grep "offsetY" | sed 's/:/\n/g' | sed '1d' | sed 's/}//g'|sed 's/"//g'`
flip=`cat ${registJson} | sed 's/,/\n/g' | grep "flip" | sed 's/:/\n/g' | sed '1d' | sed 's/}//g'|sed 's/"//g'`
rotate=`cat ${registJson} | sed 's/,/\n/g' | grep "rotate" | sed 's/:/\n/g' | sed '1d' | sed 's/}//g'|sed 's/"//g'`
isTunedStr=`cat ${registJson} | sed 's/,/\n/g' | grep "isTuned" | sed 's/:/\n/g' | sed '1d' | sed 's/}//g'|sed 's/"//g'`
extrude_x=`cat ${registJson} | sed 's/,/\n/g' | grep "extrude_x" | sed 's/:/\n/g' | sed '1d' | sed 's/}//g'|sed 's/"//g'`
extrude_y=`cat ${registJson} | sed 's/,/\n/g' | grep "extrude_y" | sed 's/:/\n/g' | sed '1d' | sed 's/}//g'|sed 's/"//g'`
if [[ isTunedStr == 'true' ]];then isTuned='True';else isTuned='False';fi

#/usr/bin/time -v singularity exec ${sif} manualRegister \
#   -i ${dataDir}/03.register/manual_register \
#   -c ${dataDir}/03.register/${SN}.reregist.ipr \
#   -v ${dataDir}/02.count/${SN}.raw.gef  \
#   -f $flip \
#   -r $rotate \
#   -o $offsetX $offsetY \
#   -s $extrude_x $extrude_y \
#   -a $isTuned \
#   -p ${dataDir}/03.register/aa

out_iprFile=$(find ${dataDir}/03.register/ -maxdepth 1 -name \*.ipr | head -1)
/usr/bin/time -v singularity exec ${sif} imageTools ipr2img \
    -i ${imageTarFile} \
    -c ${out_iprFile}  \
    -d tissue cell \
    -r True \
    -o ${dataDir}/03.register/ 

error message

Wed Sep 25 14:34:26 CST 2024 => image processing and registration start.......
WARNING: While bind mounting '/xskydata/project/spatialTranscriptomics/2024/Q3/spatial_transcript_mus.2024.9.23/rawData/musBrain_WK010/ImageStudio_QC/D03257E614_20240822_114652:/xskydata/project/spatialTranscriptomics/2024/Q3/spatial_transcript_mus.2024.9.23/rawData/musBrain_WK010/ImageStudio_QC/D03257E614_20240822_114652': destination is already in the mount point list
Namespace(conf='/xskydata/project/spatialTranscriptomics/2024/Q3/spatial_transcript_mus.2024.9.23/QC/bgi/WK010/03.register/D03257E614.reregist.ipr', func=<function ipr2img at 0x1499caf86ca0>, input='/xskydata/project/spatialTranscriptomics/2024/Q3/spatial_transcript_mus.2024.9.23/rawData/musBrain_WK010/ImageStudio_QC/D03257E614_20240822_114652/D03257E614_SC_20240822_114652_3.0.4.tar.gz', module=['tissue', 'cell'], output='/xskydata/project/spatialTranscriptomics/2024/Q3/spatial_transcript_mus.2024.9.23/QC/bgi/WK010/03.register/', register=True) []
[INFO 20240925-14-34-36 p925703 tar_decompress ipr_to_image.py:294] Extract files from tar.gz file completed.
[INFO 20240925-14-34-36 p925703 main ipr_to_image.py:632] Use the RippleStitch stitching algorithm to calculate the stitching coordinates for stitching.
[INFO 20240925-14-34-38 p925703 main ipr_to_image.py:728] Save ssDNA_fov_stitched.tif success.
[WARN 20240925-14-34-38 p925703 main ipr_to_image.py:735] Failed to generate transform_template.txt template.
[ERRO 20240925-14-34-38 p925703 main ipr_to_image.py:742] SAW-A40704:    Automatic registration or hand registration has not been completed, registration cannot be done, ManualState group not in ipr file.
Traceback (most recent call last):
  File "imagetools-1.7.6/main.py", line 105, in <module>
  File "imagetools-1.7.6/main.py", line 101, in main
  File "imagetools-1.7.6/main.py", line 18, in ipr2img
  File "imagetools-1.7.6/ipr_to_image/ipr_to_image.py", line 234, in __init__
  File "imagetools-1.7.6/ipr_to_image/ipr_to_image.py", line 745, in main
Exception: SAW-A40704:    Automatic registration or hand registration has not been completed, registration cannot be done, ManualState group not in ipr file.
Command exited with non-zero status 1
    Command being timed: "singularity exec /xskydata/apps/singularity/SAW/SAW_7.1.sif imageTools ipr2img -i /xskydata/project/spatialTranscriptomics/2024/Q3/spatial_transcript_mus.2024.9.23/rawData/musBrain_WK010/ImageStudio_QC/D03257E614_20240822_114652/D03257E614_SC_20240822_114652_3.0.4.tar.gz -c /xskydata/project/spatialTranscriptomics/2024/Q3/spatial_transcript_mus.2024.9.23/QC/bgi/WK010/03.register/D03257E614.reregist.ipr -d tissue cell -r True -o /xskydata/project/spatialTranscriptomics/2024/Q3/spatial_transcript_mus.2024.9.23/QC/bgi/WK010/03.register/"
    User time (seconds): 15.08
    System time (seconds): 70.35
    Percent of CPU this job got: 718%
    Elapsed (wall clock) time (h:mm:ss or m:ss): 0:11.89
    Average shared text size (kbytes): 0
    Average unshared data size (kbytes): 0
    Average stack size (kbytes): 0
    Average total size (kbytes): 0
    Maximum resident set size (kbytes): 1087032
    Average resident set size (kbytes): 0
    Major (requiring I/O) page faults: 1431
    Minor (reclaiming a frame) page faults: 925284
    Voluntary context switches: 39931
    Involuntary context switches: 100151
    Swaps: 0
    File system inputs: 199646
    File system outputs: 1635992
    Socket messages sent: 0
    Socket messages received: 0
    Signals delivered: 0
    Page size (bytes): 4096
    Exit status: 1

QC fail

what should I do.

Originally posted by @lvmt in https://github.com/STOmics/SAW/issues/95#issuecomment-2373164110

Clouate commented 2 months ago

@lvmt Hi, It seems that you have commented out the running code part of manualRegister, so ipr2img reported an error. If you do not want to perform registration and run imageTools ipr2img directly, change the parameter -r True to -r False