First working "writing" code for Cassandra 2.0
[proteocache.git] / datadb / compbio / cassandra / JpredParserLocalFile.java
index 27d4252..281a20b 100644 (file)
@@ -77,53 +77,43 @@ public class JpredParserLocalFile implements JpredParser {
                                String ip = table[2];
                                String id = table[table.length - 1];
                                totalcount++;
-                               //if (!cc.CheckID(id)) {
-                                       if (true) {
-                                       String confilename = dirprefix + "/" + id + "/" + id + ".concise";
-                                       File confile = new File(confilename);
-                                       if (confile.exists()) {
-                                               try {
-                                                       final FastaReader fr = new FastaReader(confilename);
-                                                       final List<FastaSequence> seqs = new ArrayList<FastaSequence>();
-                                                       String newprotein = "";
-                                                       while (fr.hasNext()) {
-                                                               final FastaSequence fs = fr.next();
-                                                               if (fs.getId().equals("QUERY") || fs.getId().equals(id))
-                                                                       newprotein = fs.getSequence().replaceAll("\n", "");
-                                                               else if (fs.getId().equals("jnetpred") || fs.getId().equals("JNETPRED")) {
-                                                                       seqs.add(fs);
-                                                               }
+                               String confilename = dirprefix + "/" + id + "/" + id + ".concise";
+                               File confile = new File(confilename);
+                               if (confile.exists()) {
+                                       try {
+                                               final FastaReader fr = new FastaReader(confilename);
+                                               final List<FastaSequence> seqs = new ArrayList<FastaSequence>();
+                                               String newprotein = "";
+                                               while (fr.hasNext()) {
+                                                       final FastaSequence fs = fr.next();
+                                                       if (fs.getId().equals("QUERY") || fs.getId().equals(id))
+                                                               newprotein = fs.getSequence().replaceAll("\n", "");
+                                                       else if (fs.getId().equals("jnetpred") || fs.getId().equals("JNETPRED")) {
+                                                               seqs.add(fs);
                                                        }
-                                                       if (newprotein.equals("")) {
-                                                               countUnclearFASTAid++;
-                                                       } else {
-                                                               SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd");
-                                                               String dateInString1 = starttime.substring(0, starttime.indexOf(":"));
-                                                               long dateWork1 = 0;
-                                                               try {
-                                                                       Date dat = formatter.parse(dateInString1);
-                                                                       dateWork1 = dat.getTime();
-                                                               } catch (ParseException e) {
-                                                                       e.printStackTrace();
-                                                               }
-                                                               cc.InsertData(dateWork1, starttime, finishtime, ip, id, "OK", "OK", newprotein, seqs);
-                                                               ++countinsertions;
-                                                               ++njobs;
-                                                               // flush every 50 insertions
-                                                               //if (0 == countinsertions % 50) {
-                                                               //      cc.flushData();
-                                                               //      njobs -= 50;
-                                                               //}
+                                               }
+                                               if (newprotein.equals("")) {
+                                                       countUnclearFASTAid++;
+                                               } else {
+                                                       SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd");
+                                                       String dateInString1 = starttime.substring(0, starttime.indexOf(":"));
+                                                       long insertdate = 0;
+                                                       try {
+                                                               Date dat = formatter.parse(dateInString1);
+                                                               insertdate = dat.getTime();
+                                                       } catch (ParseException e) {
+                                                               e.printStackTrace();
                                                        }
-                                                       fr.close();
-                                               } catch (IOException e) {
-                                                       e.printStackTrace();
+                                                       cc.InsertData(insertdate, starttime, finishtime, ip, id, "OK", "OK", newprotein, seqs);
+                                                       ++countinsertions;
+                                                       ++njobs;
                                                }
-                                       } else {
-                                               countNoData++;
+                                               fr.close();
+                                       } catch (IOException e) {
+                                               e.printStackTrace();
                                        }
                                } else {
-                                       ++countinserted;
+                                       countNoData++;
                                }
                        } else {
                                if (in.matches(date + "(.*)Sequence0/(.*)")) {