# Output NC_045512, the first sequenced genome of SARS-CoV-2 (COVID-19) [closed]

Output the variant NC_045512 of SARS-CoV-2. The genome's raw form is available here.

• Lowercase and uppercase are both acceptable
• You must output with the letters A, C, T, and G.
• An arbitrary number of newlines are allowed any place in the output, it does not matter.
• Standard PPCG loopholes are in force.
• Special Rule: To make it easier to golf, you may define an X-bit encoding for a particular contiguous section of your program. If you use all ASCII charactters in one part of your program, each character costs only 7 bits. The Python program a="11001100" could count for only 5 bytes, because the single section "11001100" counts for just one byte.

This is , so the shortest answer in bytes wins.

For reference, 7-Zip manages (with PPMd as the algorithm) to squeeze the genome into 8,149 bytes, so your program should aim to be shorter than that.

• Are you sure this was actually sniped, as opposed to 2 people coming up with the same idea independently of each other? Jun 10 '20 at 1:30
• @ppery It may have been developed independently, I have no idea. But a search would have shown my Sandbox entry. And this challenge wasn't posted in the Sandbox first, which I did. Once you post in the Sandbox, you should have dibs on the challenge (just like any duplicate). If we don't do that, nobody will post in the Sandbox first, because they'll be wary of being undercut. Jun 10 '20 at 1:32
• I’m voting to close this question because this is a near-duplicate of a recent post in the Sandbox, and posting in the Sandbox first is the recommended procedure. Jun 10 '20 at 1:35
• I see no reason why users should be expected to search the sandbox for any possible duplicates of a question they are about to ask. Jun 10 '20 at 1:48
• With the question over priority in the background, I don't want to lose sight of another issue, which is the "special rule" for scoring on this challenge. It's not at all clear how this would be implemented -- is the answerer supposed to check every partition of the program into sections to see what the reduced score would be? I think a score for any challenge should be easily determinable in an automated manner. Jun 10 '20 at 2:22

# Python 2, 51 bytes

s=len('...')
t=''
while s:t='tacg'[s%4]+t;s/=4
print t


Try it online!

Substitute the '...' on the first line with the unary encoding of the genome in base 4, which can be produced using the following program:

s=raw_input()
s=['tacg'.index(c) for c in s]
print reduce(lambda x,y: x*4+y,s)


Try it online!

The unary encoding part is supposed to count as 0 bytes due to the special rule. I'm posting this to show how broken that rule is.

• The "special rule" was reworded. This may change the score of this answer. Jun 10 '20 at 15:13

# Ruby -p, 11,799 bytes

NOTE: I've posted an almost identical answer to an almost identical question here. There is dispute over which question has priority. I've posted answers to both questions simply to claim my own priority as an answerer.

### Decoder (365 bytes):

gsub(/./){|i|Hash[[*32..51,*58..96,112,113,*115..121,*123..126].map(&:chr).zip(%w[45 46 47 49 4a 4b 4f 4j 54 56 57 58 5a 5b 5c 5f 5g 5j 64 65 67 68 69 6b 6c 6f 74 75 76 78 79 7a 7c 7e 85 86 87 89 8a 8b 8f 94 96 97 98 9b a4 a5 a7 a8 ab b4 b5 b6 b8 b9 ba bc c5 c6 c7 cb d7 e7 f4 f5 f6 f8 g6 g7 j4 j6])][i]||i};$_=$_.chars.map{|i|'ACGT'[(j=i.to_i 36)%4].*j/4}*''+?A*33


### Input (11,434 bytes):

%cav@Sd4VHc9KHw2AA[@2ABZAF)HfgABBE*:(*,*3"3Y:3 A 3!@C\C*M BA=2(T()!C*)A@AZB(UB- af)D:=3!P"(A!((A@af)Du:2PcaC2E!!S:taf+)!g5  :R*(?<B}(X)) :3A: :Ufa! D:TTV-"(2U :+(A_2E(-:UY:!I[ka)~Q+-;(6d@BB0Z".)ZTB*)HB(Q(EA"="X23E@3!HA;U%(: V)@:V22(-V:S:t(BG)q#!E-#3LZZZ:IHVJca!*Va9"!Y,)P"*pA&2-$) 23^(*2DYBI'+6g*W(*"!(:V=4d:;*(B)B!-HTi5" A3@BA2C+-*:adB"U@t-2:3%p#Z@3 :3EF3Z"3 xD;+*T/%2(*I4iB@@*3BPBH"23">[-V W)ZB{!*";[(2(9j>_^.>x #ZJi8BDcj:&dbsOCAI @ZK8e[{k6-2E/"u!M)"*:*"O=3:(9cBJ3Kq:<wHAA";::2A%:V>-(E(25e)'=pO-3;~E(*2;x F;V< @-:X YhgB*==gf%:O3":(+Z!I@TQ23"!A[PJ#"J;AE-6gOZZ:8eEA3 @[9fTUBBBZAYB^[OC+::<@be] :3@33C(@X:K"$B[^!L];V-J2+S->@*9k2>:+(AJ%=V2/\BI!")OYja(An5B-O+:3~EBBcafa%"p(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try it online!

## How does it work?

The original DNA sequence is encoded in two steps to create the input string.

1. Observe that, apart from the pesky run of 33 As at the very end of the DNA sequence (which we deal with separately), no DNA base appears more than 8 times consecutively. We can therefore use a single base-32 digit to encode a run of any of the four DNA bases. Actually a base-36 digit (coincidentally the largest natively supported radix) is preferred here to allow us to take advantage of 1-indexing. The resulting compressed string is 21,826 bytes (unfortunately too long to include in the answer). For each digit $$\i\$$, $$\i\bmod 4\$$ indexes the DNA base (A, C, G, or T) and $$\\lfloor i/4\rfloor\$$ gives the number of repetitions of that base (1-indexed) at that position in the sequence. This base-36 encoded string is about 27 % shorter than the original DNA sequence.

2. Taking a quick glance at the base-36 string, we see that there are pairs of digits that appear frequently. (Here, pairs are counted beginning with the first character of the string; starting with the second character results in marginally worse compression. Each digit counts towards exactly one pair.) The most common pair, 76 (representing the sequence UG, aptly enough), occurs 687 times. There are six other pairs that occur more than 500 times, and 189 different pairs in total. This observation motivates a second compression step in which pairs of digits are replaced by single bytes. There are 72 one-byte printable ASCII characters that do not appear in the base-36 string (most because they are not base-36 digits, the exceptions being p, q, sy, and 03). We therefore associate each of the 72 most frequently occurring pairs in the base-36 string with a unique single-byte character and then use this mapping to further compress the string. The result is the input string given above, which is more than 60 % shorter than the original DNA sequence.

The decoding program simply reverses the encoding process, and then tacks 33 As back on at the end.

• I'd encourage you to post this in the other challenge as well, which I have moved from the Sandbox to the main site. Jun 10 '20 at 1:51