observed_length = 6 max_homopolymer_runs = 1 gc_bias = 0 undesired_motifs = [] special_filter = dsw.LocalBioFilter(observed_length=observed_length, max_homopolymer_runs=max_homopolymer_runs, gc_range=[0.5-gc_bias, 0.5+gc_bias], undesired_motifs=undesired_motifs) vertices = dsw.find_vertices(observed_length=observed_length, bio_filter=special_filter, verbose=False) _, coding_accessor = dsw.connect_coding_graph(observed_length=observed_length, vertices=vertices, threshold=2, verbose=False) coding_vertices = dsw.obtain_vertices(coding_accessor) start_index = coding_vertices[0] coding_latter_map = dsw.accessor_to_latter_map(coding_accessor) out_degree_counter = collections.Counter([len(x) for x in coding_latter_map.values()]) if need_logs: print('built spider-web, status below:') self.survey_latter_map(coding_latter_map)
时间: 2024-04-18 10:24:28 浏览: 28
在这段代码中,首先定义了一些参数,包括观察长度(observed_length)、最大同源多聚体运行数(max_homopolymer_runs)、GC偏差(gc_bias)和不希望出现的motifs(undesired_motifs)等。
接着,根据这些参数创建了一个特殊的过滤器(special_filter),用于过滤符合条件的序列。
然后,使用该过滤器找到了一些顶点(vertices)。
接下来,使用这些顶点和阈值(threshold)连接了一个编码图(coding_accessor)。
之后,通过编码图获取了编码顶点(coding_vertices)。
再然后,获取了编码顶点中的第一个顶点的索引(start_index)。
接着,将编码图转换为后续映射(coding_latter_map)。
最后,统计了编码图中每个顶点的出度,并打印了一些日志信息(如果需要)。
请注意,以上只是对代码的简要解释,并不包括完整的代码功能和细节。如果您需要更详细的解释或有其他问题,请随时提问。
相关问题
cancer_model.is_dconnected("Pollution", "Smoker", observed=["Cancer"])
这段代码是用来检查在给定观测条件下,污染和吸烟是否存在有向路径连接到癌症节点。其中,`cancer_model`是一个贝叶斯网络模型对象,`is_dconnected`方法用来判断两个节点是否在给定观测条件下有向连接。参数`"Pollution"`和`"Smoker"`表示要检查的节点,`observed=["Cancer"]`表示已知的观测条件是癌症节点已经发生。如果两个节点不存在有向路径连接到癌症节点,那么它们在给定观测条件下是d-分离的,返回True;否则返回False。
转换成matlab:def severed_sphere(intrinsic_process, k1=5.5, k2=2): assert intrinsic_process.shape[0] == 2 intrinsic_process_temp = numpy.copy(intrinsic_process) #intrinsic_process_temp = (intrinsic_process_temp.T-numpy.mean(intrinsic_process_temp, axis=1).T).T observed_process = numpy.empty((3, intrinsic_process_temp.shape[1]), dtype=numpy.float64) observed_process[0] = numpy.sin(intrinsic_process_temp[0]*k1)*numpy.cos(intrinsic_process_temp[1]*k2) observed_process[1] = numpy.cos(intrinsic_process_temp[0]*k1)*numpy.cos(intrinsic_process_temp[1]*k2) observed_process[2] = numpy.sin(intrinsic_process_temp[1]*k2) return observed_process
在Matlab中,您可以将以下Python代码转换为对应的Matlab代码:
```matlab
function observed_process = severed_sphere(intrinsic_process, k1, k2)
assert(size(intrinsic_process, 1) == 2);
intrinsic_process_temp = intrinsic_process;
% intrinsic_process_temp = (intrinsic_process_temp.' - mean(intrinsic_process_temp, 2).').';
observed_process = zeros(3, size(intrinsic_process_temp, 2));
observed_process(1,:) = sin(intrinsic_process_temp(1,:) * k1) .* cos(intrinsic_process_temp(2,:) * k2);
observed_process(2,:) = cos(intrinsic_process_temp(1,:) * k1) .* cos(intrinsic_process_temp(2,:) * k2);
observed_process(3,:) = sin(intrinsic_process_temp(2,:) * k2);
end
```
请注意,在Matlab中没有直接相当于`empty`函数的功能,因此我们使用`zeros`函数来初始化`observed_process`数组。另外,对于行向量和列向量的转置,我们使用了`.`运算符。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)