Skip to content

Instantly share code, notes, and snippets.

@maasha
Created Aug 26, 2014
Embed
What would you like to do?
Example of sequence cleaning using Biopieces 2.0
#!/usr/bin/env ruby
require 'biopieces'
p = BP.new.
read_fastq(input: "in1.fq", input2: "in2.fq").
clip_primer(primer: "GTGCCAGCMGCCGCGGTAA", direction: :forward, mismatch_percent: 20, search_distance: 50).
clip_primer(primer: "GGACTACHVGGGTWTCTAAT", direction: :forward, mismatch_percent: 20, search_distance: 100).
trim_primer(primer: "GTGCCAGCMGCCGCGGTAA", direction: :forward, mismatch_percent: 20, overlap_min: 1).
trim_primer(primer: "GGACTACHVGGGTWTCTAAT", direction: :forward, mismatch_percent: 20, overlap_min: 1).
trim_seq.
assemble_pairs(overlap_min: 40, mismatch_percent: 40, reverse_complement: true).
mean_scores.
grab(evaluate: ":SCORES_MEAN >= 25").
mean_scores(local: true).
grab(evaluate: ":SCORES_MEAN_LOCAL >= 15").
plot_histogram(key: :SEQ_LEN, terminal: :png, output: "lendist.png", force: true).
plot_scores(terminal: :png, count: true, output: "scores.png", force: true).
write_fastq(output: "out.fq", force: true).
run(progress: true, fork: true, verbose: true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment