shenwei356 / csvtk

A cross-platform, efficient and practical CSV/TSV toolkit in Golang
http://bioinf.shenwei.me/csvtk
MIT License
999 stars 84 forks source link

wrong number of fields #229

Closed liushuqing506 closed 1 year ago

liushuqing506 commented 1 year ago

Prerequisites

Describe your issue

taxonkit 联合 csvtk 使用中,使用了-I参数,但是结果依然出现[ERRO] record on line 25397: wrong number of fields

cat db_supplement_sta_addClassification_genomedata_nt.taxid.list | taxonkit lineage | taxonkit reformat -f "{k}\t{p}\t{c}\t{o}\t{f}\t{g}\t{s}" -F -P | csvtk cut -t -f -2 | csvtk add-header -I -t -n taxid,kindom,phylum,class,order,family,genus,species > db_supplement_sta_addClassification_genomedata_nt.taxon.tsv

Thank you

I'm grateful to users who have greatly helped to report bugs and suggested new features.

I may respond to issues or fix bugs quickly, but I usually implement new features periodically (two or more weeks).

shenwei356 commented 1 year ago

不建议用 taxonkit lineage | taxonkit reformat 了,建议直接用 taxonkit reformat -I 1 (指定taxid所在列)

请用awk把 25397行打印出来看看。

liushuqing506 commented 1 year ago

我把-I参数填在csvtk cut后面了,不报错了。

liushuqing506 commented 1 year ago

我试用了taxonkit reformat -I 1 -f "{k}\t{p}\t{c}\t{o}\t{f}\t{g}\t{s}" -F -P,但是报错 [ERRO] number of fields (7) and new colnames (8) do not match

liushuqing506 commented 1 year ago

25397行的taxid可能是因为taxonkit没有分类结果,是空的

shenwei356 commented 1 year ago

你给个例子吧,把25397行和前后的发来看看

shenwei356 commented 1 year ago
$ cat db_supplement_sta_addClassification_genomedata_nt.taxid.list 
9606
12345678
452

cat db_supplement_sta_addClassification_genomedata_nt.taxid.list \
    | taxonkit reformat -I 1 -f "{k}\t{p}\t{c}\t{o}\t{f}\t{g}\t{s}" -F -P \
    | csvtk add-header -I -t -n taxid,kindom,phylum,class,order,family,genus,species

taxid   kindom  phylum  class   order   family  genus   species
9606    k__Eukaryota    p__Chordata     c__Mammalia     o__Primates     f__Hominidae    g__Homo s__Homo sapiens
12345678
452     k__Bacteria     p__Pseudomonadota       c__Gammaproteobacteria  o__Legionellales        f__Legionellaceae       g__Legionella   s__Legionella spiritensis

甚至不需要用csvtk

echo -e "taxid\tkindom\tphylum\tclass\torder\tfamily\tgenus\tspecies";
cat db_supplement_sta_addClassification_genomedata_nt.taxid.list \
    | taxonkit reformat -I 1 -f "{k}\t{p}\t{c}\t{o}\t{f}\t{g}\t{s}" -F -P
liushuqing506 commented 1 year ago

谢谢,沈老师

------------------ 原始邮件 ------------------ 发件人: "Wei @.>; 发送时间: 2023年6月13日(星期二) 上午10:39 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [shenwei356/csvtk] wrong number of fields (Issue #229)

$ cat db_supplement_sta_addClassification_genomedata_nt.taxid.list 9606 12345678 452 cat db_supplement_sta_addClassification_genomedata_nt.taxid.list \ | taxonkit reformat -I 1 -f "{k}\t{p}\t{c}\t{o}\t{f}\t{g}\t{s}" -F -P \ | csvtk add-header -I -t -n taxid,kindom,phylum,class,order,family,genus,species taxid kindom phylum class order family genus species 9606 kEukaryota pChordata cMammalia oPrimates fHominidae gHomo sHomo sapiens 12345678 452 kBacteria pPseudomonadota cGammaproteobacteria oLegionellales fLegionellaceae gLegionella sLegionella spiritensis
甚至不需要用csvtk echo -e "taxid\tkindom\tphylum\tclass\torder\tfamily\tgenus\tspecies"; cat db_supplement_sta_addClassification_genomedata_nt.taxid.list \ | taxonkit reformat -I 1 -f "{k}\t{p}\t{c}\t{o}\t{f}\t{g}\t{s}" -F -P
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>