model.put("date1", date1);
model.put("date2", date2);
-
+
return "queryJobStatistics";
}
model.put("date2", date2);
TotalJobsStatisticBean res = cr.countJobs(date1, date2);
model.put("result", res);
- model.put("ndays", res.size());
+ model.put("ndays", res.getDateTotal().size());
final long endTime = System.currentTimeMillis();
model.put("timeExecution", (endTime - startTime));
model.put("option", option);
return "/reportJobStatistics";
}
-
+
@RequestMapping(value = "/stat/oneday", method = RequestMethod.GET)
public String findJobsInOneDay(@RequestParam("date") String date, Map<String, Object> model) throws ParseException {
final long startTime = System.currentTimeMillis();
import compbio.statistic.CassandraRequester;
/**
- * Spring controller for sequence search. This version works in the servlet style.
+ * Spring controller for sequence search. This version works in the servlet
+ * style.
*
* @author Alexander Sherstnev
* @author Natasha Sherstneva
*/
@Controller
public class SequenceController {
-
+
/**
- * pattern for NON-protein alphabet symbols
+ * pattern for NON-protein alphabet symbols
*/
private final Pattern NONPROTEIN = Pattern.compile("[^ARNDCQEGHILKMFPSTWYV]+", Pattern.CASE_INSENSITIVE);
model.put("value", 5);
return "queryProteinSequenceCounter";
}
-
+
@RequestMapping(value = "/sequence/querysequence", method = RequestMethod.GET)
public String findSequence(@RequestParam("sequence") String sequence, @RequestParam("protein") String flag, Map<String, Object> model) {
final long startTime = System.currentTimeMillis();
model.put("results", r);
if (null != r) {
if (flag.equals("whole"))
- model.put("njobs",r.get(0).getJobid().size());
+ model.put("njobs", r.get(0).getJobid().size());
else
model.put("njobs", r.size());
}
if (null == date2) {
date1 = "2100/1/1";
}
- if (!isThisDateValid(date1,formatYYMMDD) || !isThisDateValid(date2,formatYYMMDD)) {
+ if (!isThisDateValid(date1, formatYYMMDD) || !isThisDateValid(date2, formatYYMMDD)) {
System.out.println("CassandraRequester.extractExecutionTime: wrong format for date1 " + date1 + "or date2 " + date2);
return null;
}
query.add(db);
return query;
}
-
+
/*
- * query: total number of jobs for the period from date1 till date2
+ * query: total number of jobs for the period from date1 till date2
*/
public TotalJobsStatisticBean countJobs(String date1, String date2) {
if (null == date1) {
Calendar end = Calendar.getInstance();
end.setTime(new Date(dateEnd));
TotalJobsStatisticBean query = new TotalJobsStatisticBean();
- Total wholeTotal = new Total(0,0,0,0,0);
+ Total wholeTotal = new Total(0, 0, 0, 0, 0);
for (Date date = start.getTime(); !start.after(end); start.add(Calendar.DATE, 1), date = start.getTime()) {
Total res = db.ReadDateTable(date.getTime());
if (res == null)
/*
* query: jobs and sequence at date
*/
- public DateBean readJobByDay (String date) {
+ public DateBean readJobByDay(String date) {
if (!isThisDateValid(date, formatDDMMYY)) {
System.out.println("CassandraRequester.readJobByDay: Wrong date format for " + date);
return null;
SetDateRange();
long day = DateParsing(date, formatDDMMYY);
if (day < earlestDate || day > currentDate)
- return null;
+ return null;
return db.ReadProteinData(day, date);
}
-
- /*
+ /*
* query: protein sequence
- **/
+ */
public List<ProteinBean> readProteins(String protIn, String flag) {
List<ProteinBean> result;
- if (flag.equals("whole"))
+ if (flag.equals("whole"))
result = db.ReadWholeSequence(protIn);
- else
- result = db.ReadPartOfSequence(protIn);
+ else
+ result = db.ReadPartOfSequence(protIn);
if (result == null)
return null;
-
+
if (flag.equals("part")) {
for (ProteinBean entry : result) {
entry.setSubProt(CreateSubprot(entry.getSequence(), protIn));
}
- }
+ }
return result;
}
-
- /*
+ /*
* query protein sequences with number of jobs
*/
- public List<TotalByCounterBean> readProteinByCounter(int minimalcounter) {
+ public List<TotalByCounterBean> readProteinByCounter(int minimalcounter) {
List<TotalByCounterBean> query = new ArrayList<TotalByCounterBean>();
Map<String, Integer> map = db.ReadProteinSequenceByCounter();
if (map == null)
}
return query;
}
-
- /*
+
+ /*
* query ip with number of jobs
*/
public List<TotalByCounterBean> readIpByCounter(Integer minimalcounter) {
}
return query;
}
+
/*
* query jobs log info
*/
return null;
return db.ReadJobLog(jobid);
}
-
-
+
/*
* query jobs by ipStructureJobLog
*/
if (ip == null)
return null;
Map<String, String[]> res = db.ReadIpWithJobs(ip);
- if (res == null)
+ if (res == null)
return null;
UserBean query = new UserBean(ip);
query.setMainInfo(res);
return query;
}
-
+
/*
* create list of parts of protein sequence;
*/
- private static List<String> CreateSubprot (String protein, String subprot) {
+ private static List<String> CreateSubprot(String protein, String subprot) {
List<String> sub = new ArrayList<String>();
String subStr = protein;
while (subStr.length() > 0 && subStr.contains(subprot)) {
sub.add(subStr);
return sub;
}
+
/*
* convert String date into long date (miliseconds since the epoch start)
*/
return 0;
}
long dateWorkSt = 0;
-
+
try {
dateWorkSt = formatter.parse(datInput).getTime();
} catch (ParseException e) {
*/
private static void SetDateRange() {
Calendar cal = Calendar.getInstance();
- currentDate = DateParsing(cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.DAY_OF_MONTH), formatYYMMDD);
+ currentDate = DateParsing(cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.DAY_OF_MONTH),
+ formatYYMMDD);
if (0 == earlestDate) {
CassandraRequester cr = new CassandraRequester();
earlestDate = cr.earliestDate();
earlestDate = CassandraNativeConnector.getEarliestDateInDB();
return earlestDate;
}
-
+
}