我输入的数据包含这样的行:
-0.438185 -0.766791 0.695282
0.759100 0.034400 0.524807
Run Code Online (Sandbox Code Playgroud)
如何在R中创建如下所示的数据结构:
[[1]]
[1] -0.438185 -0.766791 0.695282
[[2]]
[1] 0.759100 0.034400 0.524807
Run Code Online (Sandbox Code Playgroud) 我试着通过以下方式构建聚类方法:
mydata <- mtcars
# Here I construct hclust as a function
hclustfunc <- function(x) hclust(as.matrix(x),method="complete")
# Define distance metric
distfunc <- function(x) as.dist((1-cor(t(x)))/2)
# Obtain distance
d <- distfunc(mydata)
# Call that hclust function
fit<-hclustfunc(d)
# Later I'd do
# plot(fit)
Run Code Online (Sandbox Code Playgroud)
但为什么它会出现以下错误:
Error in if (is.na(n) || n > 65536L) stop("size cannot be NA nor exceed 65536") :
missing value where TRUE/FALSE needed
Run Code Online (Sandbox Code Playgroud)
什么是正确的方法呢?
我有一个看起来像这样的CSV:
gene,stem1,stem2,stem3,b1,b2,b3,special_col
foo,20,10,11,23,22,79,3
bar,17,13,505,12,13,88,1
qui,17,13,5,12,13,88,3
Run Code Online (Sandbox Code Playgroud)
作为数据框架,它看起来像这样:
In [17]: import pandas as pd
In [20]: df = pd.read_table("http://dpaste.com/3PQV3FA.txt",sep=",")
In [21]: df
Out[21]:
gene stem1 stem2 stem3 b1 b2 b3 special_col
0 foo 20 10 11 23 22 79 3
1 bar 17 13 505 12 13 88 1
2 qui 17 13 5 12 13 88 3
Run Code Online (Sandbox Code Playgroud)
我想要做的是执行从最后一列(Pearson相关special_col
)与之间的每个列gene
柱和special column
,即colnames[1:number_of_column-1]
在一天结束时,我们将有6个数据框架.
Coln PearCorr
stem1 0.5
stem2 -0.5
stem3 -0.9999453506011533
b1 0.5
b2 0.5
b3 -0.5 …
Run Code Online (Sandbox Code Playgroud) 我有一个看起来像这样的数据:
它可以在这里查看,并已包含在下面的代码中.实际上我有~7000个样本(行),也可以下载.
任务给予抗原,预测相应的表位.因此表位始终是抗原的精确子串.这相当于序列到序列学习.这是我在Keras下的Recurrent Neural Network上运行的代码.它是根据例子建模的.
我的问题是:
这是我的运行代码,它给出了非常差的准确度分数.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import json
import pandas as pd
from keras.models import Sequential
from keras.engine.training import slice_X
from keras.layers.core import Activation, RepeatVector, Dense
from keras.layers import recurrent, TimeDistributed
import numpy as np
from six.moves import range
class CharacterTable(object):
'''
Given a set of characters:
+ Encode them to a one …
Run Code Online (Sandbox Code Playgroud) 我有以下HTML文件(mypage.html
).SVG 文件
作为图像附加到其中.
<!doctype html>
<html>
<body>
<!-- Display legend -->
<div>
<center> <img src="circos-table-image-medium.svg" height=3500; width=3500; /> </center>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
它生成的页面如下所示:
请注意,圆周围有一个很大的空白区域.如何在html或CSS中裁剪?
I have script that looks like this
#!/bin/bash
#exampel inputfile is "myfile.txt"
inputfile=$1
basen=`basename $inputfile .txt` # create basename
cat $inputfile |
awk '{print $basen "\t" $3} # this doesn't print "myfile" but the whole content of it.
Run Code Online (Sandbox Code Playgroud)
What I want to do above is to print out in AWK the variable called 'basen' created before. But somehow it failed to do what I hoped it will.
So for example myfile.txt
contain these lines
foo bar bax
foo qux bar …
Run Code Online (Sandbox Code Playgroud) 我的数据看起来像这样:
foo 78 xxx
bar yyy
qux 99 zzz
xuq xyz
Run Code Online (Sandbox Code Playgroud)
它们是制表符分隔的.如何提取第2列为空的行,让步
bar yyy
xuq xyz
Run Code Online (Sandbox Code Playgroud)
我试过这个,但似乎不起作用:
awk '$2==""' myfile.txt
Run Code Online (Sandbox Code Playgroud) 我有以下数据
feat_1 feat_2 ... feat_n label
gene_1 100.33 10.2 ... 90.23 great
gene_2 13.32 87.9 ... 77.18 soso
....
gene_m 213.32 63.2 ... 12.23 quitegood
Run Code Online (Sandbox Code Playgroud)
大小M
约为30K行,并且N
小得多~10列.我的问题是,学习和测试上述数据的适当深度学习结构是什么.
在一天结束时,用户将给出具有表达的基因载体.
gene_1 989.00
gene_2 77.10
...
gene_N 100.10
Run Code Online (Sandbox Code Playgroud)
并且系统将标记每个基因适用的标签,例如伟大或soso等...
按结构我的意思是其中之一:
python machine-learning scikit-learn deep-learning tensorflow
我有一个看起来像这样的字符串
my $str1 = "ACGGATATTGA";
my $str2 = "alex";
Run Code Online (Sandbox Code Playgroud)
我想要做的是从每个字符中提取最后三个字符.
$out1 = "TGA";
$out2 = "lex";
Run Code Online (Sandbox Code Playgroud)
我怎么能在Perl中做到这一点?
其实我有两个问题:
我正在使用GCC版本:
gcc (GCC) 4.5.1
Run Code Online (Sandbox Code Playgroud)
当我尝试编译代码时,它给了我这个错误:
$ gcc -O3 -msse2 -fno-strict-aliasing -DHAVE_SSE2=1 -DMEXP=19937 -o test-sse2-M19937 test.c
cc1: error: unrecognized command line option "-msse2"
Run Code Online (Sandbox Code Playgroud)
并cpuinfo
显示:
processor : 0
vendor : GenuineIntel
arch : IA-64
family : 32
model : 1
model name : Dual-Core Intel(R) Itanium(R) Processor 9140M
revision : 1
archrev : 0
features : branchlong, 16-byte atomic ops
cpu number : 0
cpu regs : 4
cpu MHz : 1669.000503
itc MHz : 416.875000
BogoMIPS …
Run Code Online (Sandbox Code Playgroud)