st_tissue_recognition安装

1. openCV装4.0.1.

openCV 4.0.1有个小布丁(https://github.com/opencv/opencv/pull/13969/files)要根据它修改下:

modules/videoio/src/cap_v4l.cpp 的245行后加上:

// https://github.com/opencv/opencv/issues/13929

#ifndef V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT

#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT (V4L2_CID_MPEG_BASE+364)

#endif

#ifndef V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH

#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH (V4L2_CID_MPEG_BASE+365)

#endif

不然会报错cap_v4l.cpp:1613:16: error: ‘V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT’ was not declared in this scope

 

2. 编译st_tissue-recognition时报错 error: ‘CV_BGR2GRAY’ was not declared in this scope。要改下st_tissue-recognition代码的一个地方:st_tissue_recognition/src/util.cpp的28行的CV_BGR2GRAY改成cv::COLOR_GRAY2BGR

 

3. 编译st_tissue-recognition要用gcc 7.4. 不然会报main.cpp:99:29: error: ‘dirname’ was not declared in this scope 。。。。。

 

st_spot_detector应该也是依赖 ST tissue recognition library

## 20240905 # conda activate torch1.9 import pandas as pd import numpy as np from IPython.display import display from PIL import Image import json import os import sys from matplotlib.path import Path from sklearn.neighbors import KNeighborsClassifier from sklearn.preprocessing import StandardScaler from matplotlib import pyplot as plt # import cv2 from scipy.spatial import ConvexHull import ast from scipy.stats import pearsonr, spearmanr from matplotlib.backends.backend_pdf import PdfPages from matplotlib.patches import Patch import matplotlib.pyplot as plt import argparse parser = argparse.ArgumentParser(description='') parser.add_argument('--Sample', '-s', type=str, help='Samplename', required=True) ## --Countcell可用于统计每个spot的细胞数量并绘图 # 20240905修改,确定了每一个细胞点的位置 parser.add_argument("--Countcell", default=False, action='store_true', help="Counting the number of cells in each spot, default is No") parser.add_argument('--Segjson', '-j', type=str, help='nucleus recognition') parser.add_argument('--lowscaleheight', '-lowheight', type=int, help='') parser.add_argument('--lowscalewidth', '-lowwidth', type=int, help='') parser.add_argument('--offsetx', '-x', type=int, help='') parser.add_argument('--offsety', '-y', type=int, help='') # parser.add_argument('--Savepath', '-o', type=str, help='savepath', required=True) args = parser.parse_args() sample = args.Sample sample_folder = "/data1/chengrui/workspace/zst_st/all_data/" xpath="/data1/zhaoshutao/projectworkspace/cell2location_20240715/heart_eyeball_c2l/heart_eyeball_h5ad_pro/" if sample in ["WMQ-586-mHeart", "WMQ-584-mHeart", "WMQ-644-mHeart"]: tissue_positions_file = "".join([xpath,sample,"/spatial/tissue_positions_list.csv"]) scalefactors_json = "".join([sample_folder, sample, "/outs/spatial/scalefactors_json.json"]) elif sample in ["WMQ-567-mEye", "WMQ-594-mEye", "WMQ-593-mEye"]: tissue_positions_file = "".join([xpath,sample,"/spatial/tissue_positions_list.csv"]) scalefactors_json = "".join([sample_folder, sample, "/outs/spatial/scalefactors_json.json"]) elif sample in ["WMQ-765-mOVA","WMQ-766-mOVA","WMQ-767-mOVA","WMQ-768-mOVA"]: scalefactors_json = "".join(["/data1/zhaoshutao/projectworkspace/rawdata_20241222_ovary_st/", sample, "/outs/spatial/scalefactors_json.json"]) tissue_positions_file = "".join(["/data1/zhaoshutao/projectworkspace/rawdata_20241222_ovary_st/", sample, "/outs/spatial/tissue_positions_list.csv"]) elif sample == "WMQ-606-mSpl": splsample = "WMQ-606-mSpleen" scalefactors_json = "".join([sample_folder, splsample, "/outs/spatial/scalefactors_json.json"]) tissue_positions_file = "".join([sample_folder, splsample, "/outs/spatial/tissue_positions_list.csv"]) elif sample in ["WMQ-648-mLiver","WMQ-678-mLiver","WMQ-629-mLym","WMQ-636-mLung","WMQ-627-mSpl","WMQ-712-mTes","LXZ-009","WMQ-714-mTes"]: if sample == "WMQ-627-mSpl": sample = "WMQ-627-mSpleen" scalefactors_json = "".join([sample_folder, sample, "/spatial/scalefactors_json.json"]) tissue_positions_file = "".join([sample_folder, sample, "/spatial/tissue_positions_list.csv"]) elif sample in ["WMQ-731-mOVA","WMQ-732-mOVA"]: scalefactors_json = "".join([sample_folder, sample, "-bu/spatial/scalefactors_json.json"]) tissue_positions_file = "".join([sample_folder, sample, "-bu/spatial/tissue_positions_list.csv"]) else: scalefactors_json = "".join([sample_folder, sample, "/outs/spatial/scalefactors_json.json"]) tissue_positions_file = "".join([sample_folder, sample, "/outs/spatial/tissue_positions_list.csv"]) cell_count_output = "/data1/zhaoshutao/projectworkspace/nucleus_recognition/sandiantu_20240716_c2l_card_cyto/run_spot_counts_results" all_cell_seg_pic = "".join([cell_count_output, "/",sample, "_all_cell_seg_pic.csv"]) spot_cell_count = "".join([cell_count_output, "/",sample, "_spots_counts.csv"]) point_cell_count = "".join([cell_count_output, "/",sample, "_point_counts.csv"]) 帮我解释代码,注释好,并且帮我看看有没有问题
03-14
########## sample_folder = "/data1/chengrui/workspace/zst_st/all_data/" xpath="/data1/zhaoshutao/projectworkspace/cell2location_20240715/heart_eyeball_c2l/heart_eyeball_h5ad_pro/" if sample in ["WMQ-586-mHeart", "WMQ-584-mHeart", "WMQ-644-mHeart"]: tissue_positions_file = "".join([xpath,sample,"/spatial/tissue_positions_list.csv"]) scalefactors_json = "".join([sample_folder, sample, "/outs/spatial/scalefactors_json.json"]) elif sample in ["WMQ-567-mEye", "WMQ-594-mEye", "WMQ-593-mEye"]: tissue_positions_file = "".join([xpath,sample,"/spatial/tissue_positions_list.csv"]) scalefactors_json = "".join([sample_folder, sample, "/outs/spatial/scalefactors_json.json"]) elif sample == "WMQ-606-mSpl": splsample = "WMQ-606-mSpleen" scalefactors_json = "".join([sample_folder, splsample, "/outs/spatial/scalefactors_json.json"]) tissue_positions_file = "".join([sample_folder, splsample, "/outs/spatial/tissue_positions_list.csv"]) else: scalefactors_json = "".join([sample_folder, sample, "/outs/spatial/scalefactors_json.json"]) tissue_positions_file = "".join([sample_folder, sample, "/outs/spatial/tissue_positions_list.csv"]) cell_count_output = "/data1/zhaoshutao/projectworkspace/nucleus_recognition/sandiantu_20240716_c2l_card_cyto/run_spot_counts_results" # 细胞核识别之后的所有细胞的坐标 all_cell_seg_pic = "".join([cell_count_output, "/",sample, "_all_cell_seg_pic.csv"]) # 细胞核识别之后统计好的每一个spot的barcode,组织区域,坐标,细胞数量,细胞核中心坐标,spot间的位置是邻居spot的barcode的组合使用"_"分隔 point_cell_count = "".join([cell_count_output, "/",sample, "_point_counts.csv"]) point_cell_count_pos = pd.read_csv(point_cell_count,index_col=0) # cell2location解卷积结果,每一行是spot的barcode,每一列是细胞类型,值表示细胞丰度 if c2lpropfile.endswith('.csv'): celltype_Frequency_c2l = pd.read_csv(c2lpropfile,index_col=0) elif c2lpropfile.endswith('.txt'): celltype_Frequency_c2l = pd.read_table(c2lpropfile,index_col=0) else: sys.exit(1) celltype_Frequency_c2l.columns = celltype_Frequency_c2l.columns.str.replace('q05cell_abundance_w_sf_', '') celltype_Frequency_c2l.columns = celltype_Frequency_c2l.columns.str.replace('.', ' ', regex=False) # 打印一下输入的各种信息 print("all_cell_seg_pic: ", all_cell_seg_pic,"\npoint_cell_count: ", point_cell_count) print("c2lpropfile: ", c2lpropfile,"\nsavepath: ", savepath) #####################################################################
最新发布
03-14
要在R中安装名为DOSE的软件包,当它作为压缩文件存储在本地时,需要首先解压文件,然后通过`install.packages()`函数从源目录进行安装。以下是具体的步骤: 1. **打开命令行界面**(在Windows上通常是命令提示符或PowerShell)。 2. **导航到压缩文件所在的目录**: ``` setwd("D:\\data\\转录组数据\\整理\\组织特异性\\LN_B_F_tissue_specific\\GSEA_LN") ``` 这会将当前工作目录设置为指定的压缩文件位置。 3. **解压DOSE_3.30.5.zip**。假设你想要解压到同级目录下新建的"DOSE"文件夹,可以使用`unzip`命令: ```sh unzip DOSE_3.30.5.zip -d DOSE ``` 如果你想将其解压到原目录下,只需去掉`-d DOSE`部分。 4. **确认解压后的文件夹路径**: ``` list.files(path = ".", pattern = "DOSE", full.names = TRUE) ``` 确认出现了名为"DOSE"的文件夹。 5. **安装DOSE包**,此时DOSE应该已经存在于目录下,你可以通过以下命令安装: ``` install.packages(file.path(".", "DOSE", "DOSE_3.30.5", "DOSE_3.30.5.tar.gz"), repos = NULL) ``` `repos = NULL`表示不从CRAN官方仓库安装,直接从本地目录进行。 6. **检查安装是否成功**: ``` library(DOSE) if ("package:DOSE" %in% rownames(installed.packages())) { print("DOSE package installed successfully.") } else { print("Installation failed or package not found.") } ``` 完成以上步骤后,如果一切顺利,你应该就能在R环境中使用DOSE包了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值