package compbio.cassandra;
import java.io.BufferedReader;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import compbio.cassandra.JpredParser;
public class JpredParserHTTP implements JpredParser {
- private CassandraCreate cc = new CassandraCreate();
+ private CassandraNativeConnector cc = new CassandraNativeConnector();
private String dirprefix;
JpredParserHTTP() {
dirprefix = newsourceprefix;
}
- public void Parsing(String source, int nDays) {
+ public void Parsing(String source, int nDays) throws IOException {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -nDays);
for (int i = 0; i < nDays; ++i) {
}
}
- 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 {
final FastaSequence fs = fr.next();
if (fs.getId().equals("QUERY") || fs.getId().equals(id))
newprotein = fs.getSequence().replaceAll("\n", "");
- else
+ else if (fs.getId().equals("jnetpred") || fs.getId().equals("JNETPRED")) {
seqs.add(fs);
+ }
}
if (newprotein.equals("")) {
countUnclearFASTAid++;
}
cc.InsertData(dateWork1, table[0], table[1], table[2], id, "OK", "OK", newprotein, seqs);
++countinsertions;
- // flush every 100 insertions
- if (0 == countinsertions % 100) {
- cc.flushData();
- }
+ ++njobs;
+ // flush every 50 insertions
+ //if (0 == countinsertions % 50) {
+ // cc.flushData();
+ // njobs -= 50;
+ //}
}
} catch (IOException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
+ return njobs;
}
}