Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • single line levelsof output for pasting elsewhere

    Hello all:

    I need to have protein changes separated by a comma in a single line (like R243S, Y220C, ...and so on) to paste into a server for getting scores for each of the mutations. I am copy/pasting from the Results Window, but the output is wrapped with a ">' character for each new line. Is there anyway, I can get -levelsof- to get me a single line of output.

    My code:
    Code:
    frame put mischange if mutclass=="missense", into(p53mis)
    frame p53mis {
    replace mischange = subinstr(mischange, "p.","",.)
    levelsof mischange, local(mammoth) sep(,) clean
    di "`r(levels)'" _newline
    }
    My (undesirable) output (whole data, not the dataex portion) which I end up pasting in a text editor cleaning up and then pasting into the webserver for the scores:
    Code:
    A159G,C141R,C176F,C176R,C176S,C238G,C238Y,C242F,C275Y,C277F,C277Y,D259Y,D281E,D2
    > 81N,D281V,E258K,E286G,F113V,F134S,F270S,G187S,G244C,G244S,G245C,G245D,G245S,G2
    > 66E,G266R,H168R,H179N,H179Q,H179R,H179Y,I195T,I254N,I255T,K120E,K132R,L111P,L1
    > 45R,L252P,L265P,L265R,L344P,L344Q,M133K,M237I,M237K,N131I,N239D,P152L,P190R,P2
    > 23L,P278A,Q136H,R110L,R158H,R175H,R181H,R196G,R245S,R248G,R248Q,R248W,R249S,R2
    > 67W,R273C,R273H,R273P,R273S,R280K,R282G,R290H,S127F,S127T,S215G,S215N,S240G,S2
    > 41F,S241Y,T155N,T253A,V143M,V157F,V173G,V173L,V173M,V216L,V216M,V272L,V272M,V2
    > 74D,V274L,Y126H,Y163C,Y163N,Y205C,Y220C,Y220H,Y220N,Y234C,Y234N
    . di "`r(levels)'" _newline

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float obs byte mutno str19 mischange str10 mutclass
     1 1 "p.D281V"      "missense"  
     1 2 ""             ""          
     1 3 ""             ""          
     2 1 "p.R196*"      "stop gain" 
     2 2 ""             ""          
     2 3 ""             ""          
     3 1 "p.Y126H"      "missense"  
     3 2 ""             ""          
     3 3 ""             ""          
     4 1 "p.R175H"      "missense"  
     4 2 ""             ""          
     4 3 ""             ""          
     5 1 "p.P190Lfs*57" "frameshift"
     5 2 "p.V272M"      "missense"  
     5 3 ""             ""          
     6 1 "p.F134S"      "missense"  
     6 2 ""             ""          
     6 3 ""             ""          
     7 1 "p.Y220N"      "missense"  
     7 2 ""             ""          
     7 3 ""             ""          
     8 1 "p.N131I"      "missense"  
     8 2 "p.R213*"      "stop gain" 
     8 3 ""             ""          
     9 1 "p.P278A"      "missense"  
     9 2 ""             ""          
     9 3 ""             ""          
    10 1 "p.C176F"      "missense"  
    10 2 ""             ""          
    10 3 ""             ""          
    11 1 "p.R342*"      "stop gain" 
    11 2 ""             ""          
    11 3 ""             ""          
    12 1 "p.E258K"      "missense"  
    12 2 "p.G112Wfs*12" "frameshift"
    12 3 ""             ""          
    13 1 "p.Y220C"      "missense"  
    13 2 ""             ""          
    13 3 ""             ""          
    14 1 "p.?"          "splicing"  
    14 2 "p.C238Y"      "missense"  
    14 3 ""             ""          
    15 1 "p.R213Gfs*34" "complex"   
    15 2 "p.Y220C"      "missense"  
    15 3 ""             ""          
    16 1 "p.R248W"      "missense"  
    16 2 ""             ""          
    16 3 ""             ""          
    17 1 "p.C238Lfs*2"  "complex"   
    17 2 ""             ""          
    17 3 ""             ""          
    18 1 "p.R273H"      "missense"  
    18 2 "p.K120E"      "missense"  
    18 3 ""             ""          
    19 1 "p.F113V"      "missense"  
    19 2 "p.R213Dfs*34" "frameshift"
    19 3 ""             ""          
    20 1 "p.Q165*"      "stop gain" 
    20 2 ""             ""          
    20 3 ""             ""          
    21 1 "p.V272M"      "missense"  
    21 2 ""             ""          
    21 3 ""             ""          
    22 1 "p.R175H"      "missense"  
    22 2 ""             ""          
    22 3 ""             ""          
    23 1 "p.H179Q"      "missense"  
    23 2 ""             ""          
    23 3 ""             ""          
    24 1 "p.C277F"      "missense"  
    24 2 ""             ""          
    24 3 ""             ""          
    25 1 "p.G244S"      "missense"  
    25 2 ""             ""          
    25 3 ""             ""          
    26 1 "p.I195T"      "missense"  
    26 2 ""             ""          
    26 3 ""             ""          
    27 1 "p.?"          "splicing"  
    27 2 "p.Q144Sfs*26" "frameshift"
    27 3 ""             ""          
    28 1 "p.R280K"      "missense"  
    28 2 ""             ""          
    28 3 ""             ""          
    29 1 "p.Y234N"      "missense"  
    29 2 ""             ""          
    29 3 ""             ""          
    30 1 "p.N239D"      "missense"  
    30 2 ""             ""          
    30 3 ""             ""          
    31 1 "p.G244C"      "missense"  
    31 2 ""             ""          
    31 3 ""             ""          
    32 1 "p.H168R"      "missense"  
    32 2 "p.S215G"      "missense"  
    32 3 ""             ""          
    33 1 "p.G266E"      "missense"  
    33 2 ""             ""          
    33 3 ""             ""          
    34 1 "p.C242F"      "missense"  
    end

  • #2
    Thank you for the data example. Here is one technique.

    Code:
    frame put mischange if mutclass=="missense", into(p53mis)
    frame p53mis {
      replace mischange = subinstr(mischange, "p.","",.)
      bys mischange : keep if _n==1
      gen want = ""
      replace want = cond(_n==1, mischange, want[_n-1] + "," + mischange)
      keep in l
      keep want
      export delim want using "mischanges.csv", novarnames delim(" ") replace
    }

    Comment


    • #3
      Originally posted by Leonardo Guizzetti View Post
      Thank you for the data example. Here is one technique.

      Code:
      frame put mischange if mutclass=="missense", into(p53mis)
      frame p53mis {
      replace mischange = subinstr(mischange, "p.","",.)
      bys mischange : keep if _n==1
      gen want = ""
      replace want = cond(_n==1, mischange, want[_n-1] + "," + mischange)
      keep in l
      keep want
      export delim want using "mischanges.csv", novarnames delim(" ") replace
      }
      Took me a while to understand the logic, but it is fascinating how it gets what I wanted, Leonardo Guizzetti

      Comment

      Working...
      X