小编fra*_*sua的帖子

如何从ispell私人字典中删除条目?

我想知道如何从ispell私有字典中删除一个(错误插入的)条目/单词.

编辑

经过更多的挖掘,我仍然无法从默认字典中删除条目,但我认为解决方案可能是围绕buildhash程序.问题是生成要删除的条目列表...我找不到一个简单的例子.

emacs ispell flyspell

16
推荐指数
3
解决办法
4649
查看次数

如何从出租车获得王国,门,类,秩序,家庭,属和物种的分类学特定ID?

我有一个如下所示的出租车列表:

1204725
2162
1300163
420247
Run Code Online (Sandbox Code Playgroud)

我希望从上面的出租车中获取一个带有分类标准的文件:

kingdom_id      phylum_id       class_id        order_id        family_id       genus_id        species_id   
Run Code Online (Sandbox Code Playgroud)

我正在使用" ete3 " 包.我使用工具ete-ncbiquery来告诉你上面的id的谱系.(我使用下面的命令从我的linux笔记本电脑上运行它)

ete3 ncbiquery --search 1204725 2162 13000163 420247 --info 
Run Code Online (Sandbox Code Playgroud)

结果如下:

# Taxid Sci.Name    Rank    Named Lineage   Taxid Lineage
2162    Methanobacterium formicicum species root,cellular organisms,Archaea,Euryarchaeota,Methanobacteria,Methanobacteriales,Methanobacteriaceae,Methanobacterium,Methanobacterium formicicum   1,131567,2157,28890,183925,2158,2159,2160,2162
1204725 Methanobacterium formicicum DSM 3637    no rank root,cellular organisms,Archaea,Euryarchaeota,Methanobacteria,Methanobacteriales,Methanobacteriaceae,Methanobacterium,Methanobacterium formicicum,Methanobacterium formicicum DSM 3637  1,131567,2157,28890,183925,2158,2159,2160,2162,1204725
420247  Methanobrevibacter smithii ATCC 35061   no rank root,cellular organisms,Archaea,Euryarchaeota,Methanobacteria,Methanobacteriales,Methanobacteriaceae,Methanobrevibacter,Methanobrevibacter smithii,Methanobrevibacter smithii ATCC 350611,131567,2157,28890,183925,2158,2159,2172,2173,420247
Run Code Online (Sandbox Code Playgroud)

我不知道哪些项目(IDS)对应于我要找的东西(如果有的话)

bioinformatics taxonomy ncbi phylogeny etetoolkit

8
推荐指数
1
解决办法
2107
查看次数

使用观测数据的形状生成随机对数正态分布

我正在尝试使一些数据适合对数正态分布,并使用优化的参数从中生成随机的对数正态分布。经过一番搜索,我找到了一些解决方案,但没有令人信服的解决方案:

使用fit函数的solution1:

import  numpy as np
from scipy.stats      import lognorm

mydata = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,6,6,6,6,6,7,7,7,8,8,8,8,8,9,9,9,10,10,11,12,13,14,14,15,19,19,21,23,25,27,28,30,31,36,41,45,48,52,55,60,68,75,86,118,159,207,354]

shape, loc, scale = lognorm.fit(mydata)
rnd_log = lognorm.rvs (shape, loc=loc, scale=scale, size=100)
Run Code Online (Sandbox Code Playgroud)

或使用原始数据中的mu和sigma的解决方案2:

import  numpy as np
from scipy.stats      import lognorm

mydata = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,6,6,6,6,6,7,7,7,8,8,8,8,8,9,9,9,10,10,11,12,13,14,14,15,19,19,21,23,25,27,28,30,31,36,41,45,48,52,55,60,68,75,86,118,159,207,354]

mu    = np.mean([np.log(i) for i in mydata])
sigma = np.std([np.log(i) for i in mydata])

distr   = lognorm(mu, sigma)
rnd_log = distr.rvs (size=100)
Run Code Online (Sandbox Code Playgroud)

这些解决方案都不适合:

