[질문] Perl 에서 특정부분 파싱 (Parsing) 하는 방법
안녕하세요
오늘 질문은 특정 부분을 파싱하는 방법에 대해 질문드립니다.
아래와 같은 텍스트 파일에서요
굵게표시된 부분을
1 텝
1.1 텝 0.1320텝(0.0045 텝0.0342)
1.2 텝 0.2350텝(0.00121 텝0.0122) 텝0.3120텝(0.0125텝 0.0742)
이런식으로 파싱하는 방법을 알고 싶습니다.
괄호는 없어도 됩니다
1
1.1
1.2
1.3
이렇게 갯수는 항상 랜덤합니다.
#!/usr/bin/perl
open IN, "$ARGV[0]";
%hash;
while()
{
chomp($_);
unless($_=~/^Nei & Gojobori 1986/)
{
next;
}
이까지 하다가 실력의 한계를 느꼈습니다.
고수님들의 많은 도움 부탁 드립니다.
(A) Nei-Gojobori (1986) method
Nei M, Gojobori T (1986) Simple methods for estimating the numbers of synonymous and nonsynonymous nucleotide substitutions. Mol. Biol. Evol. 3:418-426
Nei & Gojobori 1986. dN/dS (dN, dS)
1
1.1 0.1320(0.0045 0.0342)
1.2 0.2350(0.00121 0.0122) 0.3120(0.0125 0.0742)
(B) Yang & Nielsen (2000) method
Yang Z, Nielsen R (2000) Estimating synonymous and nonsynonymous substitution rates under realistic evolutionary models. Mol. Biol. Evol. 17:32-43
(equal weighting of pathways)
seq. seq. S N t kappa omega dN +- SE dS +- SE
2 1 33.6 278.4 0.0408 1.1589 0.0374 0.0036 +- 0.0036 0.0964 +- 0.0574
(C) LWL85, LPB93 & LWLm methods
Li W.-H., C.-I. Wu, Luo (1985) A new method for estimating synonymous and nonsynonymous rates of nucleotide substitutions considering the relative likelihood of nucleotide and codon changes. Mol. Biol. Evol. 2: 150-174.
Li W-H (1993) Unbiased estimation of the rates of synonymous and nonsynonymous substitution. J. Mol. Evol. 36:96-99
Pamilo P, Bianchi NO (1993) Evolution of the Zfx and Zfy genes - rates and interdependence between the genes. Mol. Biol. Evol. 10:271-281
Yang Z (2006) Computational Molecular Evolution. Oxford University Press, Oxford, England
2 (1.1) vs. 1 (1)
L(i): 211.0 19.0 82.0 sum= 312.0
Ns(i): 0.0000 0.0000 1.0000 sum= 1.0000
Nv(i): 1.0000 0.0000 2.0000 sum= 3.0000
A(i): -0.0000 0.0000 0.0125
B(i): 0.0048 -0.0000 0.0250
LWL85: dS = 0.0348 dN = 0.0045 w = 0.1289 S = 88.3 N = 223.7
LWL85m: dS = 0.0348 dN = 0.0045 w = 0.1289 S = 88.3 N = 223.7 (rho = 0.333)
LPB93: dS = 0.0352 dN = 0.0044 w = 0.1241
이렇게 하면 되지 않을까요?
읽어들인 줄이 1로 시작하고 나머지 끝까지는 공백,숫자,괄호,점으로 이루어진 문자열이면 출력
정담
반갑습니다.
댓글 달기