Cell Browser scripts: Difference between revisions

From Genecats
Jump to navigationJump to search
(→‎updateNewsSec: adding a bit more detail)
(→‎datasetDiffs: adding a bit more detail)
Line 48: Line 48:
=datasetDiffs=
=datasetDiffs=


Show which datasets have differences between cells-test/cells-beta/cells. Can also show the number of datasets on each machine via <code>-s/--stats</code> as well as hidden datasets using <code>-d/--hidden</code>.
Running the script with the <code>-r/--run</code> option will show which datasets have differences between cells-test/cells-beta/cells. To show the number of datasets on each machine, use the <code>-s/--stats</code> option. To show the names of hidden datasets, use the <code>-d/--hidden</code> option. Running the script without any arguments shows the usage message.  


Example:
Example:

Revision as of 19:55, 25 August 2022

h5adMetaInfo

This script prints out a summary of the metadata in an h5ad file. Specifically, it prints out the unique values for each metadata column header field and the total number of unique values for each column of the metadata file.

To use this tool, you will need to be in your Scanpy environment:

h5adMetaInfo -f [number of fields to display] h5ad

rdsMetaInfo

This script is similar to the one above however it prints out a summary of the metadata for an rds file.

To use this tool, you will need to be in your Seurat environment:

rdsMetaInfo -f [number of fields to display] rds

Both scripts were developed in order to get a glance at the information stored in metadata files. These scripts save time in loading the files into either Python or R depending on the file type and extracting the data using a series of commands. Ultimately, this reduces typing the same commands over again. These scripts were inspired by Jim’s useful tool “tabInfo” which prints out a summary of the metadata in a tsv file.

columnCorrection

addTags

getTagVals

cbBuildMulti

Build multiple cell browsers at once. Input is a list of dataset names (e.g. cortex-dev). This can either be in a file with one dataset name per line (file can contain other columns as long as the dataset name is the first column) or a whitespace-separated list of datasets enclosed in quotes.

Examples:

cbBuildMulti my.datasets.txt
cbBuildMulti "adultPancreas aging-human-skin"
cbBuildMulti "adultPancreas"

colorConverter

Covert between rgb colors to hex and hex colors to rgb. Input file should be csv or tsv. Input file is a two-column file, where column 2 contains the color values you want to convert and column 1 is typically something like cluster labels. You will need to be in an environment where you have 'webcolors' installed.

Example command:

colorConverter myCellTypeColors.hex.tsv > myCellTypeColors.rgb.tsv

It auto-detects hex vs rgb.

colorExporter

Export colors from an h5ad file. Takes an input h5ad file and an output file name. Sometimes the names of the color arrays in uns don't match the corresponding metadata field name, e.g. celltype_label vs celltype_colors, and so the -c option allows you to specify a file containing the associations (column 1 is the metadata field and column 2 is the color array name).

Example:

colorExporter -i TS_Liver.h5ad -o colors.tsv

datasetDiffs

Running the script with the -r/--run option will show which datasets have differences between cells-test/cells-beta/cells. To show the number of datasets on each machine, use the -s/--stats option. To show the names of hidden datasets, use the -d/--hidden option. Running the script without any arguments shows the usage message.

Example:

datasetDiffs -r

updateNewsSec

Will update the news section on the Cell Browser 'Overview' tab. Will also update rr.datasets.txt and sitemap.cells.txt. Automatically runs M-F at 5:10 am on a cronjob via the 'otto' user, but you can run it manually if you'd like.

The only option for the script is -r/--run which tells the script to run. Running the script without any arguments shows the usage message.

Example:

updateNewsSec -r

makeCbHub

Make a set of trackDb stanzas for a hub from a directory of bigWig and/or bigBed files. See Making_a_hub_for_a_cell_browser for more details and examples.

generateColorHtml

Generate a list of html colors to put on your hub html page.

Example:

generateColorHtml colors.tsv

You can then take the resulting html and put it into the 'Display Conventions and Configuration' section of your track description page. See Making_a_hub_for_a_cell_browser for more details and examples.

rowsToCols

Use this tool to transpose a matrix. The Cell Browser wants genes as the rows and cells as the columns. If you get a matrix that is opposite of that (cells on rows and genes on columns), you can use this tool to transpose that to the format the Cell Browser accepts. The -tab indicates the matrix is tap-separated, but for a comma-separated matrix use -fs=,.

Example:

rowsToCols -tab exprMatrix.tsv exprMatrix.transposed.tsv