regex - List unique positions from list combined with associated string -
I need to list the unique numerical positions from a file, and then let the exclusive Indels after every position.
If there are more than one different indices, then I want to list each status / indel on different lines.
I am the best solution to collect, but I have no luck. Is there a module-free way?
Please tell me if my description does not understand.
FILE1 data:
7065_8 # 10 99269 T 7065_8 # 10 126,477 -c 7065_8 # 10 413,711 + T 7065_8 # 10 586,681 single 7065_8 # 10 820,739 + T 7065_8 # 10 927,l02 + T 7065_8 # 10 942 973 + T 7065_8 # 10 L,075,448 + G 7065_8 # 11 99,269 tax 7065_8 # 11 126 477 income tax 7065_8 # 11 4l3,7ll + T 7065_8 # 11 470,2ll + G 7065_8 # 10 927,l02 7065_8 -a # 10 942,973 + T
intermediate result:
99269 (-T-T) 416,411 (-T-T) 413,711 (+ t + t) 586 681 (-A ) 820 739 (+ t) 927 102 (+ T-A) 942 973 (+ t + t) 1,075,448 (+ g) 470 211 (+ G)
The final output:
99269 (-T) 126,477 (SI) 126 477 (-T) 413,711 (+ T) 586,681 (single) 820,739 (+ T) 927,102 (+ T) 927,102 (single) 942,973 (+ T) 1,075,448 (+ G) 470,211 (+ G)
Mer here The initial (unsuccessful) code is:
#! Use / usr / bin / perl strict; Use warnings; Use Autodi; Use 5.010; My $ outputfile = "/ users / advertorial / documents / pauserrere." "Open FILE1," / Users / Eddstickle / Documents / CCBCCRCTT "; Open (Output," "Output File";); Use the list :: More QW (uniq); My @ buses = (); My @words = (); While (& lt; FILE1 & gt;) {if (/ ^ \ S + \ s + (\ d +) \ s + (\ S +) /) {push @ word, $ 1; }} My @unique_words = uniq @words; Printed output "@nick_word \ n"; Close FILE1; OFF OUTPUTFILE;
It currently gives me a list of unique status on a line different than the empty space, and how can I print one per line.
I think this program asks you, but your question is not clear. This creates a hash of hashes, which removes the need for a separate uniq
call.
I know it is not clear that numerical terms or Indls , especially not that do not write your Perl code, but I did my best Estimates are made.
What can I not tell if the order status / indial pair cases where there are multiple indices at one place. This code prints them in order to appear in the hash, which is effectively random. If you need them in different order, such as alphabetical, or as they appear in the file, then you have to say this.
I believe that you are happy to change this solution so that it can read and data and
STDOUT
?
instead of using to write external files; Strict; Use warnings; My Information; While (& lt; data & gt;) {my ($ base, $ word) = (split) [1,2]; ++ $ data my $ word $ {Base} {$ word}} ({$ for my $ word a & lt; = & gt; $ b} keys% data) {{keys% {$ data {$ Base}}) {print "$ base ($ word) \ n"; }} __DATA__ 7065_8 # 10 99,269 Tax 7065_8 # 10 126,477 -c 7065_8 # 10 413,711 + T 7065_8 # 10 586,681 single 7065_8 # 10 820,739 + T 7065_8 # 10 927,102 + T 7065_8 # 10 942,973 + T 7065_8 # 10 1,075,448 + G 7065_8 # 11 99 269 T 7065_8 # 11 126 477 income tax 7065_8 # 11 4l3,7ll + T 7065_8 # 11 470,2ll + G 7065_8 # L0 927,l02 single 7065_8 # 10 942,973 + T
production < / strong>
99,269 (-t) 126,477 (-t) 126,477 (-c) 413,711 (+ T) 470,211 (+ G) 586,681 (single) 820,739 (+ T) 927102 ( + T) 927102 (-a) 942973 (+ t) 1075448 (+ g)
Comments
Post a Comment