cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
KarlK
Level I

How to delete numbers in brackets from letter- sequences

How can I find modified peptide sequences (e.g., SYELPDGQV(+.98)I(+10.98)T(-17.03)IGNER ) in the Jump table when searching the unmodified sequence (SYELPDGQVITIGNER)?

 

If the search algorithm cannot be modified, is it possible to generate a new column by deleting all number in brackets from the all-letter- sequences?

 

e.g., entry original column: NLTEE(+.98)LAGLDE(+28.99)T(+10.98)IAK

automatically generating new column with entry: NLTEEMAGLDETIAK

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to delete numbers in brackets from letter- sequences

You could create new column using Regex or Substitute

 

Names Default To Here(1);

str1 = "NLTEE(+.98)LAGLDE(+28.99)T(+10.98)IAK";
str2 = "SYELPDGQV(+.98)I(+10.98)T(-17.03)IGNER";

Show(Regex(str1, "[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]", "", GLOBALREPLACE));
Show(Regex(str2, "[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]", "", GLOBALREPLACE));

This assumes that you want to only keep the letters. You can build it for example by using Recode

 

jthi_0-1695827659613.png

and you can use regular expressions with search also

jthi_1-1695827740130.png

 

Edit:

Better regex is most likely something like this

Names Default To Here(1);

str1 = "NLTEE(+.98)LAGLDE(+28.99)T(+10.98)IAK";
str2 = "SYELPDGQV(+.98)I(+10.98)T(-17.03)IGNER";

res1 = Regex(str1, "\(.*?\)", "", GLOBALREPLACE);
res2 = Regex(str2, "\(.*?\)", "", GLOBALREPLACE);

show(res1, res2);
-Jarmo

View solution in original post

3 REPLIES 3
jthi
Super User

Re: How to delete numbers in brackets from letter- sequences

You could create new column using Regex or Substitute

 

Names Default To Here(1);

str1 = "NLTEE(+.98)LAGLDE(+28.99)T(+10.98)IAK";
str2 = "SYELPDGQV(+.98)I(+10.98)T(-17.03)IGNER";

Show(Regex(str1, "[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]", "", GLOBALREPLACE));
Show(Regex(str2, "[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]", "", GLOBALREPLACE));

This assumes that you want to only keep the letters. You can build it for example by using Recode

 

jthi_0-1695827659613.png

and you can use regular expressions with search also

jthi_1-1695827740130.png

 

Edit:

Better regex is most likely something like this

Names Default To Here(1);

str1 = "NLTEE(+.98)LAGLDE(+28.99)T(+10.98)IAK";
str2 = "SYELPDGQV(+.98)I(+10.98)T(-17.03)IGNER";

res1 = Regex(str1, "\(.*?\)", "", GLOBALREPLACE);
res2 = Regex(str2, "\(.*?\)", "", GLOBALREPLACE);

show(res1, res2);
-Jarmo
jthi
Super User

Re: How to delete numbers in brackets from letter- sequences

You can also use Substitute

Names Default To Here(1);

str1 = "NLTEE(+.98)LAGLDE(+28.99)T(+10.98)IAK";
str2 = "SYELPDGQV(+.98)I(+10.98)T(-17.03)IGNER";

res1 = Substitute(str1, Items(Get Punctuation Characters(Include Chars("0123456789")), ""), "");
res2 = Substitute(str2, Items(Get Punctuation Characters(Include Chars("0123456789")), ""), "");

or build regex using JMP's text explorer

jthi_0-1695828368341.png

jthi_1-1695828563370.png

Do note that this will leave them as separate "words" as it is used for Text Explorer, so you have to remove the spaces, this can be done with Search for example

jthi_2-1695828618171.png

 

-Jarmo
KarlK
Level I

Re: How to delete numbers in brackets from letter- sequences

Thank you very much for your quick and helpful answers