{"action":"created","issue":{"url":"https://api.github.com/repos/mdshw5/pyfaidx/issues/64","labels_url":"https://api.github.com/repos/mdshw5/pyfaidx/issues/64/labels{/name}","comments_url":"https://api.github.com/repos/mdshw5/pyfaidx/issues/64/comments","events_url":"https://api.github.com/repos/mdshw5/pyfaidx/issues/64/events","html_url":"https://github.com/mdshw5/pyfaidx/issues/64","id":72132740,"number":64,"title":"[bug] GATK-bundle - duplicate key?","user":{"login":"huguesfontenelle","id":6872108,"avatar_url":"https://avatars.githubusercontent.com/u/6872108?v=3","gravatar_id":"","url":"https://api.github.com/users/huguesfontenelle","html_url":"https://github.com/huguesfontenelle","followers_url":"https://api.github.com/users/huguesfontenelle/followers","following_url":"https://api.github.com/users/huguesfontenelle/following{/other_user}","gists_url":"https://api.github.com/users/huguesfontenelle/gists{/gist_id}","starred_url":"https://api.github.com/users/huguesfontenelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huguesfontenelle/subscriptions","organizations_url":"https://api.github.com/users/huguesfontenelle/orgs","repos_url":"https://api.github.com/users/huguesfontenelle/repos","events_url":"https://api.github.com/users/huguesfontenelle/events{/privacy}","received_events_url":"https://api.github.com/users/huguesfontenelle/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-30T11:24:06Z","updated_at":"2015-04-30T11:51:20Z","closed_at":null,"body":"I would like to replace pygr with pyfaidx.\r\nPreviously I have been using the `human_g1k_v37_decoy.fasta` file, which is part of the GATK bundle (available through [FTP](http://gatkforums.broadinstitute.org/discussion/1215/how-can-i-access-the-gsa-public-ftp-server)) for getting sequences. I use the same file for alignments.\r\n\r\n```\r\n>>> from pyfaidx import Fasta\r\n>>> genome = Fasta('human_g1k_v37_decoy.fasta')\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/usr/local/lib/python2.7/site-packages/pyfaidx/__init__.py\", line 552, in __init__\r\n    filt_function=filt_function)\r\n  File \"/usr/local/lib/python2.7/site-packages/pyfaidx/__init__.py\", line 209, in __init__\r\n    self.read_fai(split_char)\r\n  File \"/usr/local/lib/python2.7/site-packages/pyfaidx/__init__.py\", line 244, in read_fai\r\n    raise ValueError('Duplicate key \"%s\"' % rname)\r\nValueError: Duplicate key \"['2', 'dna:chromosome', 'chromosome:GRCh37:2:1:243199373:1']\"\r\n```\r\n\r\nThe `human_g1k_v37_decoy.fasta.fai` file does not seem to contain that key twice.\r\n"},"comment":{"url":"https://api.github.com/repos/mdshw5/pyfaidx/issues/comments/97747543","html_url":"https://github.com/mdshw5/pyfaidx/issues/64#issuecomment-97747543","issue_url":"https://api.github.com/repos/mdshw5/pyfaidx/issues/64","id":97747543,"user":{"login":"huguesfontenelle","id":6872108,"avatar_url":"https://avatars.githubusercontent.com/u/6872108?v=3","gravatar_id":"","url":"https://api.github.com/users/huguesfontenelle","html_url":"https://github.com/huguesfontenelle","followers_url":"https://api.github.com/users/huguesfontenelle/followers","following_url":"https://api.github.com/users/huguesfontenelle/following{/other_user}","gists_url":"https://api.github.com/users/huguesfontenelle/gists{/gist_id}","starred_url":"https://api.github.com/users/huguesfontenelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huguesfontenelle/subscriptions","organizations_url":"https://api.github.com/users/huguesfontenelle/orgs","repos_url":"https://api.github.com/users/huguesfontenelle/repos","events_url":"https://api.github.com/users/huguesfontenelle/events{/privacy}","received_events_url":"https://api.github.com/users/huguesfontenelle/received_events","type":"User","site_admin":false},"created_at":"2015-04-30T11:51:20Z","updated_at":"2015-04-30T11:51:20Z","body":"FYI, tests run fine, good job!\r\n```\r\nnosetests --no-skip\r\n..........................................................\r\n----------------------------------------------------------------------\r\nRan 66 tests in 24.230s\r\n\r\nOK\r\n```\r\n\r\nA bit more descriptive errors with iPython:\r\n```\r\nIn [1]: import pyfaidx\r\nIn [3]: g=pyfaidx.Fasta('human_g1k_v37_decoy.fasta')\r\n---------------------------------------------------------------------------\r\nValueError                                Traceback (most recent call last)\r\n<ipython-input-3-21055aca6690> in <module>()\r\n----> 1 g=pyfaidx.Fasta('human_g1k_v37_decoy.fasta')\r\n\r\n/Users/huguesfo/Devel/clones/env-pyfaidx/lib/python2.7/site-packages/pyfaidx/__init__.pyc in __init__(self, filename, default_seq, key_function, as_raw, strict_bounds, read_ahead, mutable, split_char, filt_function)\r\n    550                            default_seq=default_seq, strict_bounds=strict_bounds,\r\n    551                            read_ahead=read_ahead, mutable=mutable, split_char=split_char,\r\n--> 552                            filt_function=filt_function)\r\n    553         self.keys = self.faidx.index.keys\r\n    554         if not self.mutable:\r\n\r\n/Users/huguesfo/Devel/clones/env-pyfaidx/lib/python2.7/site-packages/pyfaidx/__init__.pyc in __init__(self, filename, default_seq, key_function, as_raw, strict_bounds, read_ahead, mutable, split_char, filt_function)\r\n    207 \r\n    208         if os.path.exists(self.indexname) and getmtime(self.indexname) > getmtime(self.filename):\r\n--> 209             self.read_fai(split_char)\r\n    210         else:\r\n    211             try:\r\n\r\n/Users/huguesfo/Devel/clones/env-pyfaidx/lib/python2.7/site-packages/pyfaidx/__init__.pyc in read_fai(self, split_char)\r\n    242                 for key in rname:\r\n    243                     if key in self.index and not split_char:\r\n--> 244                         raise ValueError('Duplicate key \"%s\"' % rname)\r\n    245                     elif key in self.index and split_char:\r\n    246                         duplicate_ids.append(key)\r\n\r\nValueError: Duplicate key \"['2', 'dna:chromosome', 'chromosome:GRCh37:2:1:243199373:1']\"\r\n```\r\n\r\n"}}