changeset 3:f188eb0b526d draft

planemo upload commit 2d22bc12c66a3d1949d4bf4c84e7ce7c4610383c-dirty
author stevecassidy
date Wed, 14 Dec 2016 21:53:57 -0500
parents 6f4db0e89117
children 22e59a5808e8
files cut_timeseries.py cut_timeseries.xml g_cepstrum.xml g_f0.xml g_forest.xml get_fm_at_midpoint.R get_fm_at_midpoint.xml
diffstat 7 files changed, 21 insertions(+), 110 deletions(-) [+]
line wrap: on
line diff
--- a/cut_timeseries.py	Thu Dec 08 01:45:31 2016 -0500
+++ b/cut_timeseries.py	Wed Dec 14 21:53:57 2016 -0500
@@ -68,7 +68,7 @@
         with open(tsfile, 'r') as fd:
             reader = csv.reader(fd, dialect=csv.excel_tab)
             for row in reader:
-                if row[0] == 'sampletime':
+                if row[0] == 'time':
                     tsheader = row
                 elif float(row[0]) > start and float(row[0]) < end:
                     collect.append(row)
--- a/cut_timeseries.xml	Thu Dec 08 01:45:31 2016 -0500
+++ b/cut_timeseries.xml	Wed Dec 14 21:53:57 2016 -0500
@@ -20,7 +20,7 @@
             <param name="segment_list" value="segmentlist.dat"/>
             <output name="output">
                 <assert_contents>
-                    <has_text text="sampletime"/>
+                    <has_text text="time"/>
                     <has_text text="@"/>
                     <has_text text="1_1119_2_22_001"/>
                 </assert_contents>
--- a/g_cepstrum.xml	Thu Dec 08 01:45:31 2016 -0500
+++ b/g_cepstrum.xml	Wed Dec 14 21:53:57 2016 -0500
@@ -2,7 +2,6 @@
     <description>using wrassp</description>
 
     <requirements>
-        <requirement type="package" version="3.2.1">R</requirement>
         <requirement type="package" version="0.1.4">r-wrassp</requirement>
     </requirements>
 
@@ -12,6 +11,13 @@
         ${fftLength}
      </command>
 
+    <stdio>
+      <regex match="Linux: unexpected operator"
+             source="stderr"
+             level="warning"
+             description="conda r-base bash bug" />
+    </stdio>
+
     <inputs>
         <param name="wavfile" type="data" format="wav" label="Audio File" help="Audio file in WAV format"/>
         <param name="beginTime" type="integer" value="0" label="Start time for analysis (s)"/>
--- a/g_f0.xml	Thu Dec 08 01:45:31 2016 -0500
+++ b/g_f0.xml	Wed Dec 14 21:53:57 2016 -0500
@@ -2,7 +2,6 @@
     <description>using wrassp ksvF0 pitch tracker</description>
 
     <requirements>
-        <requirement type="package" version="3.2.1">R</requirement>
         <requirement type="package" version="0.1.4">r-wrassp</requirement>
     </requirements>
 
@@ -11,6 +10,12 @@
         ${beginTime} ${endTime} ${windowShift} ${gender} ${maxF} ${minF} ${minAmp} ${maxZCR}
      </command>
 
+     <stdio>
+         <regex match="Linux: unexpected operator"
+                source="stderr"
+                level="warning"
+                description="conda r-base bash bug" />
+     </stdio>
 
     <inputs>
         <param name="wavfile" type="data" format="wav" label="Audio File" help="Audio file in WAV format"/>
--- a/g_forest.xml	Thu Dec 08 01:45:31 2016 -0500
+++ b/g_forest.xml	Wed Dec 14 21:53:57 2016 -0500
@@ -2,7 +2,6 @@
     <description>using wrassp formant tracker</description>
 
     <requirements>
-        <requirement type="package" version="3.2.1">R</requirement>
         <requirement type="package" version="0.1.4">r-wrassp</requirement>
     </requirements>
 
@@ -13,6 +12,12 @@
         ${window} ${preemphasis}
      </command>
 
+     <stdio>
+       <regex match="Linux: unexpected operator"
+              source="stderr"
+              level="warning"
+              description="conda r-base bash bug" />
+     </stdio>
 
     <inputs>
         <param name="wavfile" type="data" format="wav" label="Audio File" help="Audio file in WAV format"/>
--- a/get_fm_at_midpoint.R	Thu Dec 08 01:45:31 2016 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-
-library(wrassp)
-
-get_fm_at_midpoint <- function(segments, wavmap) {
-    midpoint_fm <- function(row) {
-        start = as.numeric(row[1])
-        end = as.numeric(row[2])
-        identifier = row[5]
-        fn = wavmap[identifier]
-        if (is.na(fn)) {
-            cat("Can't find wav file for ", identifier, "\n")
-            return(c(0,0,0,0))
-        } else {
-            res = forest(fn, beginTime=start, endTime=end, toFile=FALSE)
-            return(res$fm[nrow(res$fm)/2,])
-        }
-    }
-
-    print(wavmap)
-
-    fm = t(apply(segments, 1, midpoint_fm))
-    fm = data.frame(fm=fm, labels=segments$label, identifier=segments$identifier)
-
-    return(fm)
-}
-
-args = commandArgs(TRUE)
-# args will be like
-# qresult.dat outfile.dat --wavfile a,b,c --identifier A,B,C
-# need to split out wavfile and identifier args on ,
-
-if (length(args) != 6) {
-    print("Wrong number of arguments!")
-    exit(1)
-}
-
-segmentfile = args[1]
-wavfiles = args[4]
-identifiers = args[6]
-outfile = args[2]
-
-# split on comma
-wavfiles = strsplit(wavfiles, ",")[[1]]
-identifiers = strsplit(identifiers, ",")[[1]]
-
-if( length(wavfiles) != length(identifiers)) {
-    print("Lengths of wavfiles and identifiers don't match.")
-    exit(1)
-}
-cat("\nWAVMAP\n")
-wavmap = NULL
-for(i in 1:length(wavfiles)) {
-    wavmap[identifiers[i]] = wavfiles[i]
-}
-
-segments = read.table(segmentfile, header=TRUE)
-
-result = get_fm_at_midpoint(segments, wavmap)
-
-write.table(result, file=outfile, sep="\t", quote=F, row.names=F)
--- a/get_fm_at_midpoint.xml	Thu Dec 08 01:45:31 2016 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-<tool id="get_fm_at_midpoint" name="Get Formants at segment midpoint" version="0.01">
-    <description>using wrassp formant tracker</description>
-
-    <requirements>
-        <requirement type="package" version="3.2.1">R</requirement>
-        <requirement type="package" version="0.1.4">r-wrassp</requirement>
-    </requirements>
-
-    <command interpreter="bash">
-        r_wrapper.sh $__tool_directory__/get_fm_at_midpoint.R --args ${segments} ${output} --wavfile "${",".join(map(str, $wavfile))}" --identifier "${",".join(map(str, [w.element_identifier for w in $wavfile]))}"
-    </command>
-
-    <inputs>
-        <param name="segments" type="data" format="tabular" label="Segment List" help=""/>
-        <param name="wavfile" type="data" multiple="true" format="wav" label="Audio File(s)" help="Audio file(s) in WAV format"/>
-    </inputs>
-
-    <outputs>
-        <data format_source="segments" name="output" label="Formants" />
-    </outputs>
-
-
-    <tests>
-        <test>
-            <param name="segments" value="qresult.dat"/>
-            <param name="wavfile" value="wavs/1_1308_1_2_034-ch6-speaker16.wav#wav"/>
-            <output name="output" file="formants_mid.dat"/>
-        </test>
-    </tests>
-
-    <help>Calculate the formant tracks for segments of some audio files
-    and extract the value at the midpoint. Tabulate these values in the result.</help>
-
-    <citations>
-        <citation type='bibtex'>
-            @Manual{,
-              title = {wrassp: an R wrapper to the ASSP Library},
-              author = {Lasse Bombien and Raphael Winkelmann and Michel
-                Scheffers},
-              year = {2016},
-              note = {R package version 0.1.4},
-            }
-        </citation>
-    </citations>
-</tool>