Giter VIP home page Giter VIP logo

spatial-infer-cnv's Introduction

spatial-infer-cnv

Main idea

To run inferCNV, it requires three different files, the filtered_feature_bc_matrix.h5 located inside of the spaceranger path, annotations as a csv file that contains normal annotations, and a gene order file.

The filtered_feature_bc_matrix.h5 should be located inside of the spaceranger output. Collect this file path.

The gene order file I mainly use is in /diskmnt/Projects/Users/efang/SpatialInferCNV/siCNV_GeneOrderFile.tsv (this needs to be changed inside of the script if you want to edit this)

The annotations require a reference of normal cells annotated as "normal." If your file does not contain this, you can either manually annotate a section of normal spots (recommended 16 of them) or you can use my find_normal script described later.

The output directory can be edited inside of the script itself. In the SpatialCNVcmdline4.R, the output directory points to: f"/diskmnt/Projects/Users/efang/SpatialInferCNV/InferCNVRunsOutputValidation/InferCNVrun_outputs-{LibraryName}"

Running find_normal

To use the script, you need to have the necessary environment located at: /diskmnt/Projects/Users/efang/miniconda3/envs/FindNormal2

Then using conda:

conda activate FindNormal2

For the files that you want to find normal annotations for:

Create a spreadsheet named specific_df.csv that has the columns of: ["LibraryName", "AnnotationFile", "Spaceranger"]

Place the df csv inside of /diskmnt/Projects/Users/efang/find_normal_squidpy

And then

python /diskmnt/Projects/Users/efang/find_normal_squidpy/main_specific.py

Running the script

The conda environment is located at: /diskmnt/Projects/Users/efang/miniconda3/envs/SpatialInferCNV

Activate the environment with:

conda activate SpatialInferCNV

Now with the annotation file, filtered_feature_bc_matrix.h5, and the library name: run the R file located in /diskmnt/Projects/Users/efang/SpatialInferCNV/SpatialCNVcmdline4.R

An example of how it would work is:

Rscript /diskmnt/Projects/Users/efang/SpatialInferCNV/SpatialCNVcmdline4.R /diskmnt/Projects/Users/efang/normalized_annotations/HT413C1-Th1K2A4U1Bp1-with_normal_annotations.csv /diskmnt/Datasets/Spatial_Transcriptomics/outputs_FFPE/Human/HT413C1/Th1K2/HT413C1-Th1K2A4U1Bp1/outs/filtered_feature_bc_matrix.h5 HT413C1-Th1K2A4U1Bp1

How find_normal works:

The script using the find_normal.py file to find the normal annotations.

The idea is to create a buffer (increase the radius of the polygon) around annotated and suspected "tumor" areas and annotate cells outside of that area as "normal." In addition to already marked regions, I also use the epcam marker and also find a buffer radius around those cells where there is a nonzero epcam value.

The script runs to find areas of normal 6 different times before giving up.

  1. 3.5 spot buffer around the epcam_buffer and 2.5 spot buffer around the marked tumor regions.
  2. 2-3.5 spot buffer that is uniformally chosen for the epcam buffer and 2.5 spot buffer around the marked tumor regions.
  3. 3 spot buffer around the epcam_buffer and 2.5 spot buffer around the marked tumor regions.
  4. 1.5-3 spot buffer that is uniformally chosen for the epcam buffer and 2.5 spot buffer around the marked tumor regions.
  5. 1-2.5 spot buffer that is uniformally chosen for the epcam buffer and 2.5 spot buffer around the marked tumor regions.
  6. 0.5-2 spot buffer that is uniformally chosen for the epcam buffer and 2.5 spot buffer around the marked tumor regions.

spatial-infer-cnv's People

Contributors

ericf1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.