*/
mutatorLong = HFactory.createMutator(ksp, ls);
- if (source.equals("http")) {
+ if (true) {
+ //if (source.equals("http")) {
// get data from real Jpred production server
System.out.println("Parsing web data source......");
String datasrc = "http://www.compbio.dundee.ac.uk/www-jpred/results/usage-new/alljobs.dat";
JpredParserHTTP parser = new JpredParserHTTP(prefix);
parser.Parsing(datasrc, 4);
flushData();
- } else if (source.equals("file")) {
+ }
+ if (true) {
+ //if (source.equals("file")) {
// get irtifical data generated for the DB stress tests
System.out.println("Parsing local file data source......");
String datasrc = "/home/asherstnev/Projects/Java.projects/proteocache/data_stress_test/data.dat";
String prefix = "/home/asherstnev/Projects/Java.projects/proteocache/data_stress_test/Jpreddata";
JpredParserLocalFile parser = new JpredParserLocalFile(prefix);
- parser.Parsing(datasrc, 365);
+ parser.Parsing(datasrc, 190);
flushData();
- } else {
- System.out.println("Unknown data source......");
}
}
int year = cal.get(Calendar.YEAR);
int day = cal.get(Calendar.DATE);
String date = year + "/" + month + "/" + day;
- ParsingForDate(source, date);
+ if (0 < ParsingForDate(source, date)) {
+ cc.flushData();
+ }
}
}
- private void ParsingForDate(String input, String date) {
+ private int ParsingForDate(String input, String date) {
int totalcount = 0;
int countNoData = 0;
int countUnclearFASTAid = 0;
int countinserted = 0;
int counAlignments = 0;
int countStrange = 0;
+ int njobs = 0;
System.out.println("Inserting jobs for " + date);
try {
}
cc.InsertData(dateWork1, table[0], table[1], table[2], id, "OK", "OK", newprotein, seqs);
++countinsertions;
- // flush every 100 insertions
- if (0 == countinsertions % 100) {
+ ++njobs;
+ // flush every 50 insertions
+ if (0 == countinsertions % 50) {
cc.flushData();
+ njobs -= 50;
}
}
} catch (IOException e) {
} catch (IOException e) {
e.printStackTrace();
}
+ return njobs;
}
}
import java.util.Date;
import java.util.List;
-public class JpredParserLocalFile {
+public class JpredParserLocalFile implements JpredParser {
private CassandraCreate cc = new CassandraCreate();
private String dirprefix;
-
+
public void setSource (String newsourceprefix) {
this.dirprefix = newsourceprefix;
}
int year = cal.get(Calendar.YEAR);
int day = cal.get(Calendar.DATE);
String date = year + "/" + month + "/" + day;
- ParsingForDate(source, date);
+ if (0 < ParsingForDate(source, date)) {
+ cc.flushData();
+ }
}
}
- private void ParsingForDate(String input, String date) {
+ private int ParsingForDate(String input, String date) {
int totalcount = 0;
int countNoData = 0;
int countUnclearFASTAid = 0;
int countinserted = 0;
int counAlignments = 0;
int countStrange = 0;
+ int njobs = 0;
System.out.println("Inserting jobs for " + date);
try {
}
cc.InsertData(dateWork1, table[0], table[1], table[2], id, "OK", "OK", newprotein, seqs);
++countinsertions;
- // flush every 100 insertions
- if (0 == countinsertions % 100) {
+ ++njobs;
+ // flush every 50 insertions
+ if (0 == countinsertions % 50) {
cc.flushData();
+ njobs -= 50;
}
}
+ fr.close();
} catch (IOException e) {
e.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
}
+ return njobs;
}
}