From 133712faec1a9fb4a610332969ab318c72062422 Mon Sep 17 00:00:00 2001 From: carneiro Date: Mon, 23 May 2011 21:46:14 +0000 Subject: [PATCH] Have a list of bam files but Picard updated their versions from v1 to v17 ? This script will update all your v* numbers for you. PS: don't hate Lua. :-) git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5857 348d0f76-0448-11de-a6fe-93d51630548a --- lua/updateSampleList.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lua/updateSampleList.lua diff --git a/lua/updateSampleList.lua b/lua/updateSampleList.lua new file mode 100644 index 000000000..0480f6d7b --- /dev/null +++ b/lua/updateSampleList.lua @@ -0,0 +1,14 @@ +function latestVersion(sample) + local version = tonumber(sample:match("/v(%d+)/")) + f = io.open(sample) + while (f == nil) do + version = version + 1 + sample = sample:gsub("/v(%d+)/", "/v"..version.."/") + f = io.open(sample) + end + return(sample) +end + +for sample in io.lines(arg[1]) do + print(latestVersion(sample)) +end