+ /**\r
+ * Calculate conservation for sequences loaded from the file\r
+ * \r
+ * @param wsproxy\r
+ * a web service proxy\r
+ * @param file\r
+ * the file to read the results from\r
+ * @param preset\r
+ * Preset to use optional\r
+ * @param customOptions\r
+ * the list of options\r
+ * @return Set<Score> the conservation scores\r
+ * @throws UnknownFileFormatException\r
+ */\r
+ <T> ScoreManager analize(File file, SequenceAnnotation<T> wsproxy,\r
+ Preset<T> preset, List<Option<T>> customOptions) {\r
+\r
+ List<FastaSequence> fastalist = null;\r
+ ScoreManager scores = null;\r
+ try {\r
+ fastalist = SequenceUtil.openInputStream(file.getAbsolutePath());\r
+ assert !fastalist.isEmpty() : "Input is empty!";\r
+\r
+ String jobId = null;\r
+ if (customOptions != null && preset != null) {\r
+ System.out\r
+ .println("WARN: Parameters (-f) are defined together with a preset (-r) ignoring preset!");\r
+ }\r
+ if (customOptions != null) {\r
+ jobId = wsproxy.customAnalize(fastalist, customOptions);\r
+ } else if (preset != null) {\r
+ jobId = wsproxy.presetAnalize(fastalist, preset);\r
+ } else {\r
+ System.out.println("\n\ncalling analise.........");\r
+ jobId = wsproxy.analize(fastalist);\r
+ }\r
+ Thread.sleep(2000);\r
+\r
+ scores = wsproxy.getAnnotation(jobId);\r
+\r
+ } catch (IOException e) {\r
+ System.err\r
+ .println("Exception while reading the input file. "\r
+ + "Check that the input file contains a list of fasta formatted sequences! "\r
+ + "Exception details are below:");\r
+ e.printStackTrace();\r
+ } catch (JobSubmissionException e) {\r
+ System.err\r
+ .println("Exception while submitting job to a web server. "\r
+ + "Exception details are below:");\r
+ e.printStackTrace();\r
+ } catch (ResultNotAvailableException e) {\r
+ System.err.println("Exception while waiting for results. "\r
+ + "Exception details are below:");\r
+ e.printStackTrace();\r
+ } catch (InterruptedException ignored) {\r
+ // ignore and propagate an interruption\r
+ Thread.currentThread().interrupt();\r
+ } catch (WrongParameterException e) {\r
+ System.err\r
+ .println("Exception while parsing the web method input parameters. "\r
+ + "Exception details are below:");\r
+ e.printStackTrace();\r
+ } catch (UnknownFileFormatException e) {\r
+ System.err\r
+ .println("Exception while attempting to read the input file "\r
+ + "Exception details are below:");\r
+ System.out.println(e.getMessage());\r
+ e.printStackTrace();\r
+ }\r
+ return scores;\r
+ }\r