diff salmonKallistoMtxTo10x.py @ 7:60fa6080f86f draft

planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/tree/develop/tools/salmon-kallisto-mtx-to-10x/.shed.yml commit 26982f271bc98aed93b20c68d73ed610ddada16e
author ebi-gxa
date Fri, 22 Nov 2019 11:11:16 -0500
parents fe0fd27aba50
children
line wrap: on
line diff
--- a/salmonKallistoMtxTo10x.py	Thu Nov 21 09:38:48 2019 -0500
+++ b/salmonKallistoMtxTo10x.py	Fri Nov 22 11:11:16 2019 -0500
@@ -49,7 +49,20 @@
 cb_names = [cell_prefix + s for s in pd.read_csv(cb_file, header=None)[0].values]
 gene_names = pd.read_csv(gene_file, header=None)[0].values
 umi_counts = mmread( quant_file )
-    
+   
+nrows = umi_counts.shape[0]  
+ncols = umi_counts.shape[1]  
+
+# Add a dimension check
+
+if len(cb_names) != nrows:
+    print('The number of matrix rows (%d) does not match the number of supplied barcodes (%d)' % (nrows, len(cb_names)))
+    sys.exit(1)
+
+if len(gene_names) != ncols:
+    print('The number of matrix columns (%d) does not match the number of supplied genes (%d)' % (ncols, len(gene_names)))
+    sys.exit(1)
+
 # Write outputs to a .mtx file readable by tools expecting 10X outputs.
 # Barcodes file works as-is, genes need to be two-column, duplicating the
 # identifiers. Matrix itself needs to have genes by row, so we transpose.