This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Internal method to build argument list for BWA C functions | |
# @note this method should not be called directly | |
def self.build_args_for_BWA(args) | |
cmd_args = args.map do |arg| | |
FFI::MemoryPointer.from_string(arg.to_s) # convert every parameters into a string and then into a memory pointer | |
end | |
exec_args = FFI::MemoryPointer.new(:pointer, cmd_args.length) # creating a pointer to an array of pointers | |
cmd_args.each_with_index do |arg, i| | |
exec_args[i].put_pointer(0, arg) # filling in the array of pointers | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARGF.each do |line| | |
line.chomp! | |
if line.start_with? "@HISEQ" | |
a = line.split("\s") | |
a[0] += "_1" | |
puts a.join("\s") | |
else | |
puts line | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jruby 1.6.5 (ruby-1.9.2-p136) (2011-10-25 9dcd388) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_27) [linux-amd64-java] | |
main thread profile results: | |
Total time: 3497.12 | |
total self children calls method | |
---------------------------------------------------------------- | |
3495.72 366.68 3129.03 1 Object(singleton)#each | |
2431.95 206.55 2225.40 283220008 Kernel#puts | |
2225.40 2225.40 0.00 566440018 IO#write |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def thor_task(klass, task_name, &block) | |
if program.nil? | |
warn "WARNING: no program is associated with #{class_name.upcase} task, does not make sense to create a thor task." | |
return nil | |
end | |
if klass | |
wrapper = self | |
klass.class_eval do | |
wrapper.options.each_pair do |name, opt| | |
method_option name, opt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Trim | |
include Bio::Command::Wrapper | |
set_program Bio::Ngs::Utils.binary("fastx_trimmer") | |
use_aliases | |
add_option :first_base, :type => :numeric, :aliases => "-f", :desc => "First base to keep" | |
add_option :last_base, :type => :numeric, :aliases => "-l", :desc => "Last base to keep" | |
add_option :compress, :type => :boolean, :aliases => "-z", :desc => "Compress output with GZIP" | |
add_option :input, :type => :string, :aliases => "-i", :desc => "Input FASTA/Q file", :collapse => true | |
add_option :output, :type => :string, :aliases => "-o", :desc => "Output FASTA/Q file", :collapse => true | |
add_option :trim, :type => :numeric, :aliases => "-t", :desc => "Trim N nucleotides from the end of the read" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc "quant GTF OUTPUTDIR BAM ", "Genes and transcripts quantification" | |
Bio::Ngs::Cufflinks::Quantification.new.thor_task(self, :quant) do |wrapper, task, gtf, outputdir, bam| | |
wrapper.params = task.options | |
wrapper.params = {"num-threads" => 6, "output-dir" => outputdir, "GTF" => gtf } | |
wrapper.run :arguments=>[bam], :separator => "=" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "htsjdk-1.125.jar" # https://github.com/broadinstitute/picard/releases/download/1.125/picard-tools-1.125.zip | |
require "logger" | |
java_import "htsjdk.samtools.SAMFileReader" | |
java_import "htsjdk.samtools.SAMFileWriterFactory" | |
logger = Logger.new(STDOUT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(biomaRt) | |
## ensembl=useMart("ensembl") | |
## listDatasets(ensembl) # show all the possible databases on Ensembl | |
ensembl = useEnsembl(biomart="ensembl",dataset="btaurus_gene_ensembl") | |
## listAttributes(ensembl) # show the attributes of the database |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import net.sf.picard.fastq.FastqReader | |
import java.io.File | |
import scala.collection.JavaConversions._ | |
object Reader extends App { | |
val file = new File(args(0)) | |
val fr = new FastqReader(file) | |
printToFile(new File(args(1)))(p => { | |
for (seq <- fr.iterator()) { | |
val header = seq.getReadHeader.split(" ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
import os | |
import cyvcf | |
import Bio.bgzf | |
vcf_input = sys.argv[1] |
OlderNewer