Cell Browser scripts: Difference between revisions

From Genecats
Jump to navigationJump to search
(→‎getTagVals: adding some details)
(Adding link to page with more details on getTagVals and addTags)
Line 31: Line 31:
Example command:
Example command:
  addTags dataset.disease.tsv
  addTags dataset.disease.tsv
The page [[Managing_cellbrowser.conf_tag_values_for_multiple_datasets]] has more details about using this script in conjunction with <code>getTagVals</code>.


=getTagVals=
=getTagVals=
Line 40: Line 42:
  getTagVals my_datasets.tsv "body_parts diseases"
  getTagVals my_datasets.tsv "body_parts diseases"
  getTagVals -d my_datasets.tsv "title abstract"
  getTagVals -d my_datasets.tsv "title abstract"
The page [[Managing_cellbrowser.conf_tag_values_for_multiple_datasets]] has more details about using this script in conjunction with <code>addTags</code>.


=cbBuildMulti=
=cbBuildMulti=

Revision as of 20:17, 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

Can add new tags and their corresponding values or update existing tags with new values. Input is a tab-separated file with a header line. The first column is the dataset name (e.g. cortex-dev) and subsequent columns are the values associated with the tag in header. If there are multiple values for a given tag, separate them with a comma.

Example input:

dataset         diseases
adultPancreas   Healthy
gbm             Glioblastoma
quake-gbm       Glioblastoma, Healthy Control
organoids       Healthy

Example command:

addTags dataset.disease.tsv

The page Managing_cellbrowser.conf_tag_values_for_multiple_datasets has more details about using this script in conjunction with getTagVals.

getTagVals

Allows you to get the values from cellbrowser.conf or desc.conf for a single tag or set of tags. Input is a tab-separated file where the first column is a dataset name (e.g. cortex-dev). Also requires you to specify a tag or tags. If there are other columns in the file, then these will be carried through to the output file without change.

Examples:

getTagVals my_datasets.tsv body_parts
getTagVals my_datasets.tsv "body_parts diseases"
getTagVals -d my_datasets.tsv "title abstract"

The page Managing_cellbrowser.conf_tag_values_for_multiple_datasets has more details about using this script in conjunction with addTags.

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