作者:欣儿2502862161 | 来源:互联网 | 2023-09-16 13:15
我有3个来自RESEARCHS的映射值,指定要使用参考数据集填充的行中的范围。该研究的数据集稀疏,如果满足条件,我打算使用参考数据集添加信息。即,如果相邻列在研究中具有A&A元素;使用参考的第1行填充该范围。如果相邻的列具有B&B元素;用参考的第2行填充,否则用NA填充。请帮助我解决这个问题,我在Java领域还很陌生,这要归功于StackOverflow社区的帖子;我正在学习Java编程的新迷人方法。
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
public class Projector{
public static void main(String[] args) {
// ==========STUDY=================================================================
//=== Map1 values- Elements with adjascent A-A values in STUDY columns ===
Map> MapA = new HashMap<>();
MapA.put(0,new ArrayList(Arrays.asList(577,600,825,870)));
MapA.put(1,new ArrayList(Arrays.asList()));
MapA.put(2,new ArrayList(Arrays.asList(600,870)));
//=== Map2 values- Elements with adjacent B-B values in STUDY columns ===
Map> MapB = new HashMap<>();
MapB.put(0,new ArrayList(Arrays.asList()));
MapB.put(1,600)));
MapB.put(2,new ArrayList(Arrays.asList()));
//== Map3 values - Elements without above two conditions i.e A-B,A-NA,B-A,B-NA in STUDY ===
Map> Map_NA = new HashMap<>();
Map_NA.put(0,new ArrayList(Arrays.asList()));
Map_NA.put(1,870)));
Map_NA.put(2,600)));
// ==========REFERENCE=============================================================
// Reference dataset with header stored in separate list
// creating Arrays of headers; Integer type
Integer header[] = new Integer[] { 568,570,592,598,612,650,700,822,830,840,900,1000 };
// getting the list view of Array
List listH = Arrays.asList(header);
// creating Arrays which will be used to populate Map1 intervals ;String type
String a[] = new String[] { "G","T","A","C","G","A" };
// getting the list view of Array
List listA = Arrays.asList(a);
// creating Arrays which will be used to populate Map2 intervals ;String type
String b[] = new String[] { "A","T" };
// getting the list view of Array
List listB = Arrays.asList(b);
// ==========SOLUTION======================================================================
// Populate the study using the reference ;
/*
Description of how to populate??
- if adjacent STUDY columns have A-A elements; fill that row range using ROW 1 of the REFERENCE.
- if adjacent STUDY columns have B-B elements; fill with ROW 2 of REFERENCE,otherwise fill with NA.
*/
}
}
- 研究
ID,577,870
Line0,A,A
Line1,B,NA,B
Line2,A
- 参考
ID,568,1000
one,G,T,C,A
two,T
- 预期结果
ID,900
Line0,T
Line1,NA
Line2,T