我想下载源自微阵列实验产生的基因表达数据.我不太了解这个主题,但据我所知,行通常对应于基因,列对应于样本.理想情况下,我期待一个基因表达数据矩阵.
我一直在互联网上搜索,虽然看起来有很多地方可以下载这些数据,当我实际上下载数据时,我没有得到基因表达的矩阵.有人可以告诉我,如果有一个地方或如何以我期望的格式下载基因表达数据?
任何帮助表示赞赏.
我开始学习ExecutorService类.文档(和在线教程)说总是调用ExecutorService.shutDown()来回收资源.但是,文档还说在调用shutDown()之后,不会接受任何新任务.所以,我的问题是,每当我需要并行化数据处理时,我是否始终必须实例化一个新的ExecutorService?
现在我有一个可调用对象列表,我执行以下操作.
public void someMethod() {
List<OuterCallable> outerCallables = getOuterCallables();
ExecutorService executor = Executor.newFixedThreadPool(NUM_CPUS);
executor.invokeAll(tasks);
executor.shutDown();
}
Run Code Online (Sandbox Code Playgroud)
但是,我的OuterCallable还使用InnerCallable并行分割数据或执行数据处理.
public class OuterCallable implements Callable<Long> {
public Long call() throws Exception {
long result = 0L;
List<InnerCallable> innerCallables = getInnerCallables();
ExecutorServices executor = Executor.newFixedThreadPool(NUM_CPUS);
executor.invokeAll(tasks);
executor.shutDown();
return result;
}
}
Run Code Online (Sandbox Code Playgroud)
我不记得它是用于ExecutorService还是Fork/Join方法,但我记得文档和教程说操作数据的实际并行过程不应该涉及I/O操作,一切都应该在内存中完成.但是,在我的InnerCallable中,我实际上正在进行JDBC调用(此处未显示).
最终,我使用ExecutorService的方式有效,但我仍然有一些挥之不去的担忧.
作为最后一个问题,我试图研究一下Fork/Join vs ExecutorService.我遇到了一篇完全抨击Fork/Join API /类的文章.学习Fork/Join值得吗?我在stackoverflow和其他地方看到了一些文章,其中测试用于比较Fork/Join和ExecutorService,并且有图表显示了Fork/Join vs ExecutorService的更好的CPU使用率(通过Windows任务管理器).但是,当我使用ExecutorService(JDK 1.7.x)时,我的CPU使用率是最大值.使用最新的JDK改进了ExecutorService吗?
任何帮助/指导表示赞赏.
我有一个元素列表(让我们说整数),我需要进行所有可能的2对比较.我的方法是O(n ^ 2),我想知道是否有更快的方法.这是我在java中的实现.
public class Pair {
public int x, y;
public Pair(int x, int y) {
this.x = x;
this.y = y;
}
}
public List<Pair> getAllPairs(List<Integer> numbers) {
List<Pair> pairs = new ArrayList<Pair>();
int total = numbers.size();
for(int i=0; i < total; i++) {
int num1 = numbers.get(i).intValue();
for(int j=i+1; j < total; j++) {
int num2 = numbers.get(j).intValue();
pairs.add(new Pair(num1,num2));
}
}
return pairs;
}
Run Code Online (Sandbox Code Playgroud)
请注意,我不允许自配,所以应该有((n(n + 1))/ 2) - n个可能的对.我目前的工作原理,但随着n的增加,我花了很长时间才能得到这对.有没有办法将上面的O(n ^ 2)算法转换为亚二次方?任何帮助表示赞赏.
顺便说一下,我也试过下面的算法,但是当我基准测试时,根据经验,它的性能比我上面的要差.我以为通过避免内循环,这会加快速度.下面这个算法不应该更快吗?我会认为它是O(n)?如果没有,请解释并告诉我.谢谢.
public List<Pair> getAllPairs(List<Integer> …Run Code Online (Sandbox Code Playgroud)