Bioinformatics/Bioinformatics Contest 2017
-
Final Round. Problem 1 Gene ExpressionBioinformatics/Bioinformatics Contest 2017 2019. 8. 28. 23:37
https://stepik.org/lesson/32224/step/2?unit=19659 Problem 1 Problem 1 stepik.org 하나의 genome에서 유래한 expression level을 구하는 문제이다. N개의 genome과 그것들로부터 유래된 rna 조각들을 M개를 주었을때 하나의 genome으로 부터 유래한 rna의 갯수를 세어야 한다. 즉 2개의 genome과 겹치는 rna들을 제외해야 한다. 간단하게 생각해보면 다음과 같은 코드로 가능하다. import sys from functools import reduce import bisect input = [] # with open('F1') as f: # for line in f.readlines(): # input.append(..
-
Qualification Round. Problem 3 Introns DetectionBioinformatics/Bioinformatics Contest 2017 2019. 4. 4. 23:30
DNA원본과 splicing후 조각들의 read로 exon을 재조합하는 문제이다. exon1 - intron1 - exon2 - intron2 - exon3 - intron3 이고 exon1 - exon2 exon2 - exon3 이런식으로 주어지면 exon1 - exon2 - exon3을 구하면 되는것이다. 간단하게 말하자면 원본 DNA seq에서 임의의 seq를 제거해 주어진 exon들을 모두 포함하는 새로운 sequence를 만들면 된다. 가장 단순하게 생각해보면 DNA seq에서 모든 base들을 하나씩 포함하거나 제외하면서 만든 seq가 exon들을 전부 포함하는지 보면 된다. base별로 포함/미포함 조합을 가지고 있으므로 길이 l인 sequence의 모든 조합만 구하는것만으로도 2^l의 복잡..
-
Qualification Round. Problem 2 The Secondary Structure of RNABioinformatics/Bioinformatics Contest 2017 2019. 3. 28. 22:18
RNA sequence를 주고 해당 rna의 모든 염기들이 쌍을 이루는 secondary structure를 형성할수있는지를 묻는 문제이다. 괄호문제랑 사실상 똑같다. Stack에 염기를 하나씩 넣으면서 넣기직전에 stack의 제일 위에있는 염기와 넣을 염기가 쌍을 이루면 제일 위의 염기를 pop하면 된다. 아니면 push한다. from functools import reduce input = input() # with open('6') as f: # input = f.read().strip() combine = {'A': 'U', 'U': 'A', 'C': 'G', 'G': 'C'} pair_stack = [] for base in input: if len(pair_stack) == 0: pair_st..
-
Qualification Round. Problem 1 Chemical ReactionsBioinformatics/Bioinformatics Contest 2017 2019. 3. 23. 23:41
화학 반응식과 초기 substrate로 최종적으로 생성되는 물질들을 구하는 문제이다. from functools import reduce import sys input = [] for line in sys.stdin: input.append(line.strip()) # with open('2') as f: # input = f.read().strip().split('\n') chemicals = set(input[0].split(' ')) reactions = list(map(lambda reaction: list(map(lambda side: side.split('+'), reaction.split('->'))), input[1:])) num_chemicals = len(chemicals) while ..