Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update variantNamingPipeline.rb #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions variantNamingPipeline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

# THE LOGIN FILE PATH NEEDS TO BE MODIFIED TO FIT YOUR DIRECTORY PATH
# IT IS EXPECTING A LINE IN THE FILE WITH FORMAT AS [USER LOGIN]:[PASSWORD]
loginFile="/home/dc12/.AlleleRegistry"
loginFile=".AlleleRegistry"

# return response
# throw exceptions in case of errors
Expand Down Expand Up @@ -347,7 +347,8 @@ def sortVCF(data, outfileName)
infile = "#{outfileName}_input.txt"
outfile = "#{outfileName}_input_sorted.txt"
File.open(infile,"w") { |file| file.puts data}
`(grep ^"#" #{infile}; grep -v ^"#" #{infile} | sort -k1,1 -k2,2n) > #{outfile}`
#`(grep ^"#" #{infile}; grep -v ^"#" #{infile} | sort -k1,1 -k2,2n) > #{outfile}`
system("(grep ^'#' '#{infile}'; grep -v ^'#' '#{infile}' | sort -k1,1 -k2,2n) > '#{outfile}'")
File.delete(infile)
result = File.read(outfile)
File.delete(outfile)
Expand Down Expand Up @@ -477,7 +478,7 @@ def mergeIntermediateWithInput(options, tmpDir, ourFileName)
end
puts "[#{Time.now.strftime("%Y-%m-%dT%H:%M:%S")}] Merging *_CAid* intermediate files in: #{tmpDir}"
caIDs = Dir["#{tmpDir}/*tmp*_CAid*"]

end

def mergeIntermediateVcfFiles(options,tmpDir,outFileName)
Expand All @@ -491,12 +492,16 @@ def mergeIntermediateVcfFiles(options,tmpDir,outFileName)
puts "[#{Time.now.strftime("%Y-%m-%dT%H:%M:%S")}] Merging *_CAid* intermediate files in: #{tmpDir}"
caIDs = Dir["#{tmpDir}/*tmp*_CAid*"]
#puts "cat #{caIDs.join(" ")} > #{options[:out]}/#{caIdOutName}\n"
`cat #{caIDs.join(" ")} > #{options[:out]}/#{caIdOutName}`
#`cat #{caIDs.join(" ")} > #{options[:out]}/#{caIdOutName}`
#puts("cat \'#{caIDs.join("\' \'")}\' > \'#{options[:out]}/#{caIdOutName}\'")
system("cat \'#{caIDs.join("\' \'")}\' > \'#{options[:out]}/#{caIdOutName}\'")

puts "[#{Time.now.strftime("%Y-%m-%dT%H:%M:%S")}] Merging *_noCAid* intermediate files in: #{tmpDir}"
noCAids = Dir["#{tmpDir}/*tmp*_noCAid*"]
#puts "cat #{options[:notRegisteredFile]} #{noCAids.join(" ")} > #{options[:out]}/#{noCAidOutName}"
`cat #{options[:notRegisteredFile]} #{noCAids.join(" ")} > #{options[:out]}/#{noCAidOutName}`
#`cat #{options[:notRegisteredFile]} #{noCAids.join(" ")} > #{options[:out]}/#{noCAidOutName}`
#puts("cat \'#{options[:notRegisteredFile]}\' \'#{noCAids.join("\' \'")}\' > \'#{options[:out]}/#{noCAidOutName}\'")
system("cat \'#{options[:notRegisteredFile]}\' \'#{noCAids.join("\' \'")}\' > \'#{options[:out]}/#{noCAidOutName}\'")

if options[:summary]
summaries = "#{tmpDir}/*tmp*summary*"
Expand Down Expand Up @@ -672,4 +677,4 @@ def addCount(countHash, key, count)
#remove the intermediate files
#cleanTmpDirFiles(tmpDirFname)

puts "[#{Time.now.strftime("%Y-%m-%dT%H:%M:%S")}] finish"
puts "[#{Time.now.strftime("%Y-%m-%dT%H:%M:%S")}] finish"