{"action":"opened","issue":{"url":"https://api.github.com/repos/ilanschnell/bitarray/issues/30","labels_url":"https://api.github.com/repos/ilanschnell/bitarray/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/ilanschnell/bitarray/issues/30/comments","events_url":"https://api.github.com/repos/ilanschnell/bitarray/issues/30/events","html_url":"https://github.com/ilanschnell/bitarray/issues/30","id":96023172,"number":30,"title":"Feature request: Reverse complement","user":{"login":"ohgodwhyyy","id":9166242,"avatar_url":"https://avatars.githubusercontent.com/u/9166242?v=3","gravatar_id":"","url":"https://api.github.com/users/ohgodwhyyy","html_url":"https://github.com/ohgodwhyyy","followers_url":"https://api.github.com/users/ohgodwhyyy/followers","following_url":"https://api.github.com/users/ohgodwhyyy/following{/other_user}","gists_url":"https://api.github.com/users/ohgodwhyyy/gists{/gist_id}","starred_url":"https://api.github.com/users/ohgodwhyyy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ohgodwhyyy/subscriptions","organizations_url":"https://api.github.com/users/ohgodwhyyy/orgs","repos_url":"https://api.github.com/users/ohgodwhyyy/repos","events_url":"https://api.github.com/users/ohgodwhyyy/events{/privacy}","received_events_url":"https://api.github.com/users/ohgodwhyyy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-20T09:24:32Z","updated_at":"2015-07-20T09:24:32Z","closed_at":null,"body":"I use the bitarray module to transform a DNA sequence, that is written in a binary file, to its reverse complement.\r\nEach nucleotide is represented by two bits in the following format: A - 00, C - 01, G - 10, T - 11.\r\n\r\nFor example, the reverse complement of **AGCTACGG (00 10 01 11 00 01 10 10)** would be **CCGTAGCT (01 01 10 11 00 10 01 11)**.\r\nThis sequence takes up exactly 16 bits (2 bytes), but a sequence of length 9 would take 18 bits and it is padded to take up 24 bits (3 bytes).\r\nSo, it would be great, if you could set an offset, which part of the bitarray to transform (since there is no need to modify the padding bits).\r\n\r\nAt the moment, the following steps are needed to transform a bitarray to its reverse compelment:\r\ncopy the bitarray\r\nreverse the bitarray\r\ninvert the bitarray\r\nuse a for cycle to shuffle bits (*e.g.* 01 to 10 and vice versa)\r\n\r\nAnd if the bitarray has padding bits:\r\ncopy the bittaray without padding\r\nreverse the bitarray\r\ninvert the bitarray \r\nuse a for cycle to shuffle bits (*e.g.* 01 to 10 and vice versa)\r\nreverse the bitarray\r\nuse fill() function\r\nreverse the bittaray again\r\n\r\nA reversecomp() feature would make this process much easier and probably a lot faster too."}}