# HG changeset patch
# User goeckslab
# Date 1720737686 0
# Node ID afa3cb2110eb913776c5ae4076157787fa422f0c
# Parent 5d541df02496f7b008ae7446bff297d9aa885098
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/mti-utils commit bc438db690e41823909b32b693f297d942433a43
diff -r 5d541df02496 -r afa3cb2110eb macros.xml
--- a/macros.xml Fri May 10 21:01:41 2024 +0000
+++ b/macros.xml Thu Jul 11 22:41:26 2024 +0000
@@ -2,12 +2,12 @@
- quay.io/goeckslab/mti_utils:0.0.1
+ quay.io/goeckslab/mti_utils:@TOOL_VERSION@
- echo @VERSION@
+ echo @TOOL_VERSION@
@@ -15,7 +15,7 @@
- 0.0.1
- 5
+ 0.0.2
+ 0
19.01
diff -r 5d541df02496 -r afa3cb2110eb process_intensities.xml
--- a/process_intensities.xml Fri May 10 21:01:41 2024 +0000
+++ b/process_intensities.xml Thu Jul 11 22:41:26 2024 +0000
@@ -27,7 +27,7 @@
markers_to_normalize = marker_df['marker_name'].to_list()
#if $AF_method.select_method == 'SBR':
-AF_markers = [x for x in list(marker_df['${AF_method.AF_col}'].unique()) if x != 'None']
+AF_markers = [x for x in list(marker_df['${AF_method.AF_col}'].unique()) if x not in ['None',np.nan]]
print(f'Detected {quant[AF_markers].eq(0.0).any(axis=1).sum()} cells with AF values of zero in the dataset')
#if $AF_method.AF_filter == 'filter':
diff -r 5d541df02496 -r afa3cb2110eb scale_cell_coordinates.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/scale_cell_coordinates.py Thu Jul 11 22:41:26 2024 +0000
@@ -0,0 +1,50 @@
+import argparse
+import json
+import warnings
+
+import anndata as ad
+
+
+def main(inputs, output):
+
+ """
+ inputs : str
+ File path to galaxy tool JSON inputs config file
+ output: str
+ File path to save the output h5ad file
+ """
+ warnings.simplefilter('ignore')
+
+ # read inputs JSON
+ with open(inputs, 'r') as param_handler:
+ params = json.load(param_handler)
+
+ # read input anndata file
+ adata = ad.read_h5ad(params['anndata'])
+
+ # scale coords
+ unit = params['unit']
+ new_col_names = []
+ for c in [params['x_coord'], params['y_coord']]:
+ scaled_col_name = f'{c}_{unit}'
+ adata.obs[scaled_col_name] = adata.obs[c] * params['resolution']
+ new_col_names.append(scaled_col_name)
+
+ # overwrite adata.obsm['spatial'] with scaled coordinates
+ adata.obsm['spatial'] = adata.obs[scaled_col_name].values
+
+ # write out anndata to h5ad file
+ adata.write_h5ad(output)
+
+
+if __name__ == '__main__':
+
+ aparser = argparse.ArgumentParser()
+ aparser.add_argument(
+ "-i", "--inputs", dest="inputs", required=True)
+ aparser.add_argument(
+ "-o", "--output", dest="output", required=False)
+
+ args = aparser.parse_args()
+
+ main(args.inputs, args.output)
diff -r 5d541df02496 -r afa3cb2110eb test-data/pixels.h5ad
Binary file test-data/pixels.h5ad has changed
diff -r 5d541df02496 -r afa3cb2110eb test-data/rename_channels.csv
--- a/test-data/rename_channels.csv Fri May 10 21:01:41 2024 +0000
+++ b/test-data/rename_channels.csv Thu Jul 11 22:41:26 2024 +0000
@@ -1,2 +1,3 @@
channel_number,cycle_number,marker_name,Filter,excitation_wavelength,emission_wavelength
-0,6,DNA_6,DAPI,395,431
\ No newline at end of file
+0,6,DNA_6,DAPI,395,431
+0,6,DNA_7,DAPI,395,431
\ No newline at end of file
diff -r 5d541df02496 -r afa3cb2110eb test-data/rename_test.ome.tiff
Binary file test-data/rename_test.ome.tiff has changed
diff -r 5d541df02496 -r afa3cb2110eb test-data/rename_test.tiff
Binary file test-data/rename_test.tiff has changed
diff -r 5d541df02496 -r afa3cb2110eb test-data/test.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test.xml Thu Jul 11 22:41:26 2024 +0000
@@ -0,0 +1,2 @@
+
+