Extracting PyTom coordinates with

39 views
Skip to first unread message

Dylan Noone

unread,
Feb 10, 2026, 6:08:24 AM (12 days ago) Feb 10
to Warp
Good morning,

I am trying to extract particles from pytom picked coordaintes using ts_export_particles to get them into the warp-relion-M pipeline.

However, I am having some issues in that ts_export_particles seems to shift the coordinates. 

Does anyone have a optimised method for getting Pytom picks into warp-relion-M?

My scripts:
Template matching:
    pytom_match_template.py \
        --template "$TEMPLATE" \
        --tomogram "$TOMO" \
        --mask "$MASK" \
        --tomogram-mask "$MASKFILE" \
        --voxel-size-angstrom "$VOXEL" \
        --destination "$DEST" \
        --angular-search 5 \
        --per-tilt-weighting \
        --particle-diameter 220 \
        --low-pass 35 \
        --volume-split 2 2 1 \
        --rng-seed 69 \
        --amplitude-contrast 0.07 \
        --spherical-aberration 2.7 \
        --voltage 300 \
        --tomogram-ctf-model phase-flip \
        --random-phase \
        --gpu-ids 0 1 2 3 \
        --warp-xml-file "$XMLFILE" \
        -a "$TLTFILE"

PyTom Extraction:
  pytom_extract_candidates.py \
      --job-file "$JOB_FILE" \
      --number-of-particles 250 \
      -c 0.01 \
      --log info
    
ts_export_particles:
WarpTools ts_export_particles \
--settings warp_tiltseries.settings \
--input_directory etomo_halfmaps_frames_denoising/reconstruction/denoised/per_tilt_EMD_22586_denoised/converted_star \
--input_pattern "*particles.star" \
--coords_angpix 10 \
--output_processing relion_22586_pytom_per_tilt \
--output_star relion_22586_pytom_per_tilt/matching.star \
--output_angpix 4.5 \
--box 100 \
--diameter 220 \
--relative_output_paths \
--2d

Best,
Dylan 

thomas.la...@gmail.com

unread,
Feb 10, 2026, 7:32:03 PM (11 days ago) Feb 10
to Warp
Hi Dylan,

Are you able share a picture of what the alleged shifts looks like?

If tomograms used for matching are the WBP reconstructions generated by Warp, then the coordinate systems should be the same.

I've attached example of commands which were suitable for being able to refine pytom-match-pick hits in relion while using WarpTools for extraction.

Hope that helps,
-Tom
example_pytom2warp2relion.txt

thomas.la...@gmail.com

unread,
Feb 10, 2026, 8:47:36 PM (11 days ago) Feb 10
to Warp
It has been correctly pointed out to me that WarpTools uses Fourier inversion for the default, not WBP (thanks, Alice!).

That corrected, no denoising or deconvolution recommended for template-matching.

Cheers, 

-Tom

Dylan Noone

unread,
Feb 11, 2026, 12:36:37 PM (10 days ago) Feb 11
to Warp
Hey Thomas,

Thanks for your response, especially sharing your command. I think I am not doign something weird in that step based off this.

So I think the mismatch in coordaintes may have been from a mistake on my end when scaling them to view them in IMOD! 

However, I think something is still going wrong as my scores in Napari look really weird (images of tomo and scores from PyTom). I have tried a number of different arguements and tweaks with the commands, I was if there was something wrong with my template (also attached)?

Thank you,
Dylan

pytom_generated_10Apx_b80_emd_22586.mrc
tomogram.png
scores.png

Dylan Noone

unread,
Feb 11, 2026, 12:37:00 PM (10 days ago) Feb 11
to Warp
and mask.....
pytom_mask_10Apix_b80_r19.mrc

Mathew McLaren

unread,
Feb 11, 2026, 5:50:07 PM (10 days ago) Feb 11
to Dylan Noone, Warp
Hi Dylan,

Have you tried flipping your reference/mask and running again? Template matching is sensitive to handedness and while it can work with the wrong hand, it often works best if it's correct. If you haven't already, I would suggest trying the above tomogram with the opposite hand and see if it makes the points sharper. I've also found that sometimes you just need a reference that's generated from your data to get good results!

Cheers,

Mat

--
You received this message because you are subscribed to the Google Groups "Warp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to warp-em+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/warp-em/6e409dec-faac-4937-9bac-2f058543c20cn%40googlegroups.com.

Dylan Noone

unread,
Feb 13, 2026, 2:03:44 AM (9 days ago) Feb 13
to Mathew McLaren, Warp
Thanks all for the advice. I will work through the solutions suggested and update on here.

Dylan Noone

unread,
Feb 13, 2026, 3:04:47 AM (9 days ago) Feb 13
to Mathew McLaren, Warp
Examples of the shift attached (it was for sure my error with scaling)
true.png
shift.png

Mathew McLaren

unread,
Feb 13, 2026, 4:39:27 AM (9 days ago) Feb 13
to dn1357...@my.bristol.ac.uk, Warp
Hi Dylan,

I only just had a look at your map/mask, but I would suggest making a custom mask that follows the density as opposed to a spherical mask. I used to struggle to get pytom-tm working and one of the eventual solutions that helped was a better mask. I would just use relion_mask_create with --extend_inimask and --width_soft_edge set to 2 and, judging from your reference, --ini_threshold of 0.000174.

Cheers,

Mat

Dylan Noone

unread,
Feb 13, 2026, 4:54:16 AM (9 days ago) Feb 13
to Mathew McLaren, Warp
Good idea. I will try that as well. Thabks

Mart Last

unread,
Feb 20, 2026, 10:51:21 AM (yesterday) Feb 20
to Warp

Hi,

I just spoke with Dylan to check on his pytom scores - the problem was with the version of pytom_tm he was using (v 0.12.0), which has a bug that was patched in https://github.com/SBC-Utrecht/pytom-match-pick/pull/326
In combination with Warp tiltseries .xml files, with pytom_tm v 0.12.0 the defocus values are written e-10 instead of e-6, so you're effectively matching with a defocus in 0 resulting in very poor scores.

So in case anyone is having similar issues in the future: check what pytom_tm version you are using or what the defocus values in pytom's job.json files are. 

Op vrijdag 13 februari 2026 om 09:54:16 UTC schreef dn1...@my.bristol.ac.uk:
Reply all
Reply to author
Forward
0 new messages