Title: NCBIQBlastService.sendAlignmentRequest | Always throws ArrayIndexOutOfBoundsException · Issue #1033 · biojava/biojava · GitHub
Open Graph Title: NCBIQBlastService.sendAlignmentRequest | Always throws ArrayIndexOutOfBoundsException · Issue #1033 · biojava/biojava
X Title: NCBIQBlastService.sendAlignmentRequest | Always throws ArrayIndexOutOfBoundsException · Issue #1033 · biojava/biojava
Description: I am using BioJava through Maven, using biojava 6.0.5 and biojava-ws 6.0.4 (because trying to use 6.0.5 produces errors): Open Graph Description: I am using BioJava through Maven, using biojava 6.0.5 and biojava-ws 6.0.4 (because trying to use 6.0.5 produces errors): X Description: I am using BioJava through Maven, using biojava 6.0.5 and biojava-ws 6.0.4 (because trying to use 6.0.5 produces errors): <!-- https://mvnrepository.com/artifact/org.biojava/biojava --> <d...
Opengraph URL: https://github.com/biojava/biojava/issues/1033
X: @github
Domain: patch-diff.githubusercontent.com
Links:
Viewport: width=device-width
Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"NCBIQBlastService.sendAlignmentRequest | Always throws ArrayIndexOutOfBoundsException","articleBody":"I am using BioJava through Maven, using biojava 6.0.5 and biojava-ws 6.0.4 (because trying to use 6.0.5 produces errors):\r\n\r\n```\r\n\u003c!-- https://mvnrepository.com/artifact/org.biojava/biojava --\u003e\r\n\u003cdependency\u003e\r\n \u003cgroupId\u003eorg.biojava\u003c/groupId\u003e\r\n \u003cartifactId\u003ebiojava\u003c/artifactId\u003e\r\n \u003cversion\u003e6.0.5\u003c/version\u003e\r\n \u003ctype\u003epom\u003c/type\u003e\r\n\u003c/dependency\u003e\r\n\u003c!-- https://mvnrepository.com/artifact/org.biojava/biojava-ws --\u003e\r\n\u003cdependency\u003e\r\n \u003cgroupId\u003eorg.biojava\u003c/groupId\u003e\r\n \u003cartifactId\u003ebiojava-ws\u003c/artifactId\u003e\r\n \u003cversion\u003e6.0.4\u003c/version\u003e\r\n\u003c/dependency\u003e\r\n```\r\n\r\nI'm trying to submit blast requests to NCBI. To do this, I have largely followed this guide:\r\nhttps://biojava.org/wiki/BioJava:CookBook3:NCBIQBlastService\r\n\r\nMy relevant code is as follows:\r\n\r\n```\r\nprivate NCBIQBlastAlignmentProperties inputProperties = new NCBIQBlastAlignmentProperties();\r\nprivate NCBIQBlastService service = new NCBIQBlastService();\r\n\r\n...\r\n\r\ninputProperties.setBlastDatabase(\"swissprot\");\r\ninputProperties.setBlastExpect(Double.parseDouble(\"1e-10\"));\r\ninputProperties.setBlastProgram(BlastProgramEnum.blastp);\r\ninputProperties.setAlignmentOption(BlastAlignmentParameterEnum.ENTREZ_QUERY, \"\u003credacted\u003e\"); //Note this redaction is not in my original code.\r\n\r\n...\r\n\r\nSystem.out.println(\"Submitting \" + inputSequences.getSize() + \" requests\");\r\nfor(int i=0; i\u003cinputSequences.getSize(); i++)\r\n{\r\n try\r\n {\r\n rids.add(this.service.sendAlignmentRequest(inputSequences.getSequence(i), inputProperties));\r\n }\r\n catch (Exception e)\r\n {\r\n e.printStackTrace();\r\n }\r\n}\r\n```\r\n\r\nNote that \"rids\" is an ArrayList\u003cString\u003e for storing rid strings and inputSequences is an instance of a class which stores sequence data as String.\r\n\r\nWhen executed, the following error is thrown on each iteration of the for loop:\r\n\r\n```\r\njava.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1\r\nat org.biojava.nbio.ws.alignment.qblast.NCBIQBlastService.sendAlignmentRequest(NCBIQBlastService.java:223)\r\n```\r\n\r\nNote that this error is not being thrown by my code, but by the NCBIQBlastService module. Going to this point in the code leads to the following block in NCBIQBlastService:\r\n\r\n```\r\nBlastJob job = new BlastJob();\r\nString line;\r\nwhile ((line = reader.readLine()) != null) {\r\n if (!line.contains(\"class=\\\"error\\\"\") \u0026\u0026 !line.contains(\"Message ID#\")) {\r\n // if there is no error, capture RID and RTOE\r\n if (line.contains(\"RID = \")) {\r\n String[] arr = line.split(\"=\");\r\n job.setId(arr[1].trim());\r\n } else if (line.contains(\"RTOE = \")) {\r\n String[] arr = line.split(\"=\");\r\n job.setStartTimestamp(System.currentTimeMillis());\r\n job.setExpectedExecutionTime(Long.parseLong(arr[1].trim()) * 1000);\r\n }\r\n jobs.put(job.getId(), job);\r\n } else {\r\n // handle QBlast error message\r\n\r\n // Capture everything to the left of this HTML statement...\r\n String[] tmp = line.split(\"\u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\");\r\n\r\n // Only the error message is on the right side of this...\r\n String[] moreTmp = tmp[0].split(\"\u003cp class=\\\"error\\\"\u003e\");\r\n throw new Exception(\"NCBI QBlast refused this request because: \" + moreTmp[1].trim());\r\n }\r\n\r\n}\r\n```\r\n\r\nSpecifically, the line \"**throw new Exception(\"NCBI QBlast refused this request because: \" + moreTmp[1].trim());**\" is throwing the ArrayIndexOutOfBoundsException. Evidently there is something wrong with my request, hence why I'm getting the error handler, but I can't determine what that reason is is because moreTmp[1] is out of moreTmp's bounds (according to the error message it only has one element). Consequently, the exception the code is trying to throw doesn't get thrown and the reason for the refusal of the request is lost.\r\n","author":{"url":"https://github.com/FC123321","@type":"Person","name":"FC123321"},"datePublished":"2022-06-30T23:45:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1033/biojava/issues/1033"}
route-pattern /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) route-controller voltron_issues_fragments route-action issue_layout fetch-nonce v2:c27163f2-6f17-de3a-f7e7-1ecdcc0acbeb current-catalog-service-hash 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 request-id 94C2:2D3E98:1D6220C:25EFAD2:6974651E html-safe-nonce 502e17a509cec63870b1bbf81a4898bec06ac8cbcc12c33074c6e375e5efc3cd visitor-payload eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NEMyOjJEM0U5ODoxRDYyMjBDOjI1RUZBRDI6Njk3NDY1MUUiLCJ2aXNpdG9yX2lkIjoiODQxMzczMjU4OTc4ODIyNjg0NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 visitor-hmac 5b33bd4117f9488bfef26b03ff1f4e26684245dc0beaef749409c57620dc9014 hovercard-subject-tag issue:1290736808 github-keyboard-shortcuts repository,issues,copilot google-site-verification Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I octolytics-url https://collector.github.com/github/collect analytics-location / fb:app_id 1401488693436528 apple-itunes-app app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/biojava/biojava/1033/issue_layout twitter:image https://opengraph.githubassets.com/6a6faadd7c7d53985eca0b6b2bf578108359fca30e5e8088c8fad414330749d9/biojava/biojava/issues/1033 twitter:card summary_large_image og:image https://opengraph.githubassets.com/6a6faadd7c7d53985eca0b6b2bf578108359fca30e5e8088c8fad414330749d9/biojava/biojava/issues/1033 og:image:alt I am using BioJava through Maven, using biojava 6.0.5 and biojava-ws 6.0.4 (because trying to use 6.0.5 produces errors): og:image:width 1200 og:image:height 600 og:site_name GitHub og:type object og:author:username FC123321 hostname github.com expected-hostname github.com None e0b95d743b7672c9ac0e1032d5f117950182dc164a83434a7db86510e8f0b37c turbo-cache-control no-preview go-import github.com/biojava/biojava git https://github.com/biojava/biojava.git octolytics-dimension-user_id 237402 octolytics-dimension-user_login biojava octolytics-dimension-repository_id 9199359 octolytics-dimension-repository_nwo biojava/biojava octolytics-dimension-repository_public true octolytics-dimension-repository_is_fork false octolytics-dimension-repository_network_root_id 9199359 octolytics-dimension-repository_network_root_nwo biojava/biojava turbo-body-classes logged-out env-production page-responsive disable-turbo false browser-stats-url https://api.github.com/_private/browser/stats browser-errors-url https://api.github.com/_private/browser/errors release 56fe7e2e8de6e57740bca50402351ea656f7a4bf ui-target full theme-color #1e2327 color-scheme light dark
URLs of crawlers that visited me.