changeset 0:b2d176fbe142 draft default tip

Uploaded
author taoufikbens
date Tue, 02 Aug 2016 10:54:18 -0400
parents
children
files digestion.R digestion.xml
diffstat 2 files changed, 135 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digestion.R	Tue Aug 02 10:54:18 2016 -0400
@@ -0,0 +1,58 @@
+#Rscript --vanilla --slave --no-site-file , Rscript version installed from toolshed with the dependencies
+# xcms.r version="20150519"
+
+#Redirect all stdout to the log file
+#Out prints redirected to a log file
+log_file=file("peptidesearch.log", open = "wt")
+sink(log_file)
+sink(log_file, type = "out")
+#Loading needed librairies xcms for the GC-LCMS preprocessing
+#For args parsing we load parseCommandArgs function from batch package
+library(batch) 
+library("cleaver")
+library("BRAIN")
+#library("animation")
+#Function reconstructing the source path of the data by using passed arguments to the script
+#Keeps just the arguments after --file
+#Parsing argumets passed to the script
+source_local <- function(fname){
+  #
+  argv <- commandArgs(trailingOnly = FALSE)
+  base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
+  source(paste(base_dir, fname, sep="/"))
+}
+#interpretation of arguments given in command line as an R list of objects
+listArguments = parseCommandArgs(evaluate=FALSE)
+print(listArguments)
+sequence=listArguments[["sequence"]]
+pepway=listArguments[["pepway"]]
+missedCleavages=as.numeric(listArguments[["missedCleavages"]])
+enzym=listArguments[["enzym"]]
+peptidename="Manual Peptide"
+if(pepway=="byid"){
+  #Peptide id
+  peptideid=sequence
+  #Cleavage Enzym
+  #enzym="trypsin"
+  #Number of missed cleavage
+  #missedCleavages=c(1)
+  #Uniprot static url access 
+  urluniprot="http://www.uniprot.org/uniprot/"
+  #Url for the fasta sequence
+  urlseq=paste(urluniprot,peptideid,".fasta",sep = "")
+  #Getting the content of the url (fasta)
+  reponsefasta=readLines(urlseq)
+  taille=length(reponsefasta)
+  sequencearray=reponsefasta[2:taille]
+  #Extracting sequence from fasta file
+  sequence=paste(sequencearray, collapse = '')
+  sequence=paste(strsplit(sequence,split = "\n")[[1]],collapse = "")
+  spp=strsplit(reponsefasta[1]," ")
+  peptidename=spp[[1]][1]
+}
+peptidedigested=cleave(sequence,enzym=enzym)[[1]]
+print("Result of the digestion")
+for(i in seq(1:length(peptidedigested))){
+  print(peptidedigested[i])
+  
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/digestion.xml	Tue Aug 02 10:54:18 2016 -0400
@@ -0,0 +1,77 @@
+<tool id="digestion" name="digestion" version="201506204">
+ <!--   <requirements>
+        <requirement type="package" version="3">R</requirement>
+        <requirement type="package" version="1.1-4">batch</requirement>
+    </requirements>
+-->
+    <description> Simulate peptides digestion. </description>    
+    <command interpreter="Rscript">
+        peptidesearch.r
+	enzym $enzym missedCleavages $missedCleavages 
+        #if $pepsequence.source_select=="bysequence"
+	pepway "bysequence" sequence $pepsequence.sequence
+        #else
+        pepway "byid" sequence $pepsequence.pepid
+        #end if
+    </command> 
+    <inputs>
+    <conditional name="pepsequence">
+    <param name="source_select" type="select" label="Selection Options">
+          <option value="bysequence">Enter peptide sequence manualy</option>
+          <option value="bypepid">Enter peptide ID (Uniprot)</option>
+    </param>
+    <when value="bysequence">
+    <param name="sequence" type="text" size="40" label="Peptide sequence" help="Enter peptide sequence" />
+    </when>
+    <when value="bypepid">
+    <param name="pepid" type="text" size="40" label="Peptide Id uniprot" help="Enter peptide Id" />
+    </when>
+   </conditional>
+   <param name="enzym" type="select" label="Cleavage rules">
+	<option value="arg-c proteinase">arg-c proteinase</option>
+	<option value="asp-n endopeptidase">asp-n endopeptidase</option>
+	<option value="bnps-skatole-c">bnps-skatole-c</option>
+	<option value="caspase1">caspase1</option>
+	<option value="caspase2">caspase2</option>
+	<option value="caspase3">caspase3</option>
+	<option value="caspase4">caspase4</option>
+	<option value="caspase5">caspase5</option>
+	<option value="caspase6">caspase6</option>
+	<option value="caspase7">caspase7</option>
+	<option value="caspase8">caspase8</option>
+	<option value="caspase9">caspase9</option>
+	<option value="caspase10">caspase10</option>
+	<option value="chymotrypsin-high">chymotrypsin-high</option>
+	<option value="chymotrypsin-low">chymotrypsin-low</option>
+	<option value="clostripain">clostripain</option>
+	<option value="cnbr">cnbr</option>
+	<option value="enterokinase">enterokinase</option>
+	<option value="factor xa">factor xa</option>
+	<option value="formic acid">formic acid</option>
+	<option value="glutamyl endopeptidase">glutamyl endopeptidase</option>
+	<option value="granzyme-b">granzyme-b</option>
+	<option value="hydroxylamine">hydroxylamine</option>
+	<option value="iodosobenzoic acid">iodosobenzoic acid</option>
+	<option value="lysc">lysc</option>
+	<option value="lysn">lysn</option>
+	<option value="neutrophil elastase">neutrophil elastase</option>
+	<option value="ntcb">ntcb</option>
+	<option value="pepsin1.3">pepsin1.3</option>
+	<option value="pepsin">pepsin</option>
+	<option value="proline endopeptidase">proline endopeptidase</option>
+	<option value="proteinase k">proteinase k</option>
+	<option value="staphylococcal peptidase i">staphylococcal peptidase i</option>
+	<option value="thermolysin">thermolysin</option>
+	<option value="thrombin">thrombin</option>
+	<option value="trypsin">trypsin</option>
+    </param>
+    <param name="missedCleavages" type="integer" value="0" min="0" label="Number of missed cleavages."/>
+    </inputs>
+    <outputs>
+        <data name="log" format="txt" from_work_dir="peptidedigestion.log" label="peptidedigestion.txt" />
+    </outputs>
+    <stdio>
+        <exit_code range="1:" level="fatal" />
+    </stdio>
+</tool>
+