# HG changeset patch # User goeckslab # Date 1720737677 0 # Node ID 8969e16f3701351d5c5dcd8346ca12cad099d140 planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/mti-utils commit bc438db690e41823909b32b693f297d942433a43 diff -r 000000000000 -r 8969e16f3701 macros.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/macros.xml Thu Jul 11 22:41:17 2024 +0000 @@ -0,0 +1,21 @@ + + + + + quay.io/goeckslab/mti_utils:@TOOL_VERSION@ + + + + + echo @TOOL_VERSION@ + + + + 10.1101/2022.08.18.504436 + + + + 0.0.2 + 0 + 19.01 + diff -r 000000000000 -r 8969e16f3701 scale_cell_coordinates.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scale_cell_coordinates.py Thu Jul 11 22:41:17 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 000000000000 -r 8969e16f3701 scale_cell_coordinates.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scale_cell_coordinates.xml Thu Jul 11 22:41:17 2024 +0000 @@ -0,0 +1,59 @@ + + + + macros.xml + + + operation_3443 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 8969e16f3701 test-data/intensities.csv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/intensities.csv Thu Jul 11 22:41:17 2024 +0000 @@ -0,0 +1,15 @@ +CellID,DNA_1,AF488,AF555,AF647,DNA_2,A488_background,A555_background,A647_background,DNA_3,FDX1,CD357,CD1D,Extent,Orientation +1,14308.90789,499.1973684,158.8947368,291.7960526,14838.375,330.3684211,115.8815789,330.2039474,7605.743421,849.8881579,528.7039474,722.6578947,0.812834225,0.077538976 +2,17899.1573,560.741573,178.3033708,302.3370787,17559.61798,334.6853933,129.0449438,331.3146067,8806.05618,739.247191,476.7752809,687.8426966,0.684615385,-0.383749081 +3,13548.68182,542.6477273,166.3295455,287.4659091,14924.98864,350.7386364,121.3636364,324.3295455,8227.102273,739.5909091,489.9772727,678.6704545,0.752136752,-0.233397964 +4,20397.52564,509.6410256,169.6794872,252.2051282,16952.11538,334.5128205,125.3589744,337.3589744,9884.935897,988.474359,526.525641,659.8589744,0.709090909,0.57603987 +5,9322.542857,487.7428571,152.8,266.6857143,11197.6,336.6,116.6,323.8857143,5387.914286,1030.685714,506.8285714,705.9714286,0.833333333,0.635330044 +6,18444.54321,528.6419753,175.0493827,261.654321,19074.02469,362.6049383,116.6790123,331.8888889,9755.012346,732.3703704,435.0123457,636.5185185,0.81,-0.802338719 +7,11192.79012,497.9012346,165.1851852,284.3950617,10417.59259,331.7530864,113.4938272,319.9259259,6038.296296,769.6666667,416.9012346,661.0740741,0.818181818,-0.067432427 +8,19044.81633,624.3877551,199.2244898,351.0306122,19464.2449,389.4183673,133.8673469,333.1632653,10691.5102,775.877551,538,729.2653061,0.742424242,-1.127518788 +9,13396.91892,454.0810811,155.4054054,255.2297297,13411.5,322.4054054,112.1081081,326.2432432,7380.040541,545.3243243,410.5810811,601.0675676,0.822222222,-0.190807793 +10,12986.30769,437.9326923,151.8365385,253.2115385,11942.25962,309.3653846,100.6442308,327.3076923,6417.875,723.6442308,425.7019231,588.8846154,0.787878788,1.183452058 +11,18147.53684,555.0210526,179.0210526,310.9789474,17723.72632,344.1473684,118.5894737,335.3052632,9508.273684,806.7789474,441.2736842,678.0842105,0.791666667,-0.345157473 +12,10102.03704,403.9259259,148.5925926,246.9814815,8981.555556,291.6296296,103.2037037,321.0185185,5171.62963,859.6481481,407.8518519,605.2037037,0.75,0.988871411 +13,14623.16667,697.0740741,238.4814815,440.4814815,15268.88889,430.7592593,146.8333333,329.7222222,8025.592593,899.3703704,591.2407407,810.8703704,0.75,-0.220438727 +14,11763.10891,549.6138614,187.6237624,360.7029703,10164.54455,300.0594059,102.3366337,329.2772277,6828.861386,765.049505,457.5247525,883.5841584,0.776923077,0.374877468 \ No newline at end of file diff -r 000000000000 -r 8969e16f3701 test-data/intensity_channels.csv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/intensity_channels.csv Thu Jul 11 22:41:17 2024 +0000 @@ -0,0 +1,13 @@ +channel_number,marker_name,exposure_time,AF_channel +0,DNA_1,100,None +1,AF488,100,None +2,AF555,100,None +3,AF647,100,None +4,DNA_2,100,None +5,A488_background,100,AF488 +6,A555_background,100,AF555 +7,A647_background,100,AF647 +8,DNA_3,100,None +9,FDX1,100,AF488 +10,CD357,100,AF555 +11,CD1D,100,AF647 \ No newline at end of file diff -r 000000000000 -r 8969e16f3701 test-data/pixels.h5ad Binary file test-data/pixels.h5ad has changed diff -r 000000000000 -r 8969e16f3701 test-data/rename_channels.csv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/rename_channels.csv Thu Jul 11 22:41:17 2024 +0000 @@ -0,0 +1,3 @@ +channel_number,cycle_number,marker_name,Filter,excitation_wavelength,emission_wavelength +0,6,DNA_6,DAPI,395,431 +0,6,DNA_7,DAPI,395,431 \ No newline at end of file diff -r 000000000000 -r 8969e16f3701 test-data/rename_test.ome.tiff Binary file test-data/rename_test.ome.tiff has changed diff -r 000000000000 -r 8969e16f3701 test-data/test.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/test.xml Thu Jul 11 22:41:17 2024 +0000 @@ -0,0 +1,2 @@ + +