comparison anndata_operations.xml @ 15:c09d61ede252 draft

"planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/tree/develop/tools/tertiary-analysis/scanpy commit 044580b6bfcd36a5c1cb9e70b40045eb8f71b7e2-dirty"
author ebi-gxa
date Wed, 30 Sep 2020 15:34:21 +0000
parents a4ad76e3dc4a
children e4bb4666449e
comparison
equal deleted inserted replaced
14:a4ad76e3dc4a 15:c09d61ede252
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <tool id="anndata_ops" name="AnnData Operations" version="@TOOL_VERSION@+galaxy0" profile="@PROFILE@"> 2 <tool id="anndata_ops" name="AnnData Operations" version="@TOOL_VERSION@+galaxy1" profile="@PROFILE@">
3 <description>modifies metadata and flags genes</description> 3 <description>modifies metadata and flags genes</description>
4 <macros> 4 <macros>
5 <import>scanpy_macros2.xml</import> 5 <import>scanpy_macros2.xml</import>
6 </macros> 6 </macros>
7 <expand macro="requirements"/> 7 <expand macro="requirements"/>
66 ad_s = sc.read('obs_source_${i}.h5') 66 ad_s = sc.read('obs_source_${i}.h5')
67 if adata.n_obs == ad_s.n_obs and all(adata.obs_names == ad_s.obs_names): 67 if adata.n_obs == ad_s.n_obs and all(adata.obs_names == ad_s.obs_names):
68 #for $j, $o_key in enumerate($copy_o.obs_keys): 68 #for $j, $o_key in enumerate($copy_o.obs_keys):
69 keys_to_copy = (k for k in ad_s.obs.keys() if "${o_key.contains}" in k) 69 keys_to_copy = (k for k in ad_s.obs.keys() if "${o_key.contains}" in k)
70 for k_to_copy in keys_to_copy: 70 for k_to_copy in keys_to_copy:
71 adata.obs[[k_to_copy+"_${i}"]] = ad_s.obs[[k_to_copy]] 71 suffix=''
72 if k_to_copy in adata.obs:
73 suffix = "_${i}"
74
75 adata.obs[[k_to_copy+suffix]] = ad_s.obs[[k_to_copy]]
72 if k_to_copy in ad_s.uns.keys(): 76 if k_to_copy in ad_s.uns.keys():
73 adata.uns[k_to_copy+"_${i}"] = ad_s.uns[k_to_copy] 77 adata.uns[k_to_copy+suffix] = ad_s.uns[k_to_copy]
74 #end for 78 #end for
75 else: 79 else:
76 logging.warning("Observation source ${i} AnnData file is not compatible to be merged to main AnnData file, different cell names.") 80 logging.warning("Observation source ${i} AnnData file is not compatible to be merged to main AnnData file, different cell names.")
77 #end for 81 #end for
78 #end if 82 #end if
83 ad_s = sc.read('embedding_source_${i}.h5') 87 ad_s = sc.read('embedding_source_${i}.h5')
84 if adata.n_obs == ad_s.n_obs and all(adata.obs_names == ad_s.obs_names): 88 if adata.n_obs == ad_s.n_obs and all(adata.obs_names == ad_s.obs_names):
85 #for $j, $e_key in enumerate($copy_e.embedding_keys): 89 #for $j, $e_key in enumerate($copy_e.embedding_keys):
86 keys_to_copy = (k for k in ad_s.obsm.keys() if "${e_key.contains}" in k) 90 keys_to_copy = (k for k in ad_s.obsm.keys() if "${e_key.contains}" in k)
87 for k_to_copy in keys_to_copy: 91 for k_to_copy in keys_to_copy:
88 adata.obsm[k_to_copy+"_${i}"] = ad_s.obsm[k_to_copy] 92 suffix = ''
93 if k_to_copy in adata.obsm:
94 suffix = "_${i}"
95 adata.obsm[k_to_copy+suffix] = ad_s.obsm[k_to_copy]
89 #end for 96 #end for
90 else: 97 else:
91 logging.warning("Embedding source ${i} AnnData file is not compatible to be merged to main AnnData file, different cell names.") 98 logging.warning("Embedding source ${i} AnnData file is not compatible to be merged to main AnnData file, different cell names.")
92 #end for 99 #end for
93 #end if 100 #end if
97 ad_s = sc.read('uns_source_${i}.h5') 104 ad_s = sc.read('uns_source_${i}.h5')
98 if adata.n_obs == ad_s.n_obs and all(adata.obs_names == ad_s.obs_names): 105 if adata.n_obs == ad_s.n_obs and all(adata.obs_names == ad_s.obs_names):
99 #for $j, $u_key in enumerate($copy_u.uns_keys): 106 #for $j, $u_key in enumerate($copy_u.uns_keys):
100 keys_to_copy = (k for k in ad_s.uns.keys() if "${u_key.contains}" in k) 107 keys_to_copy = (k for k in ad_s.uns.keys() if "${u_key.contains}" in k)
101 for k_to_copy in keys_to_copy: 108 for k_to_copy in keys_to_copy:
102 adata.uns[k_to_copy+"_${i}"] = ad_s.uns[k_to_copy] 109 suffix=''
110 if k_to_copy in adata.uns:
111 suffix="_${i}"
112 adata.uns[k_to_copy+suffix] = ad_s.uns[k_to_copy]
103 #end for 113 #end for
104 else: 114 else:
105 logging.warning("Uns source ${i} AnnData file is not compatible to be merged to main AnnData file, different cell names.") 115 logging.warning("Uns source ${i} AnnData file is not compatible to be merged to main AnnData file, different cell names.")
106 #end for 116 #end for
107 #end if 117 #end if