Skip to content

Commit

Permalink
replace grep usage for uniprot2genpept.py output
Browse files Browse the repository at this point in the history
  • Loading branch information
p-vychik committed Jun 4, 2019
1 parent e354eb9 commit ae5a91e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
22 changes: 18 additions & 4 deletions Modules/DeNovoTFBSinference.xojo_code
Original file line number Diff line number Diff line change
Expand Up @@ -536,26 +536,40 @@ Protected Module DeNovoTFBSinference

dim ResArray(0) as string
dim m,n,id,i,k,z as integer
dim UniProtID, MultiFasta, SingleFasta, entryprep, cli, genpeptIDs as string
dim UniProtID, MultiFasta, SingleFasta, entryprep, cli, genpeptIDs, shellRes(-1) as string
dim EntryFragmentsF, uniprot2genpept as FolderItem
dim sh as Shell
dim rg as New RegEx
Dim rgmatch as RegExMatch
rg.SearchPattern="\S*(?=\.)"

uniprot2genpept=Resources_f.Child("uniprot2genpept.py")
if uniprot2genpept<>nil then
if not uniprot2genpept.Exists then
MsgBox("Check "+uniprot2genpept.ShellPath+" for uniprot2genpept.py")
Return ""
else
cli= "python "+uniprot2genpept.ShellPath+" '"+ecodes+"' | grep -o -Pe '\S*(?=\.)' - | paste -s -d, -" 'convert UniprotKB IDs to Genpept IDs and replace end of line with comma
'cli= "python "+uniprot2genpept.ShellPath+" '"+ecodes+"' | grep -o -Pe '\S*(?=\.)' - | paste -s -d, -" 'convert UniprotKB IDs to Genpept IDs and replace end of line with comma
cli= "python "+uniprot2genpept.ShellPath+" '"+ecodes+"'"
sh=New Shell
sh.mode=0
sh.TimeOut=-1
Sh.Execute cli
if sh.ErrorCode<>0 then
logoWin.WriteToSTDOUT (EndOfLine.unix+"Error converting UniprotKB IDs: "+sh.Result+EndOfLine.unix)
else
genpeptIDs=sh.Result
ecodes=ReplaceAll(genpeptIDs, EndOfLine.UNIX,"")
shellRes=sh.Result.Split(EndOfLine.UNIX)
for id=0 to UBound(shellRes)
rgmatch=rg.Search(shellRes(id))
if rgmatch<> nil then
if genpeptIDs="" then
genpeptIDs=rgmatch.SubExpressionString(0)
else
genpeptIDs=genpeptIDs+","+rgmatch.SubExpressionString(0)
end
end
next
ecodes=genpeptIDs
end if
end
else
Expand Down
2 changes: 1 addition & 1 deletion Sigmoid.xojo_project
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ WinInternalName=
WinProductName=SigmoID
WinFileDescription=
AutoIncrementVersionInformation=True
BuildFlags=&h980
BuildFlags=&h2980
BuildLanguage=&h1
DebugLanguage=&h0
Region=
Expand Down

0 comments on commit ae5a91e

Please # to comment.