你好,非常感谢您开发CPhasing这款软件,我们在运行haploid模式的时候出现了报错:TypeError: 'NoneType' object is not subscriptable
我们使用的CPhasing的版本为:C-Phasing version: 0.2.10.r308
命令为:cphasing pipeline -f asm.fasta -pcd PoreC.fastq.gz -t 20 --mode haploid -n 23
基因组为人类的样本。
在3. hyperpartition步骤出现了报错,请您帮忙看看,非常感谢!
具体log如下:
$ cphasing pipeline -f /cpfs01/projects-HDD/cfff-e44ef5cf7aa5_HDD/lt_bh9773/project/xiaorou_T2T/verkko2_test/D5_HF_NA_NA_NA_verkko2/hapdup/hapdup/hapdup_dual_1.fasta -pcd /cpfs01/projects-HDD/cfff-e44ef5cf7aa5_HDD/public/xrguo/PoreC/PC_GRM_D5_raw.fastq.gz -t 20 --mode haploid -n 23
[16:52:14] INFO C-Phasing version: 0.2.10.r308 pipeline.py:136
INFO Pipeline is started on 2026-02-23. pipeline.py:138
INFO Working on new directory: cphasing_output pipeline.py:144
INFO Mode is set to haploid because of the second n is not specified. pipeline.py:160
INFO The mode is haploid, skip step '1. alleles.' pipeline.py:260
INFO #----------------------------------# pipeline.py:410
# Running step 0. mapper #
#----------------------------------#
INFO Running command: utilities.py:193
INFO cphasing-rs chromsizes hapdup_dual_1.fasta -o hapdup_dual_1.tmp_add4d648d5894287bb39041714b7b7c3 utilities.py:194
[16:52:23] INFO Moving temporary contigsizes file hapdup_dual_1.tmp_add4d648d5894287bb39041714b7b7c3 to hapdup_dual_1.contigsizes mapper.py:872
INFO Running command: mapper.py:937
INFO minimap2 -t 20 -I 16g -c --secondary=no -x lr:hq hapdup_dual_1.fasta <(crabz -d -p 8 2>logs/PC_GRM_D5_raw.mapping.decompress.log mapper.py:938
/cpfs01/projects-HDD/cfff-e44ef5cf7aa5_HDD/public/xrguo/PoreC/PC_GRM_D5_raw.fastq.gz) 2> logs/PC_GRM_D5_raw.mapping.log | crabz -p 8 --format mgzip 2>logs/PC_GRM_D5_raw.mapping.compress.log > PC_GRM_D5_raw.paf.gz
[19:22:15] INFO Running command: utilities.py:193
INFO cphasing-rs paf2porec PC_GRM_D5_raw.paf.gz -q 0 -l 150 -e 0 -p 0.8 -o PC_GRM_D5_raw.porec.gz utilities.py:194
[19:22:51] INFO Running command: utilities.py:193
INFO cphasing-rs porec2pairs PC_GRM_D5_raw.porec.gz hapdup_dual_1.contigsizes -q 0 -o PC_GRM_D5_raw.pairs.pqs utilities.py:194
[19:23:38] INFO Mapping done. mapper.py:1021
INFO Total size of contig-level assembly: 3.04g pipeline.py:779
INFO pipeline.py:829
#----------------------------------#
# Running step 2. prepare #
#----------------------------------#
INFO Running command: utilities.py:193
INFO cphasing-rs count_re ../hapdup_dual_1.fasta -o PC_GRM_D5_raw.counts_GATC.txt -p GATC utilities.py:194
[19:23:54] INFO Running command: utilities.py:193
INFO cphasing-rs pairs2clm ../PC_GRM_D5_raw.pairs.pqs -c 1 -d -t 20 -o PC_GRM_D5_raw.clm.gz -q 0 utilities.py:194
[19:28:24] INFO pipeline.py:908
#----------------------------------#
# Running step 3. hyperpartition #
#----------------------------------#
[19:32:09] INFO Running hyperpartition with basal(haploid) mode. cli.py:4254
INFO Contig length stats: Max=7.53Mb, 95th-percentile=0.32Mb, Median=40.56Kb. utilities.py:1647
INFO Contig length distribution is relatively uniform. Deactivating splitting. utilities.py:1659
[19:32:16] INFO Load raw hypergraph from porec table ../PC_GRM_D5_raw.porec.gz cli.py:4400
INFO Loading Pore-C table ... hypergraph.py:1004
[19:33:08] INFO Processing Pore-C table ... hypergraph.py:1152
INFO Only retained Pore-C concatemer that: hypergraph.py:1153
mapping_quality >= 1
[19:33:24] INFO Result of 38,355,754 raw hyperedges of 35,261 contigs. Note: it's not the final statistics for hypergraph. hypergraph.py:1239
INFO Not implement the allelic and cross-allelic reweight algorithm, because no allelic information or fasta provided. cli.py:4502
[19:33:27] INFO Total 85 contigs were removed, hyperpartition.py:390
INFO because it's length too short (<10000) or your specified in blacklist or not in whitelist. hyperpartition.py:391
[19:33:28] INFO Total 793 low-signal (contacts < 25) contigs were removed (--min-contacts). hypergraph.py:266
[19:33:33] INFO Generated filtered hypergraph that containing 34,468 vertices and 17,649,999 hyperedges. hyperpartition.py:350
INFO Start hyperpartition ... hyperpartition.py:611
[19:33:57] ERROR 'NoneType' object is not subscriptable cli.py:1326
╭──────────────────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────────────────────────────────────────────────────────╮
│ /cpfs01/projects-HDD/cfff-e44ef5cf7aa5_HDD/lt_bh9773/software_1/cphasing/CPhasing/cphasing/cli.py:1248 in pipeline │
│ │
│ 1245 │ │
│ 1246 │ today = datetime.now().strftime("%m-%d_%H_%M_%S") │
│ 1247 │ try: │
│ ❱ 1248 │ │ run(fasta, │
│ 1249 │ │ │ ul_data, │
│ 1250 │ │ │ porec_data, │
│ 1251 │ │ │ porectable, pairs, │
│ │
│ /cpfs01/projects-HDD/cfff-e44ef5cf7aa5_HDD/lt_bh9773/software_1/cphasing/CPhasing/cphasing/pipeline/pipeline.py:1117 in run │
│ │
│ 1114 │ │ │ _out_sh.write("\n") │
│ 1115 │ │ │
│ 1116 │ │ try: │
│ ❱ 1117 │ │ │ hyperpartition.main(args=hyperpartition_args, │
│ 1118 │ │ │ │ │ │ │ prog_name='hyperpartition') │
│ 1119 │ │ except SystemExit as e: │
│ 1120 │ │ │ exc_info = sys.exc_info() │
│ │
│ /cpfs01/projects-HDD/cfff-e44ef5cf7aa5_HDD/lt_bh9773/software_1/cphasing/CPhasing/.pixi/envs/default/lib/python3.12/site-packages/rich_click/rich_command.py:126 in main │
│ │
│ 123 │ │ try: │
│ 124 │ │ │ try: │
│ 125 │ │ │ │ with self.make_context(prog_name, args, **extra) as ctx: │
│ ❱ 126 │ │ │ │ │ rv = self.invoke(ctx) │
│ 127 │ │ │ │ │ if not standalone_mode: │
│ 128 │ │ │ │ │ │ return rv │
│ 129 │ │ │ │ │ # it's not safe to ctx.exit(rv) here! │
│ │
│ /cpfs01/projects-HDD/cfff-e44ef5cf7aa5_HDD/lt_bh9773/software_1/cphasing/CPhasing/.pixi/envs/default/lib/python3.12/site-packages/click/core.py:1443 in invoke │
│ │
│ 1440 │ │ │ echo(style(message, fg="red"), err=True) │
│ 1441 │ │ │
│ 1442 │ │ if self.callback is not None: │
│ ❱ 1443 │ │ │ return ctx.invoke(self.callback, **ctx.params) │
│ 1444 │ │
│ 1445 │ def shell_complete(self, ctx: Context, incomplete: str) -> t.List["CompletionItem"]: │
│ 1446 │ │ """Return a list of completions for the incomplete value. Looks │
│ │
│ /cpfs01/projects-HDD/cfff-e44ef5cf7aa5_HDD/lt_bh9773/software_1/cphasing/CPhasing/.pixi/envs/default/lib/python3.12/site-packages/click/core.py:788 in invoke │
│ │
│ 785 │ │ │
│ 786 │ │ with augment_usage_errors(__self): │
│ 787 │ │ │ with ctx: │
│ ❱ 788 │ │ │ │ return __callback(*args, **kwargs) │
│ 789 │ │
│ 790 │ def forward(__self, __cmd: "Command", *args: t.Any, **kwargs: t.Any) -> t.Any: │
│ 791 │ │ """Similar to :meth:invoke but fills in default keyword │
│ │
│ /cpfs01/projects-HDD/cfff-e44ef5cf7aa5_HDD/lt_bh9773/software_1/cphasing/CPhasing/cphasing/cli.py:4587 in hyperpartition │
│ │
│ 4584 │ │ │ │ is_kprune = True │
│ 4585 │ │ │ else: │
│ 4586 │ │ │ │ is_kprune = False │
│ ❱ 4587 │ │ │ hp.single_partition(int(n[0]), is_kprune=is_kprune) │
│ 4588 │ │ │ hp.to_cluster(output) │
│ 4589 │
│ 4590 │
│ │
│ /cpfs01/projects-HDD/cfff-e44ef5cf7aa5_HDD/lt_bh9773/software_1/cphasing/CPhasing/cphasing/hyperpartition.py:643 in single_partition │
│ │
│ 640 │ │ if len(retain_idx) < raw_contig_counts: │
│ 641 │ │ │ idx_to_vertices = self.idx_to_vertices │
│ 642 │ │ │ A = A[retain_idx, :][:, retain_idx] │
│ ❱ 643 │ │ │ self.H, _, _ = extract_incidence_matrix2(self.H, retain_idx) │
│ 644 │ │ │ │
│ 645 │ │ │ self.vertices = self.vertices[retain_idx] │
│ 646 │ │ │ if self.NW is not None: │
│ │
│ /cpfs01/projects-HDD/cfff-e44ef5cf7aa5_HDD/lt_bh9773/software_1/cphasing/CPhasing/cphasing/algorithms/hypergraph.py:626 in extract_incidence_matrix2 │
│ │
│ 623 # return A, remove_edges_idx, non_zero_edges_idx │
│ 624 │
│ 625 def extract_incidence_matrix2(mat, idx): │
│ ❱ 626 │ A = mat[idx] │
│ 627 │ if A.nnz > 0: │
│ 628 │ │ A_sum = np.bincount(A.indices, weights=A.data, minlength=A.shape[1]) │
│ 629 │ │ non_zero_mask = A_sum > 1 │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: 'NoneType' object is not subscriptable
log截图如下:


你好,非常感谢您开发CPhasing这款软件,我们在运行haploid模式的时候出现了报错:TypeError: 'NoneType' object is not subscriptable
我们使用的CPhasing的版本为:C-Phasing version: 0.2.10.r308
命令为:cphasing pipeline -f asm.fasta -pcd PoreC.fastq.gz -t 20 --mode haploid -n 23
基因组为人类的样本。
在3. hyperpartition步骤出现了报错,请您帮忙看看,非常感谢!
具体log如下:
$ cphasing pipeline -f /cpfs01/projects-HDD/cfff-e44ef5cf7aa5_HDD/lt_bh9773/project/xiaorou_T2T/verkko2_test/D5_HF_NA_NA_NA_verkko2/hapdup/hapdup/hapdup_dual_1.fasta -pcd /cpfs01/projects-HDD/cfff-e44ef5cf7aa5_HDD/public/xrguo/PoreC/PC_GRM_D5_raw.fastq.gz -t 20 --mode haploid -n 23
[16:52:14] INFO C-Phasing version: 0.2.10.r308 pipeline.py:136
INFO Pipeline is started on 2026-02-23. pipeline.py:138
INFO Working on new directory:
cphasing_outputpipeline.py:144INFO Mode is set to
haploidbecause of the secondnis not specified. pipeline.py:160INFO The mode is
haploid, skip step '1. alleles.' pipeline.py:260INFO #----------------------------------# pipeline.py:410
# Running step 0. mapper #
#----------------------------------#
INFO Running command: utilities.py:193
INFO cphasing-rs chromsizes hapdup_dual_1.fasta -o hapdup_dual_1.tmp_add4d648d5894287bb39041714b7b7c3 utilities.py:194
[16:52:23] INFO Moving temporary contigsizes file hapdup_dual_1.tmp_add4d648d5894287bb39041714b7b7c3 to hapdup_dual_1.contigsizes mapper.py:872
INFO Running command: mapper.py:937
INFO minimap2 -t 20 -I 16g -c --secondary=no -x lr:hq hapdup_dual_1.fasta <(crabz -d -p 8 2>logs/PC_GRM_D5_raw.mapping.decompress.log mapper.py:938
/cpfs01/projects-HDD/cfff-e44ef5cf7aa5_HDD/public/xrguo/PoreC/PC_GRM_D5_raw.fastq.gz) 2> logs/PC_GRM_D5_raw.mapping.log | crabz -p 8 --format mgzip 2>logs/PC_GRM_D5_raw.mapping.compress.log > PC_GRM_D5_raw.paf.gz
[19:22:15] INFO Running command: utilities.py:193
INFO cphasing-rs paf2porec PC_GRM_D5_raw.paf.gz -q 0 -l 150 -e 0 -p 0.8 -o PC_GRM_D5_raw.porec.gz utilities.py:194
[19:22:51] INFO Running command: utilities.py:193
INFO cphasing-rs porec2pairs PC_GRM_D5_raw.porec.gz hapdup_dual_1.contigsizes -q 0 -o PC_GRM_D5_raw.pairs.pqs utilities.py:194
[19:23:38] INFO Mapping done. mapper.py:1021
INFO Total size of contig-level assembly: 3.04g pipeline.py:779
INFO pipeline.py:829
#----------------------------------#
# Running step 2. prepare #
#----------------------------------#
INFO Running command: utilities.py:193
INFO cphasing-rs count_re ../hapdup_dual_1.fasta -o PC_GRM_D5_raw.counts_GATC.txt -p GATC utilities.py:194
[19:23:54] INFO Running command: utilities.py:193
INFO cphasing-rs pairs2clm ../PC_GRM_D5_raw.pairs.pqs -c 1 -d -t 20 -o PC_GRM_D5_raw.clm.gz -q 0 utilities.py:194
[19:28:24] INFO pipeline.py:908
#----------------------------------#
# Running step 3. hyperpartition #
#----------------------------------#
[19:32:09] INFO Running hyperpartition with
basal(haploid)mode. cli.py:4254INFO Contig length stats: Max=7.53Mb, 95th-percentile=0.32Mb, Median=40.56Kb. utilities.py:1647
INFO Contig length distribution is relatively uniform. Deactivating splitting. utilities.py:1659
[19:32:16] INFO Load raw hypergraph from porec table
../PC_GRM_D5_raw.porec.gzcli.py:4400INFO Loading Pore-C table ... hypergraph.py:1004
[19:33:08] INFO Processing Pore-C table ... hypergraph.py:1152
INFO Only retained Pore-C concatemer that: hypergraph.py:1153
mapping_quality >= 1
[19:33:24] INFO Result of 38,355,754 raw hyperedges of 35,261 contigs. Note: it's not the final statistics for hypergraph. hypergraph.py:1239
INFO Not implement the allelic and cross-allelic reweight algorithm, because no allelic information or fasta provided. cli.py:4502
[19:33:27] INFO Total 85 contigs were removed, hyperpartition.py:390
INFO because it's length too short (<10000) or your specified in blacklist or not in whitelist. hyperpartition.py:391
[19:33:28] INFO Total 793 low-signal (contacts < 25) contigs were removed (--min-contacts). hypergraph.py:266
[19:33:33] INFO Generated filtered hypergraph that containing 34,468 vertices and 17,649,999 hyperedges. hyperpartition.py:350
INFO Start hyperpartition ... hyperpartition.py:611
[19:33:57] ERROR 'NoneType' object is not subscriptable cli.py:1326
╭──────────────────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────────────────────────────────────────────────────────╮
│ /cpfs01/projects-HDD/cfff-e44ef5cf7aa5_HDD/lt_bh9773/software_1/cphasing/CPhasing/cphasing/cli.py:1248 in pipeline │
│ │
│ 1245 │ │
│ 1246 │ today = datetime.now().strftime("%m-%d_%H_%M_%S") │
│ 1247 │ try: │
│ ❱ 1248 │ │ run(fasta, │
│ 1249 │ │ │ ul_data, │
│ 1250 │ │ │ porec_data, │
│ 1251 │ │ │ porectable, pairs, │
│ │
│ /cpfs01/projects-HDD/cfff-e44ef5cf7aa5_HDD/lt_bh9773/software_1/cphasing/CPhasing/cphasing/pipeline/pipeline.py:1117 in run │
│ │
│ 1114 │ │ │ _out_sh.write("\n") │
│ 1115 │ │ │
│ 1116 │ │ try: │
│ ❱ 1117 │ │ │ hyperpartition.main(args=hyperpartition_args, │
│ 1118 │ │ │ │ │ │ │ prog_name='hyperpartition') │
│ 1119 │ │ except SystemExit as e: │
│ 1120 │ │ │ exc_info = sys.exc_info() │
│ │
│ /cpfs01/projects-HDD/cfff-e44ef5cf7aa5_HDD/lt_bh9773/software_1/cphasing/CPhasing/.pixi/envs/default/lib/python3.12/site-packages/rich_click/rich_command.py:126 in main │
│ │
│ 123 │ │ try: │
│ 124 │ │ │ try: │
│ 125 │ │ │ │ with self.make_context(prog_name, args, **extra) as ctx: │
│ ❱ 126 │ │ │ │ │ rv = self.invoke(ctx) │
│ 127 │ │ │ │ │ if not standalone_mode: │
│ 128 │ │ │ │ │ │ return rv │
│ 129 │ │ │ │ │ # it's not safe to
ctx.exit(rv)here! ││ │
│ /cpfs01/projects-HDD/cfff-e44ef5cf7aa5_HDD/lt_bh9773/software_1/cphasing/CPhasing/.pixi/envs/default/lib/python3.12/site-packages/click/core.py:1443 in invoke │
│ │
│ 1440 │ │ │ echo(style(message, fg="red"), err=True) │
│ 1441 │ │ │
│ 1442 │ │ if self.callback is not None: │
│ ❱ 1443 │ │ │ return ctx.invoke(self.callback, **ctx.params) │
│ 1444 │ │
│ 1445 │ def shell_complete(self, ctx: Context, incomplete: str) -> t.List["CompletionItem"]: │
│ 1446 │ │ """Return a list of completions for the incomplete value. Looks │
│ │
│ /cpfs01/projects-HDD/cfff-e44ef5cf7aa5_HDD/lt_bh9773/software_1/cphasing/CPhasing/.pixi/envs/default/lib/python3.12/site-packages/click/core.py:788 in invoke │
│ │
│ 785 │ │ │
│ 786 │ │ with augment_usage_errors(__self): │
│ 787 │ │ │ with ctx: │
│ ❱ 788 │ │ │ │ return __callback(*args, **kwargs) │
│ 789 │ │
│ 790 │ def forward(__self, __cmd: "Command", *args: t.Any, **kwargs: t.Any) -> t.Any: │
│ 791 │ │ """Similar to :meth:
invokebut fills in default keyword ││ │
│ /cpfs01/projects-HDD/cfff-e44ef5cf7aa5_HDD/lt_bh9773/software_1/cphasing/CPhasing/cphasing/cli.py:4587 in hyperpartition │
│ │
│ 4584 │ │ │ │ is_kprune = True │
│ 4585 │ │ │ else: │
│ 4586 │ │ │ │ is_kprune = False │
│ ❱ 4587 │ │ │ hp.single_partition(int(n[0]), is_kprune=is_kprune) │
│ 4588 │ │ │ hp.to_cluster(output) │
│ 4589 │
│ 4590 │
│ │
│ /cpfs01/projects-HDD/cfff-e44ef5cf7aa5_HDD/lt_bh9773/software_1/cphasing/CPhasing/cphasing/hyperpartition.py:643 in single_partition │
│ │
│ 640 │ │ if len(retain_idx) < raw_contig_counts: │
│ 641 │ │ │ idx_to_vertices = self.idx_to_vertices │
│ 642 │ │ │ A = A[retain_idx, :][:, retain_idx] │
│ ❱ 643 │ │ │ self.H, _, _ = extract_incidence_matrix2(self.H, retain_idx) │
│ 644 │ │ │ │
│ 645 │ │ │ self.vertices = self.vertices[retain_idx] │
│ 646 │ │ │ if self.NW is not None: │
│ │
│ /cpfs01/projects-HDD/cfff-e44ef5cf7aa5_HDD/lt_bh9773/software_1/cphasing/CPhasing/cphasing/algorithms/hypergraph.py:626 in extract_incidence_matrix2 │
│ │
│ 623 # return A, remove_edges_idx, non_zero_edges_idx │
│ 624 │
│ 625 def extract_incidence_matrix2(mat, idx): │
│ ❱ 626 │ A = mat[idx] │
│ 627 │ if A.nnz > 0: │
│ 628 │ │ A_sum = np.bincount(A.indices, weights=A.data, minlength=A.shape[1]) │
│ 629 │ │ non_zero_mask = A_sum > 1 │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: 'NoneType' object is not subscriptable
log截图如下:
