📄 test.java
字号:
import java.io.*;
import java.util.StringTokenizer;
public class test{
public static void main(String[] args) throws Exception{
BufferedReader in = new BufferedReader(new FileReader("e:/chrom_9"));
BufferedWriter out = new BufferedWriter(new FileWriter("e:/result.arp"));
String ls = System.getProperty("line.separator");
String line = "";
String newline = "";
String newline1 = "";
String newline2 = "";
String[] strs=new String[39];
int linenumber=0;
while((line=in.readLine())!=null){
int counter=0;
StringTokenizer st = new StringTokenizer(line);
while (st.hasMoreTokens()) {
if(counter==0)
strs[counter]= st.nextToken() +" 1 ";
else
strs[counter]= st.nextToken();
counter++;
}
newline=newline+strs[0];
for(int i=1; i<strs.length; i++){
if(i%2==1){
if(strs[i].equals("-9")){
strs[i]=" ?";
newline1+="\t"+strs[i];
}
else
newline1+="\t"+strs[i];
}
if(i%2==0){
if(strs[i].equals("-9")){
strs[i]=" ?";
newline2+="\t"+strs[i];
}
else
newline2+="\t"+strs[i];
}
}
linenumber++;
newline += newline1 + ls + " "+ newline2 + ls;
newline1 = "";
newline2 = "";
for(int i=0;i<39;i++){
strs[i]="";
}
}
out.write("#====================================================================#" + ls);
out.flush();
out.write("# Project file created by eArlequin #" + ls);
out.flush();
out.write("# Copyleft 2008 Dept. of Bioinformatics of Harbin Medical University #" + ls);
out.flush();
out.write("# Maintained by Manjusaka #" + ls);
out.flush();
out.write("#====================================================================#" + ls);
out.flush();
out.write(ls);
out.flush();
out.write("[Profile]" + ls);
out.flush();
out.write("\tNbSamples=1" + ls);
out.flush();
out.write("\tDataType=STANDARD # - {DNA, RFLP, MICROSAT, STANDARD, FREQUENCY}" + ls);
out.flush();
out.write("\tGenotypicData=1 # - {0, 1}" + ls);
out.flush();
out.write("\tGameticPhase=0 # - {0, 1}" + ls);
out.flush();
out.write("\tLocusSeparator=TAB # - {TAB, WHITESPACE, NONE}" + ls);
out.flush();
out.write("\tRecessiveData=0 # - {0, 1}" + ls);
out.flush();
out.write("\tMissingData='?' # A single character specifying missing data" + ls);
out.flush();
out.write("#\tSome advanced settings the experienced user can uncomment" + ls);
out.flush();
out.write("#\tFrequency= ABS # - {ABS, REL}" + ls);
out.flush();
out.write("#\tFrequencyThreshold= 1.0e-5 # - (Any real number, usually between 1.0e-7 and 1.e-3)" + ls);
out.flush();
out.write("#\tEpsilonValue= 1.0e-7 # - (Any real number, usually between 1.0e-12 and 1.0e-5)" + ls);
out.flush();
out.write(ls);
out.flush();
out.write("[Data]" + ls);
out.flush();
out.write(ls);
out.flush();
out.write("[[Samples]]" + ls);
out.flush();
out.write(ls);
out.flush();
out.write("\tSampleName=\"Population number 1\"" + ls);
out.flush();
out.write("\tSampleSize=" + linenumber + ls);
out.flush();
out.write("\tSampleData={" + ls);
out.flush();
out.write(newline);
out.flush();
out.write("}" + ls);
out.flush();
out.close();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -