Mercurial > repos > ebi-gxa > salmon_kallisto_mtx_to_10x
comparison 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 |
comparison
equal
deleted
inserted
replaced
6:17f7e1e51fad | 7:60fa6080f86f |
---|---|
47 # Read gene and cell labels, apply cell prefix | 47 # Read gene and cell labels, apply cell prefix |
48 | 48 |
49 cb_names = [cell_prefix + s for s in pd.read_csv(cb_file, header=None)[0].values] | 49 cb_names = [cell_prefix + s for s in pd.read_csv(cb_file, header=None)[0].values] |
50 gene_names = pd.read_csv(gene_file, header=None)[0].values | 50 gene_names = pd.read_csv(gene_file, header=None)[0].values |
51 umi_counts = mmread( quant_file ) | 51 umi_counts = mmread( quant_file ) |
52 | 52 |
53 nrows = umi_counts.shape[0] | |
54 ncols = umi_counts.shape[1] | |
55 | |
56 # Add a dimension check | |
57 | |
58 if len(cb_names) != nrows: | |
59 print('The number of matrix rows (%d) does not match the number of supplied barcodes (%d)' % (nrows, len(cb_names))) | |
60 sys.exit(1) | |
61 | |
62 if len(gene_names) != ncols: | |
63 print('The number of matrix columns (%d) does not match the number of supplied genes (%d)' % (ncols, len(gene_names))) | |
64 sys.exit(1) | |
65 | |
53 # Write outputs to a .mtx file readable by tools expecting 10X outputs. | 66 # Write outputs to a .mtx file readable by tools expecting 10X outputs. |
54 # Barcodes file works as-is, genes need to be two-column, duplicating the | 67 # Barcodes file works as-is, genes need to be two-column, duplicating the |
55 # identifiers. Matrix itself needs to have genes by row, so we transpose. | 68 # identifiers. Matrix itself needs to have genes by row, so we transpose. |
56 | 69 |
57 pathlib.Path(mtx_out).mkdir(parents=True, exist_ok=True) | 70 pathlib.Path(mtx_out).mkdir(parents=True, exist_ok=True) |