From 8fdcc3a9bc46f0ba21c4b9fab4618c4b4ef1f64b Mon Sep 17 00:00:00 2001 From: aviczhl2 Date: Wed, 19 Jul 2023 10:13:46 +0800 Subject: [PATCH] new file: automated-issue-ref.ipynb --- automated-issue-ref.ipynb | 390 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 390 insertions(+) create mode 100755 automated-issue-ref.ipynb diff --git a/automated-issue-ref.ipynb b/automated-issue-ref.ipynb new file mode 100755 index 00000000..3a07f85a --- /dev/null +++ b/automated-issue-ref.ipynb @@ -0,0 +1,390 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "f64573a2", + "metadata": {}, + "outputs": [], + "source": [ + "# automated ref adding for lineage-note.txt, written by Xu Zou\n", + "import bs4\n", + "from bs4 import BeautifulSoup\n", + "from urllib import request\n", + "\n", + "# the number of milestone we start to read\n", + "start_milestone=1\n", + "\n", + "def read_milestone(num):\n", + " # or sars-cov-2 proj if it starts to add milestones\n", + " url=\"https://github.com/cov-lineages/pango-designation/milestone/\"+str(num)\n", + " res=request.urlopen(url)\n", + " rp=res.read()\n", + " rp=rp.decode('utf-8')\n", + " html_soup=BeautifulSoup(rp,\"html\")\n", + " title=html_soup.title\n", + " title=title.text\n", + " title=title.split()[0]\n", + " return title.split()[0]\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "id": "769f2d32", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reading Milestone 10\n", + "Reading Milestone 20\n", + "Reading Milestone 30\n", + "Reading Milestone 40\n", + "Reading Milestone 50\n", + "Reading Milestone 60\n", + "Reading Milestone 70\n", + "Reading Milestone 80\n", + "Reading Milestone 90\n", + "Reading Milestone 100\n", + "Reading Milestone 110\n", + "Reading Milestone 120\n", + "Reading Milestone 130\n", + "Reading Milestone 140\n", + "Reading Milestone 150\n", + "Reading Milestone 160\n", + "Reading Milestone 170\n", + "Reading Milestone 180\n", + "Reading Milestone 190\n", + "Reading Milestone 200\n", + "Reading Milestone 210\n", + "Reading Milestone 220\n", + "Reading Milestone 230\n", + "Reading Milestone 240\n", + "Reading Milestone 250\n", + "Reading Milestone 260\n", + "Reading Milestone 270\n", + "Reading Milestone 280\n", + "Reading Milestone 290\n", + "Reading Milestone 300\n", + "Reading Milestone 310\n", + "Reading Milestone 320\n", + "Reading Milestone 330\n", + "Reading Milestone 340\n", + "Reading Milestone 350\n", + "Reading Milestone 360\n", + "Reading Milestone 370\n", + "Reading Milestone 380\n", + "Reading Milestone 390\n", + "Reading Milestone 400\n", + "Reading Milestone 410\n", + "Reading Milestone 420\n", + "Reading Milestone 430\n", + "Reading Milestone 440\n", + "Reading Milestone 450\n", + "Reading Milestone 460\n", + "Reading Milestone 470\n", + "Reading Milestone 480\n", + "Reading Milestone 490\n", + "Reading Milestone 500\n", + "Reading Milestone 510\n", + "Reading Milestone 520\n", + "Reading Milestone 530\n", + "Reading Milestone 540\n", + "Reading Milestone 550\n", + "Reading Milestone 560\n", + "Reading Milestone 570\n", + "Reading Milestone 580\n", + "Reading Milestone 590\n", + "Reading Milestone 600\n", + "Reading Milestone 610\n", + "Reading Milestone 620\n", + "Reading Milestone 630\n", + "Reading Milestone 640\n", + "Reading Milestone 650\n", + "Reading Milestone 660\n", + "Reading Milestone 670\n", + "Reading Milestone 680\n", + "Reading Milestone 690\n", + "Reading Milestone 700\n", + "Reading Milestone 710\n", + "Reading Milestone 720\n", + "Reading Milestone 730\n", + "Reading Milestone 740\n", + "Reading Milestone 750\n", + "Reading Milestone 760\n", + "Reading Milestone 770\n", + "Reading Milestone 780\n", + "Reading Milestone 790\n", + "796 HTTP Error 404: Not Found\n", + "[[1, 'C.1'], [2, 'B.1.429'], [3, 'B.1.525'], [4, 'B.1.526'], [5, 'B.1.1.316'], [6, 'A.27'], [7, 'R.1'], [8, 'R.2'], [9, 'B.1.1.318'], [10, 'A.28'], [11, 'B.1.214.2'], [12, 'B.1.214.1'], [13, 'B.1.324.1'], [14, 'P.3'], [15, 'B.1.466.2'], [16, 'N.9'], [17, 'B.1.616'], [18, 'C.2.1'], [19, 'B.1.243.1'], [20, 'B.1.617'], [21, 'P.1.1'], [22, 'B.1.214.3'], [23, 'B.1.214.4'], [24, 'B.1.429.1'], [25, 'A.2.5.1'], [26, 'N.10'], [27, 'B.1.177.88'], [28, 'B.1.618'], [29, 'B.1.1.29'], [30, 'AT.1'], [31, 'B.1.619'], [32, 'B.1.620'], [33, 'B.1.438'], [34, 'C.37'], [35, 'B.1.621'], [36, 'B.1.622'], [37, 'P.1.2'], [38, 'XA'], [39, 'B.1.575'], [40, 'B.1.575.1'], [41, 'B.1.351.3'], [42, 'AV.1'], [43, 'B.1.623'], [44, 'B.1.553'], [45, 'B.1.608'], [46, 'B.1.1.523'], [47, 'P.1'], [48, 'A.29'], [49, 'P.4'], [50, 'C.36.3'], [51, 'AW.1'], [52, 'B.1.617.1'], [53, 'AY.1'], [54, 'AY.2'], [55, 'B.1.1.524'], [56, 'P.5'], [57, 'B.1.624'], [58, 'B.1.625'], [59, 'B.1.400.1'], [60, 'B.1.575.2'], [61, 'B.1.626'], [62, 'B.1.617.2'], [63, 'AY.3'], [64, 'B.1.621.1'], [65, 'B.1.627'], [66, 'B.1.629'], [67, 'B.1.1.519'], [68, 'B.1.351.4'], [69, 'A.30'], [70, 'B.1.630'], [71, 'C.1.2'], [72, 'P.1.3'], [73, 'AY.3.1'], [74, 'B.1.631'], [75, 'P.6'], [76, 'B.1.619.1'], [77, 'B.1.628'], [78, 'C.38'], [79, 'B.1.632'], [80, 'B.1.633'], [81, 'B.1.415.1'], [82, 'C.37.1'], [83, 'B.1.634'], [84, 'P.7'], [85, 'B.1.1.317'], [86, 'Q.1'], [87, 'Q.2'], [88, 'Q.3'], [89, 'A.2.5.3'], [90, 'AZ.1'], [91, 'AY.11'], [92, 'AY.12'], [93, 'Q.4'], [94, 'B.1.636'], [95, 'P.1.9'], [96, 'P.1.10'], [97, 'AY.4'], [98, 'AY.23'], [99, 'P.1.8'], [100, 'C.39'], [101, 'AY.25'], [102, 'B.1.637'], [103, 'Q.5'], [104, 'B.1.1.528'], [105, 'Q.8'], [106, 'Q.6'], [107, 'AY.13'], [108, 'B.1.243.2'], [109, 'AY.26'], [110, 'AY.27'], [111, 'AY.28'], [112, 'B.59'], [113, 'C.40'], [114, 'B.1.638'], [115, 'AY.29'], [116, 'AY.30'], [117, 'AY.31'], [118, 'AY.32'], [119, 'AY.33'], [120, 'B.1.351.5'], [121, 'P.1.12'], [122, 'AY.4.1'], [123, 'AY.34'], [124, 'AY.36'], [125, 'AY.37'], [126, 'AY.38'], [127, 'AY.4.2'], [128, 'AY.4.3'], [129, 'AY.29.1'], [130, 'AY.39'], [131, 'P.1.13'], [132, 'AY.4.4'], [133, 'AY.4.5'], [134, 'AY.42'], [135, 'AY.43'], [136, 'AY.44'], [137, 'AY.45'], [138, 'AY.46'], [139, 'AY.47'], [140, 'AY.102'], [141, 'AY.39.2'], [142, 'AY.66'], [143, 'AY.69'], [144, 'AY.63'], [145, 'AY.104'], [146, 'AY.99'], [147, 'AY.106'], [148, 'B.1.639'], [149, 'AY.4.2.1'], [150, 'AY.121'], [151, 'B.1.640'], [152, 'AY.122'], [153, 'AY.20.1'], [154, 'AY.43.1'], [155, 'AY.99.1'], [156, 'AY.99.2'], [157, 'AY.99'], [158, 'XB'], [159, 'AY.123'], [160, 'AY.124'], [161, 'B.1.1.529'], [162, 'AY.43.3'], [163, 'AY.125'], [164, 'AY.43.4'], [165, 'AY.121'], [166, 'AY.4.2.2'], [167, 'AY.126'], [168, 'AY.34.1'], [169, 'XC'], [170, 'AY.4.6'], [171, 'AY.23.2'], [172, 'AY.34.2'], [173, 'AY.4.2.3'], [174, 'AY.25.1'], [175, 'AY.127'], [176, 'AY.119.1'], [177, 'AY.43.5'], [178, 'BA.1'], [179, 'B.1.640.1'], [180, 'B.1.637.1'], [181, 'AY.124.1'], [182, 'AY.5.5'], [183, 'AY.26.1'], [184, 'AY.122.2'], [185, 'AY.112'], [186, 'AY.9.2.2'], [187, 'AY.119.2'], [188, 'AY.4.7'], [189, 'AY.4.8'], [190, 'AY.39.1.2'], [191, 'AY.128'], [192, 'AY.3.2'], [193, 'AY.25.1.1'], [194, 'AY.43.6'], [195, 'AY.102.1'], [196, 'P.1.7.1'], [197, 'AY.129'], [198, 'BA.3'], [199, 'BB.1'], [200, 'AY.102.2'], [201, 'AY.42.1'], [202, 'AY.39.1.3'], [203, 'AY.130'], [204, 'AY.127.1'], [205, 'AY.123.1'], [206, 'AY.3.3'], [207, 'AY.46.6.1'], [208, 'AY.33.1'], [209, 'AY.122.3'], [210, 'P.1.12.1'], [211, 'AY.131'], [212, 'AY.4.9'], [213, 'AY.43.7'], [214, 'AY.132'], [215, 'AY.133'], [216, 'BA.1.1'], [217, 'AY.36.1'], [218, 'BA.2.2'], [219, 'XD'], [220, 'XE'], [221, 'XF'], [222, 'AY.29.2'], [223, 'XG'], [224, 'XH'], [225, 'XJ'], [226, 'XK'], [227, 'XL'], [228, 'BA.2.8'], [229, 'BA.1.18'], [230, 'BA.1.19'], [231, 'AY.112.2'], [232, 'B.1.641'], [233, 'XM'], [234, 'AY.5.7'], [235, 'BA.1.17.2'], [236, 'BA.2.9'], [237, 'XN'], [238, 'BA.2.3.1'], [239, 'BA.2.10'], [240, 'XP'], [241, 'XQ'], [242, 'XR'], [243, 'XS'], [244, 'AY.112.3'], [245, 'AY.122.6'], [246, 'BA.2.11'], [247, 'AY.127.3'], [248, 'BA.4'], [249, 'BA.2.12'], [250, 'BA.2.9.1'], [251, 'BA.2.13'], [252, 'BA.1.20'], [253, 'BA.1.21'], [254, 'BA.1.21.1'], [255, 'BA.1.14.1'], [256, 'BA.1.15.2'], [257, 'AY.33.2'], [258, 'AY.39.4'], [259, 'BA.1.1.17'], [260, 'XT'], [261, 'AY.4.2.5'], [262, 'BA.2.14'], [263, 'BA.2.15'], [264, 'BA.2.16'], [265, 'AY.39.1.4'], [266, 'BA.2.17'], [267, 'XU'], [268, 'BA.2.18'], [269, 'BA.1.22'], [270, 'BA.2.19'], [271, 'BA.2.20'], [272, 'BA.2.21'], [273, 'BA.2.22'], [274, 'BA.2.23'], [275, 'BA.2.3.3'], [276, 'BA.3.1'], [277, 'BA.2.35'], [278, 'BA.2.36'], [279, 'BA.2.24'], [280, 'BA.2.37'], [281, 'BA.2.39'], [282, 'BA.2.38'], [283, 'BA.2.23.1'], [284, 'BA.2.40'], [285, 'BA.2.40.1'], [286, 'BA.2.10.2'], [287, 'BA.2.41'], [288, 'XV'], [289, 'XW'], [290, 'AY.98.1.1'], [291, 'BA.2.10.3'], [292, 'XY'], [293, 'BA.2.42'], [294, 'BA.2.43'], [295, 'BA.2.44'], [296, 'BA.4.1'], [297, 'BA.2.45'], [298, 'BA.5.2'], [299, 'BA.5.3'], [300, 'BA.2.46'], [301, 'BA.2.3.5'], [302, 'BA.5.4'], [303, 'BE.1'], [304, 'BA.2.9.3'], [305, 'BA.2.47'], [306, 'BA.2.3.6'], [307, 'BA.2.48'], [308, 'BA.5.2.1'], [309, 'BF.1'], [310, 'BA.2.9.4'], [311, 'XZ'], [312, 'BA.2.49'], [313, 'BA.2.3.7'], [314, 'BA.2.50'], [315, 'BA.2.51'], [316, 'BA.2.52'], [317, 'BA.2.53'], [318, 'BA.5.5'], [319, 'BA.2.54'], [320, 'BA.2.55'], [321, 'BA.1.23'], [322, 'XAA'], [323, 'XAB'], [324, 'BA.1.24'], [325, 'BA.4.1.1'], [326, 'BA.2.56'], [327, 'BA.2.59'], [328, 'XAC'], [329, 'BA.2.12.2'], [330, 'BA.2.71'], [331, 'BA.2.72'], [332, 'BA.2.60'], [333, 'BD.1'], [334, 'BA.2.3.11'], [335, 'BC.2'], [336, 'BA.1.15.3'], [337, 'XAD'], [338, 'BA.4.1.2'], [339, 'BA.5.3.2'], [340, 'BA.2.73'], [341, 'XAE'], [342, 'BA.2.2.1'], [343, 'XAF'], [344, 'BA.2.56.1'], [345, 'XAG'], [346, 'BA.2.3.16'], [347, 'BA.2.3.17'], [348, 'BG.1'], [349, 'BA.2.3.18'], [350, 'XAH'], [351, 'BG.2'], [352, 'BA.2.74'], [353, 'BA.2.75'], [354, 'BG.3'], [355, 'BF.4'], [356, 'BA.5.1.2'], [357, 'BA.5.1.3'], [358, 'BA.2.76'], [359, 'BE.3'], [360, 'BA.2.77'], [361, 'BA.4.6'], [362, 'BA.5.1.4'], [363, 'BA.2.38.1'], [364, 'BA.2.79'], [365, 'BA.2.80'], [366, 'BA.4.7'], [367, 'BA.2.13.1'], [368, 'BF.6'], [369, 'BA.2.3.19'], [370, 'BF.7'], [371, 'BA.5.1.5'], [372, 'XAJ'], [373, 'XAK'], [374, 'BA.2.38.2'], [375, 'BA.5.8'], [376, 'BA.5.9'], [377, 'BF.11'], [378, 'BA.2.36.1'], [379, 'BF.3.1'], [380, 'BF.12'], [381, 'BG.5'], [382, 'BA.4.1.8'], [383, 'XAL'], [384, 'XAM'], [385, 'XAN'], [386, 'XAP'], [387, 'BG.6'], [388, 'XAQ'], [389, 'BA.5.1.9'], [390, 'BA.2.75.1'], [391, 'BA.2.38.3'], [392, 'BH.1'], [393, 'BA.2.9.6'], [394, 'BJ.1'], [395, 'BE.1.2'], [396, 'BA.2.10.4'], [397, 'BA.2.76.1'], [398, 'BF.13'], [399, 'BA.5.6.2'], [400, 'BF.14'], [401, 'BA.5.5.1'], [402, 'BK.1'], [403, 'BA.5.10'], [404, 'BA.5.1.11'], [405, 'XAR'], [406, 'BA.2.75.2'], [407, 'BA.2.76.2'], [408, 'BA.5.2.6'], [409, 'BA.2.75.3'], [410, 'BA.5.2.7'], [411, 'BF.15'], [412, 'BA.4.8'], [413, 'BL.1'], [414, 'XAS'], [415, 'BA.5.1.13'], [416, 'XAT'], [417, 'XAU'], [418, 'XAV'], [419, 'BF.16'], [420, 'BA.5.1.12'], [421, 'BE.1.1.1'], [422, 'XAW'], [423, 'XAY'], [424, 'XAZ'], [425, 'BA.5.6'], [426, 'BA.4.1.9'], [427, 'BA.5.1.18'], [428, 'BA.5.5.2'], [429, 'BF.22'], [430, 'BA.2.3.20'], [431, 'BN.1'], [432, 'BP.1'], [433, 'BA.5.5.3'], [434, 'BQ.1'], [435, 'BN.2'], [436, 'BA.5.1.19'], [437, 'BA.4.6.1'], [438, 'BA.5.2.13'], [439, 'BM.4'], [440, 'BM4.1'], [441, 'BM.4'], [442, 'BA.5.1.20'], [443, 'BA.5.2.14'], [444, 'BQ.1'], [445, 'BS.1'], [446, 'BA.5.2.15'], [447, 'BA.5.1.21'], [448, 'XAY'], [449, 'BA.5.2.17'], [450, 'BF.23'], [451, 'BA.5.2.16'], [452, 'BA.5.2.18'], [453, 'BL.1.1'], [454, 'BL.1.2'], [455, 'XBB'], [456, 'BR.2'], [457, 'BA.5.10.1'], [458, 'BA.2.83'], [459, 'BA.5.2.19'], [460, 'BM.5'], [461, 'BM.1.1.1'], [462, 'BA.2.84'], [463, 'BA.2.31.1'], [464, 'BA.2.31.1'], [465, 'BA.5.2.22'], [466, 'BA.2.75.8'], [467, 'BA.5.2.23'], [468, 'BE.1.2.1'], [469, 'BR.2'], [470, 'XBC'], [471, 'BA.5.2.25'], [472, 'BA.5.2.26'], [473, 'BA.5.1.22'], [474, 'BF.26'], [475, 'BF.27'], [476, 'BF.28'], [477, 'BS.1.1'], [478, 'BA.2.75.9'], [479, 'BA.2.85'], [480, 'BA.5.2.29'], [481, 'BE.4'], [482, 'BA.5.1.26'], [483, 'CG.1'], [484, 'XBB.1'], [485, 'XBC.1'], [486, 'BF.7.1'], [487, 'BA.5.3.5'], [488, 'BA.5.1.29'], [489, 'BQ.1.8'], [490, 'BA.5.6.3'], [491, 'BG.7'], [492, 'BA.4.6.2'], [493, 'BE.4.2'], [494, 'BA.4.6.3'], [495, 'CH.1'], [496, 'CJ.1'], [497, 'BV.2'], [498, 'CK.1'], [499, 'CL.1'], [500, 'CM.1'], [501, 'BR.4'], [502, 'CN.1'], [503, 'BA.5.2.34'], [504, 'XBD'], [505, 'BA.2.38.4'], [506, 'BF.29'], [507, 'BF.7.2'], [508, 'BQ.1.10.1'], [509, 'BN.1.1'], [510, 'CA.3'], [511, 'XAY.1'], [512, 'BT.2'], [513, 'BA.5.6.4'], [514, 'BA.5.2.37'], [515, 'BQ.1.1.2'], [516, 'BF.7.7'], [517, 'BN.1.2.1'], [518, 'XBB.4'], [519, 'CK.2'], [520, 'CQ.2'], [521, 'CK.2.1'], [522, 'XBE'], [523, 'BY.1.2.1'], [524, 'BA.5.2.36'], [525, 'BN.1.3.1'], [526, 'BF.7.4.1'], [527, 'BF.32'], [528, 'CY.1'], [529, 'BA.2.9.7'], [530, 'BL.5'], [531, 'XAY.1.1'], [532, 'XBF'], [533, 'DD.1'], [534, 'BE.5'], [535, 'BE.7'], [536, 'BE.8'], [537, 'BA.5.11'], [538, 'BA.5.2.39'], [539, 'DB.1'], [540, 'BA.5.2.38'], [541, 'BQ.1.24'], [542, 'DF.1'], [543, 'BF.34'], [544, 'DG.1'], [545, 'DH.1'], [546, 'BR.2.1'], [547, 'CA.4'], [548, 'BE.9'], [549, 'BN.1.7'], [550, 'BQ.1.26'], [551, 'BF.7.5.1'], [552, 'BA.5.2.41'], [553, 'CK.3'], [554, 'XBG'], [555, 'BA.5.1.31'], [556, 'XBH'], [557, 'CM.2.1'], [558, 'BW.1.1'], [559, 'DJ.1'], [560, 'BA.5.2.42'], [561, 'XBB.1.4.1'], [562, 'BA.5.2.43'], [563, 'BN.1.9'], [564, 'BQ.1.1.25'], [565, 'XBJ'], [566, 'CH.3'], [567, 'BA.5.2.45'], [568, 'BQ.1.26.1'], [569, 'CV.2'], [570, 'DJ.1.2'], [571, 'CM.5.1'], [572, 'CM.5.2'], [573, 'CN.2'], [574, 'CJ.1.1'], [575, 'BE.10'], [576, 'XBK'], [577, 'CH.3.1'], [578, 'CH.1.1.3'], [579, 'XBB.1.6'], [580, 'CR.1.3'], [581, 'BF.10.1'], [582, 'BQ.1.25.1'], [583, 'BN.1.3.2'], [584, 'DJ.1.3'], [585, 'DN.1.1'], [586, 'BQ.1.13.1'], [587, 'BF.5.1'], [588, 'BF.5.2'], [589, 'CK.1.1'], [590, 'BA.5.2.46'], [591, 'BQ.1.28'], [592, 'BQ.1.1.32'], [593, 'DF.1.1'], [594, 'BA.5.2.47'], [595, 'XBB.1.5'], [596, 'BF.7.14'], [597, 'BA.5.2.48'], [598, 'XBB.1.8'], [599, 'BL.6'], [600, 'CH.1.1.4'], [601, 'BF.7.15'], [602, 'XBL'], [603, 'CM.11'], [604, 'DT.1'], [605, 'BQ.1.1.34'], [606, 'CM.12'], [607, 'CK.1.2'], [608, 'BA.2.3.22'], [609, 'xbm'], [610, 'XBM'], [611, 'BM.1.1.4'], [612, 'BN.1.4.1'], [613, 'BA.5.2.49'], [614, 'DU.1'], [615, 'CH.1.1.5'], [616, 'XBN'], [617, 'BA.5.1.32'], [618, 'BA.5.2.50'], [619, 'DW.1'], [620, 'BQ.1.1.37'], [621, 'BQ.1.1.38'], [622, 'BF.7.14.1'], [623, 'BQ.1.11.1'], [624, 'BR.5'], [625, 'BQ.1.1.39'], [626, 'BQ.1.2.1'], [627, 'BF.7.14.3'], [628, 'BQ.1.1.45'], [629, 'DY.1'], [630, 'BQ.1.1.41'], [631, 'XBP'], [632, 'DN.1.1.1'], [633, 'CM.6.1'], [634, 'xbb.2.3'], [635, 'XBB.6.1'], [636, 'XBB.1.11'], [637, 'XBB.2.3'], [638, 'DY.1.1'], [639, 'DJ.1.1.1'], [640, 'BN.1.3.5'], [641, 'XBB.2.3'], [642, 'DT.2'], [643, 'BA.4.1.11'], [644, 'DL.1'], [645, 'BF.5.3'], [646, 'XBB.1.5.10'], [647, 'XBB.1.13'], [648, 'BQ.1.1.50'], [649, 'BQ.1.1.70'], [650, 'EA.1'], [651, 'BQ.1.1.60'], [652, 'BA.5.2.63'], [653, 'XBQ'], [654, 'EG.1'], [655, 'XBR'], [656, 'XBS'], [657, 'XBT'], [658, 'EH.1'], [659, 'DY.2'], [660, 'EK.1'], [661, 'DV.4'], [662, 'XBK.1'], [663, 'BA.5.2.64'], [664, 'DB.3'], [665, 'BA.5.12'], [666, 'DV.3.1'], [667, 'BF.7.14.7'], [668, 'EN.1'], [669, 'XBC.1.5'], [670, 'EQ.1'], [671, 'CY.2'], [672, 'CP.7'], [673, 'BQ.1.1.71'], [674, 'XBB.1.16'], [675, 'ER.1'], [676, 'ER.1.1'], [677, 'ES.1'], [678, 'CH.1.1.15'], [679, 'BF.7.4.3'], [680, 'BQ.1.32'], [681, 'ET.1'], [682, 'XBC.1.6'], [683, 'XBB.1.5.25'], [684, 'XBU'], [685, 'XBB.1.19'], [686, 'XBB.1.19.1'], [687, 'XBV'], [688, 'DV.1.1'], [689, 'XBW'], [690, 'XBY'], [691, 'XBB.1.5.26,'], [692, 'XBF.8.1'], [693, 'XBB.1.21'], [694, 'XBC.2.1'], [695, 'XBB.1.22,'], [696, 'XBJ.1.1'], [697, 'XBB.1.27'], [698, 'CH.1.1.16'], [699, 'EW.1'], [700, 'FF.1'], [701, 'CP.8.1'], [702, 'EK.3'], [703, 'FB.1'], [704, 'XBB.2.3.2'], [705, 'CM.8.1.4'], [706, 'XBB.2.3.1'], [707, 'BN.1.3.9'], [708, 'XBZ'], [709, 'CH.1.1.22'], [710, 'EZ.1'], [711, 'FK.1'], [712, 'BQ.1.1.73'], [713, 'XCA'], [714, 'XBB.1.28'], [715, 'BQ.1.1.74'], [716, 'XBB.1.31'], [717, 'XBB.2.3.3'], [718, 'FP.1'], [719, 'BF.42'], [720, 'CH.1.1.23'], [721, 'XBB.2.3.5'], [722, 'FK.1.1'], [723, 'XBB.2.3.4'], [724, 'XCB'], [725, 'FQ.1'], [726, 'XBB.1.33'], [727, 'XBB.1.34'], [728, 'FL.1'], [729, 'FR.1'], [730, 'FS.1'], [731, 'XBF.1.1'], [732, 'FT.1'], [733, 'XBB.1.5.41'], [734, 'XBB.1.5.42'], [735, 'EG.5'], [736, 'XBB.1.5.44'], [737, 'XAY.2.3'], [738, 'XBB.1.36'], [739, 'XCC'], [740, 'XBB.1.5.53'], [741, 'XBB.1.16.2'], [742, 'BQ.1.2.2'], [743, 'XBB.1.5.30'], [744, 'EG.1.2'], [745, 'FY.2'], [746, 'FY.4'], [747, 'XBB.1.16.4'], [748, 'XBB.1.5.57'], [749, 'XBB.1.16.5'], [750, 'GB.1'], [751, 'XBB.1.37'], [752, 'FL.11'], [753, 'XBB.1.32.1'], [754, 'XBB.1.32'], [755, 'XBB.2.9'], [756, 'XBB.1.5.45'], [757, 'XBB.1.5.70'], [758, 'GF.1'], [759, 'XBB.1.41'], [760, 'FL.15'], [761, 'FL.13.1'], [762, 'FP.'], [763, 'FP.3'], [764, 'FR.1.2'], [765, 'FR.1.1'], [766, 'XBB.1.43'], [767, 'XBB.1.42'], [768, 'EG.6.1'], [769, 'GJ.1'], [770, 'XCD'], [771, 'DV.6.2'], [772, 'DV.7'], [773, 'XBB.1.44.1'], [774, 'FL.2.3'], [775, 'FY.5'], [776, 'XBB.1.6.10'], [777, 'FL.16'], [778, 'GR.1'], [779, 'GB.2'], [780, 'GS.1'], [781, 'XBB.1.45.1'], [782, 'GQ.1'], [783, 'XBB.1.4.2'], [784, 'XBB.1.16.10'], [785, 'EG.5.1.1'], [786, 'GY.1'], [787, 'BN.1.2.7'], [788, 'GJ.1.2'], [789, 'FL.13.2'], [790, 'FL.18.1'], [791, 'FL.20'], [792, 'XBB.1.5.90'], [793, 'FL.10.1'], [794, 'FL.1.3'], [795, 'FR.1.3']]\n" + ] + } + ], + "source": [ + "# read milestones \n", + "milestone_end=False\n", + "milestone=start_milestone\n", + "milestone_list=[]\n", + "import os \n", + "listd=os.listdir()\n", + "if not(\"autoref\" in listd):\n", + " os.mkdir(\"autoref\")\n", + "lista=os.listdir(\"autoref\")\n", + "# reading milestones is very slow, so we save already read milestones to autoref/milestones.txt\n", + "if (\"milestone.txt\" in lista):\n", + " w=open(\"milestone.txt\",'r')\n", + " milestones=w.readlines()\n", + " for line in milestones:\n", + " linsp=line.split()\n", + " if len(linsp)>=2:\n", + " issue=int(linsp[0])\n", + " name=linsp[1]\n", + " milestone_list.append([linsp[0],linsp[1]])\n", + " # don't read twice for old milestones\n", + " if linsp[0]>=milestone:\n", + " milestone=linsp[0]+1\n", + " w.close()\n", + "#rewrite the txt\n", + "w=open(\"milestone.txt\",'w')\n", + "for item in milestone_list:\n", + " print(item[0],item[1],file=w)\n", + " \n", + "\n", + "while not(milestone_end):\n", + " try:\n", + " title=read_milestone(milestone)\n", + " milestone_list.append([milestone,title])\n", + " print(milestone,title,file=w)\n", + " except Exception as e:\n", + " print(milestone,e)\n", + " milestone_end=True\n", + " milestone+=1\n", + " if milestone%10==0:\n", + " print(\"Reading Milestone\",milestone)\n", + "\n", + "w.close()\n", + "print(milestone_list)\n", + " \n", + "\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 80, + "id": "88a367db", + "metadata": {}, + "outputs": [], + "source": [ + "def read_milestone_issues(name):\n", + " # or sars-cov-2 proj if it starts to add milestones\n", + " url=\"https://github.com/cov-lineages/pango-designation/issues?q=milestone:\"+name\n", + " res=request.urlopen(url)\n", + " rp=res.read()\n", + " rp=rp.decode('utf-8')\n", + " html_soup=BeautifulSoup(rp,\"html\")\n", + " html=html_soup.find_all(class_=\"Link--primary v-align-middle no-underline h4 js-navigation-open markdown-title\" )\n", + " try:\n", + " id_str=html[0]['id']\n", + " outid=id_str.split(\"_\")[1]\n", + " return int(outid)\n", + " except Exception as e:\n", + " print(name,e)\n", + " return 0\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 81, + "id": "a56544a8", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Add reference of issue #32 to C.2.1\n", + "Add reference of issue #178 to C.39\n", + "Add reference of issue #77 to P.1\n", + "Add reference of issue #50 to B.1.1.29\n", + "Add reference of issue #40 to N.10\n", + "Add reference of issue #14 to B.1.1.316\n", + "Add reference of issue #53 to B.1.1.317\n", + "Add reference of issue #103 to AW.1\n", + "Add reference of issue #111 to B.1.1.519\n", + "Add reference of issue #475 to BA.1.19\n", + "Add reference of issue #430 to BA.2.2\n", + "Add reference of issue #605 to BA.2.3.11\n", + "CM.5.1 list index out of range\n", + "Add reference of issue #1165 to CM.6.1\n", + "Add reference of issue #600 to BA.2.24\n", + "Add reference of issue #683 to BA.2.60\n", + "Add reference of issue #1136 to CA.3\n", + "Add reference of issue #1181 to CA.4\n", + "Add reference of issue #1043 to BM.1.1.1\n", + "Add reference of issue #1374 to CV.2\n", + "Add reference of issue #2045 to DV.6.2\n", + "Add reference of issue #1375 to CH.3\n", + "Add reference of issue #1176 to BN.1.1\n", + "Add reference of issue #1238 to BN.1.2.1\n", + "Add reference of issue #2006 to FR.1.1\n", + "Add reference of issue #2028 to FR.1.2\n", + "Add reference of issue #1310 to BN.1.7\n", + "Add reference of issue #1184 to BY.1.2.1\n", + "BA.2.75.9 list index out of range\n", + "Add reference of issue #614 to BA.4.1.2\n", + "Add reference of issue #869 to BA.5.1.26\n", + "Add reference of issue #1147 to BF.7.7\n", + "Add reference of issue #1573 to BF.7.14.3\n", + "Add reference of issue #1122 to BV.2\n", + "CK.2 list index out of range\n", + "Add reference of issue #1125 to CK.2.1\n", + "Add reference of issue #1288 to DG.1\n", + "Add reference of issue #1258 to DB.1\n", + "BA.5.2.36 list index out of range\n", + "BA.5.2.38 list index out of range\n", + "Add reference of issue #1279 to BA.5.2.39\n", + "Add reference of issue #1548 to DN.1.1.1\n", + "Add reference of issue #1786 to EW.1\n", + "Add reference of issue #1673 to EZ.1\n", + "Add reference of issue #1714 to FB.1\n", + "Add reference of issue #723 to BE.3\n", + "Add reference of issue #1232 to CQ.2\n", + "Add reference of issue #738 to BA.5.6\n", + "Add reference of issue #35 to B.1.243.1\n", + "Add reference of issue #65 to B.1.351.3\n", + "Add reference of issue #48 to B.1.438\n", + "Add reference of issue #30 to B.1.466.2\n", + "B.1.575 list index out of range\n", + "Add reference of issue #64 to B.1.575.1\n", + "Add reference of issue #363 to AY.5.5\n", + "AY.13 list index out of range\n", + "Add reference of issue #318 to AY.20.1\n", + "AY.63 list index out of range\n", + "Add reference of issue #271 to AY.66\n", + "Add reference of issue #260 to AY.69\n", + "AY.99 list index out of range\n", + "AY.99.1 list index out of range\n", + "AY.99.2 list index out of range\n", + "Add reference of issue #289 to AY.104\n", + "Add reference of issue #287 to AY.106\n", + "Add reference of issue #301 to AY.121\n", + "AY.122 list index out of range\n", + "Add reference of issue #306 to AY.123\n", + "Add reference of issue #281 to AY.124\n", + "Add reference of issue #63 to XA\n", + "Add reference of issue #1208 to XAY.1\n", + "Add reference of issue #1896 to XAY.2.3\n", + "Add reference of issue #2031 to XBB.1.4.2\n", + "XBB.1.5 list index out of range\n", + "Add reference of issue #1684 to EK.3\n", + "Add reference of issue #1921 to GF.1\n", + "Add reference of issue #1660 to XBB.1.5.30\n", + "Add reference of issue #1966 to GR.1\n", + "Add reference of issue #1455 to XBB.1.8\n", + "FL.1.3 list index out of range\n", + "Add reference of issue #1918 to EG.5\n", + "Add reference of issue #1950 to EG.6.1\n", + "Add reference of issue #2021 to FP.3\n", + "Add reference of issue #1802 to XBB.1.16.2\n", + "Add reference of issue #1654 to XBB.1.27\n", + "Add reference of issue #1757 to XBB.1.28\n", + "Add reference of issue #1837 to XBB.1.31\n", + "XBB.1.32 list index out of range\n", + "XBB.1.37 list index out of range\n", + "Add reference of issue #1937 to XBB.1.45.1\n", + "Add reference of issue #1810 to XBB.2.3.3\n", + "XBF.1.1 list index out of range\n" + ] + } + ], + "source": [ + "# read lineage_notes.txt\n", + "\n", + "def milestone2issue(num):\n", + " return 0\n", + "w=open(\"lineage_notes.txt\",'r')\n", + "lineage_notes=w.readlines()\n", + "w.close()\n", + "milestone_tobecheck=[]\n", + "#create a name-milestone match for milestones\n", + "all_milestones={}\n", + "for item in milestone_list:\n", + " all_milestones[item[1]]=item[0]\n", + "\n", + "for num in range(1,len(lineage_notes)):\n", + " line=lineage_notes[num]\n", + " linsp=line.split()\n", + " if len(linsp)>=2:\n", + " title=linsp[0]\n", + " # for all lineages without an issue label but with a milestone\n", + " if not(\"#\" in line):\n", + " if title in all_milestones:\n", + " # this time we need to deal with the milestone \n", + " issue_num=read_milestone_issues(title)\n", + " if issue_num!=0:\n", + " lineage_notes[num]=lineage_notes[num]+\" From #\"+str(issue_num)\n", + " print(\"Add reference of issue #\"+str(issue_num)+\" to \"+title)\n", + "#rewrite lineage_notes.txt\n", + "\n", + " \n", + " \n" + ] + }, + { + "cell_type": "code", + "execution_count": 85, + "id": "1c9369e1", + "metadata": {}, + "outputs": [], + "source": [ + "#final rewrite of lineage_notes.txt\n", + "w=open(\"lineage_notes.txt\",'w')\n", + "for num in range(len(lineage_notes)):\n", + " print(lineage_notes[num].replace('\\n',''),file=w)\n", + "w.close()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7756372f", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0b3798f0", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.4" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}