import pylab
pylab.plot(sorted(mydata, reverse=True), 'ro')
pylab.plot(sorted(rnd_log, reverse=True), 'bx')
Run Code Online (Sandbox Code Playgroud)

我不确定我是否了解使用发行版的方式,或者是否缺少其他内容...

我在这里找到解决方案:是否有人使用scipy.stats.distributions的示例代码? 但是我无法从数据中获取形状...我是否在使用fit函数时缺少某些东西?

谢谢

编辑:

这是一个例子,以便更好地理解我的问题:

print 'solution 1:'
means = …
Run Code Online (Sandbox Code Playgroud)

python scipy

5
推荐指数
1
解决办法
1427
查看次数

将hcluster生成的ndarray转换为Newick字符串,以便与ete2包一起使用

我有一个通过运行创建的向量列表:

import hcluster
import numpy as np
from ete2 import Tree

vecs = [np.array(i) for i in document_list] 
Run Code Online (Sandbox Code Playgroud)

其中document_list是我正在分析的Web文档的集合.然后我执行分层聚类:

Z = hcluster.linkage(vecs, metric='cosine') 
Run Code Online (Sandbox Code Playgroud)

这会生成一个ndarray,例如:

[[ 12.          19.           0.           1.        ]
[ 15.          21.           0.           3.        ]
[ 18.          22.           0.           4.        ]
[  3.          16.           0.           7.        ]
[  8.          23.           0.           6.        ]
[  5.          27.           0.           6.        ]
[  1.          28.           0.           7.        ]
[  0.          21.           0.           2.        ]
[  5.          29.           0.18350472   2.        ]
[  2. …
Run Code Online (Sandbox Code Playgroud)

python numpy dendrogram hcluster etetoolkit

5
推荐指数
1
解决办法
2072
查看次数

python 2.5中的格式字符串解压缩列表

有没有办法在Python 2.5中做这样的事情:

b = ('{!s}'*3)
b.format(*[i for i in xrange (3)])
Run Code Online (Sandbox Code Playgroud)

因为这不起作用:

b = ('%s'*3)
b % (*[i for i in xrange (3)])
Run Code Online (Sandbox Code Playgroud)

python tuples string-formatting iterable-unpacking

2
推荐指数
1
解决办法
921
查看次数

使用Python 2.7的HTML解析树

我试图为下面的HTML表配置一个解析树,但是无法形成它.我想看看树结构是什么样的!有人可以帮助我吗?

# <html>
#  <head>
#   <title>
#    The Dormouse's story
#   </title>
#  </head>
#  <body>
#   <p class="title">
#    <b>
#     The Dormouse's story
#    </b>
#   </p>
#   <p class="story">
#    Once upon a time there were three little sisters; and their names were
#    <a class="sister" href="http://example.com/elsie" id="link1">
#     Elsie
#    </a>
#    ,
#    <a class="sister" href="http://example.com/lacie" id="link2">
#     Lacie
#    </a>
#    and
#    <a class="sister" href="http://example.com/tillie" id="link2">
#     Tillie
#    </a>
#    ; …
Run Code Online (Sandbox Code Playgroud)

python beautifulsoup parse-tree python-2.7 etetoolkit

2
推荐指数
2
解决办法
5811
查看次数

ETE2 .phonehome()它是复活节彩蛋吗?

ETE2(用于系统发育树探索的Python环境)有一个.phonehome()可以在树/节点类对象上调用的方法.返回:

== Calling home... Got answer!

He11o alien,
How is everything in the Earth?
We miss you in Brodo Asogi.

I see you are in shape.
No updates are available.

== Do you want to leave any message?
(Press enter to finish)
Run Code Online (Sandbox Code Playgroud)

如果您想自己测试一下,请尝试:

from ete2 import Tree
t = Tree()      # generate random Tree
t.phonehome()   # communicate with Aliens!
Run Code Online (Sandbox Code Playgroud)

这是一个复活节彩蛋吗?

python messaging etetoolkit

-2
推荐指数
1
解决办法
247
查看次数