{"action":"created","issue":{"url":"https://api.github.com/repos/broadinstitute/gatk/issues/1184","labels_url":"https://api.github.com/repos/broadinstitute/gatk/issues/1184/labels{/name}","comments_url":"https://api.github.com/repos/broadinstitute/gatk/issues/1184/comments","events_url":"https://api.github.com/repos/broadinstitute/gatk/issues/1184/events","html_url":"https://github.com/broadinstitute/gatk/issues/1184","id":118148369,"number":1184,"title":"Explicit codec for FeatureInputs","user":{"login":"vruano","id":791104,"avatar_url":"https://avatars.githubusercontent.com/u/791104?v=3","gravatar_id":"","url":"https://api.github.com/users/vruano","html_url":"https://github.com/vruano","followers_url":"https://api.github.com/users/vruano/followers","following_url":"https://api.github.com/users/vruano/following{/other_user}","gists_url":"https://api.github.com/users/vruano/gists{/gist_id}","starred_url":"https://api.github.com/users/vruano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vruano/subscriptions","organizations_url":"https://api.github.com/users/vruano/orgs","repos_url":"https://api.github.com/users/vruano/repos","events_url":"https://api.github.com/users/vruano/events{/privacy}","received_events_url":"https://api.github.com/users/vruano/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/broadinstitute/gatk/labels/Engine","name":"Engine","color":"5319e7"},{"url":"https://api.github.com/repos/broadinstitute/gatk/labels/enhancement","name":"enhancement","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/broadinstitute/gatk/milestones/6","html_url":"https://github.com/broadinstitute/gatk/milestones/beta","labels_url":"https://api.github.com/repos/broadinstitute/gatk/milestones/6/labels","id":1220228,"number":6,"title":"beta","description":"","creator":{"login":"akiezun","id":1993519,"avatar_url":"https://avatars.githubusercontent.com/u/1993519?v=3","gravatar_id":"","url":"https://api.github.com/users/akiezun","html_url":"https://github.com/akiezun","followers_url":"https://api.github.com/users/akiezun/followers","following_url":"https://api.github.com/users/akiezun/following{/other_user}","gists_url":"https://api.github.com/users/akiezun/gists{/gist_id}","starred_url":"https://api.github.com/users/akiezun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akiezun/subscriptions","organizations_url":"https://api.github.com/users/akiezun/orgs","repos_url":"https://api.github.com/users/akiezun/repos","events_url":"https://api.github.com/users/akiezun/events{/privacy}","received_events_url":"https://api.github.com/users/akiezun/received_events","type":"User","site_admin":false},"open_issues":67,"closed_issues":7,"state":"open","created_at":"2015-07-22T13:38:43Z","updated_at":"2015-12-08T21:18:09Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-11-20T23:25:56Z","updated_at":"2015-12-08T21:43:12Z","closed_at":null,"body":"I would be useful to be able to explicitly indicate the Codec class for a FeatureInputs perhaps using an annotation. \r\n\r\nCurrently the feature manager tries every possible codec hoping to find one and only one that answers yes to the canDecode(FileName) method call. If none does execution fails saying that there is no code available to deal with the input file; if more than one codec returns true then is supposed to throw another error indicating the ambiguity. The former is likely an user cased error whereas the later is rather a bug as Codec developers seems to be responsible to make sure that such a collision never happens...\r\n\r\nThis has a few draw backs:\r\n\r\n* Seems to quasi-force to establish a 1-to-1 assignation of Codecs and file extension names; canDecode documentation encourages use the file name as the way to determine whether the codec can decode or not the file. What if the file is a simple tab separated value file (with some column count and format constrains) and general extensions such as .tab or .tsv seem acceptable names in practice?\r\n\r\n* The error message when there is no supporting code does not tell what the problem is; whether the extension of the file (due to the the 1-to-1 name to type quasi-restriction above) or a more complex formatting issue in the file (e.g. required header missing, version not supported ... blah blah). \r\n\r\n* All codecs are tried out even when most won't ever apply. Even if the performance impact should in practice be minimal still may cause several file IO open operations as several Codec do actually peek into the file (e.g. BCF and VCF codecs). \r\n\r\n* Codec developers have to make sure their new codec does not collides with others; it would be better if codec development can be totally independent.\r\n\r\n* General file extensions such as .tab , .tsv cannot be used by codecs due to possible collisions constraining users to name their files the way GATK needs them to; \"I don't like people telling what file names a have to use... I'm already placing the correct argument name before the file name. What else you need!\"\r\n\r\nProposal:\r\n\r\nAn annotation to tell what codes to try out, the first one that canDecode returns true is used otherwise a configurable error message saying what the problem could be:\r\n\r\n<pre>\r\n@Codecs(BEDCodec.class)\r\nFeatureInput&lt;BEDFeature&gt; features;\r\n</pre>\r\n\r\n<pre>\r\n@Codecs(value = BEDCodec.class, failureMessage = \"The file provided must be a BED formatted file with extension .bed\")\r\nFeatureInput&lt;BEDFeature&gt; features;\r\n</pre>  \r\n\r\n<pre>\r\n@Codecs(BCFCodec.class, VCFCodec.class)\r\nFeatureInput&lt;VariantContext&gt; variants;\r\n</pre>\r\n\r\n<pre>\r\n// force = true, means that canDecode won't be called and instead we try to read the content directly,\r\n// the codec's code is responsible to throw an appropriate UserException.BadInput indicating formatting issues; this should be the case already anyway.\r\n@Codecs(value = TargetCodec.class, force = true)\r\nFeatureInput&lt;Target&gt; target;\r\n</pre>\r\n\r\nIf the annotation is not present it can default to the current behavior. "},"comment":{"url":"https://api.github.com/repos/broadinstitute/gatk/issues/comments/163026831","html_url":"https://github.com/broadinstitute/gatk/issues/1184#issuecomment-163026831","issue_url":"https://api.github.com/repos/broadinstitute/gatk/issues/1184","id":163026831,"user":{"login":"droazen","id":798637,"avatar_url":"https://avatars.githubusercontent.com/u/798637?v=3","gravatar_id":"","url":"https://api.github.com/users/droazen","html_url":"https://github.com/droazen","followers_url":"https://api.github.com/users/droazen/followers","following_url":"https://api.github.com/users/droazen/following{/other_user}","gists_url":"https://api.github.com/users/droazen/gists{/gist_id}","starred_url":"https://api.github.com/users/droazen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/droazen/subscriptions","organizations_url":"https://api.github.com/users/droazen/orgs","repos_url":"https://api.github.com/users/droazen/repos","events_url":"https://api.github.com/users/droazen/events{/privacy}","received_events_url":"https://api.github.com/users/droazen/received_events","type":"User","site_admin":false},"created_at":"2015-12-08T21:43:12Z","updated_at":"2015-12-08T21:43:12Z","body":"Can you give us more details on how the codecs are colliding? Do their `canDecode()` methods claim the same extension(s)?"}}