Skip to content

Instantly share code, notes, and snippets.

View natechols's full-sized avatar

Nat Echols natechols

  • Pacific Biosciences
  • SF Bay Area
View GitHub Profile
{"num_polyA_seen": 13, "num_filtered_short_reads": 0, "num_flnc_bases": 35563, "num_3_seen": 13, "num_reads": 22, "num_nflc": null, "num_fl": 9, "num_nflnc": null, "num_flnc": 9, "num_flc": 0, "num_5_seen": 11, "num_nfl": 13}
@natechols
natechols / gist:2f1abc2ed2a7498ae6c3667379df971a
Last active March 31, 2016 15:19
comparing LAA reports
Python 2.7.9 (default, May 31 2015, 05:04:28)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pbcommand.pb_io.report import load_report_from_json
>>> rpt_old = load_report_from_json("/pbi/dept/secondary/siv/smrtlink/smrtlink-alpha/smrtsuite/userdata/jobs_root/000/000212/tasks/pbreports.tasks.amplicon_analysis_consensus-0/consensus_report.json")
>>> rpt_new = load_report_from_json("/pbi/dept/secondary/siv/smrtlink/smrtlink-alpha/smrtsuite/userdata/jobs_root/000/000215/tasks/pbreports.tasks.amplicon_analysis_consensus-0/consensus_report.json")
>>> table_old = rpt_old.tables[0]
>>> table_new = rpt_new.tables[0]
>>> table_old.columns
[<Column id:barcodename header:Barcode nvalues:370 >, <Column id:coarsecluster header:Sequence Cluster nvalues:370 >, <Column id:phase header:Sequence Phase nvalues:370 >, <Column id:sequencelength header:Length (bp) nvalues:370 >, <Column id:predictedaccuracy header:Estimated Accuracy nvalues:370 >, <Column id:totalcoverage heade
@natechols
natechols / report_spec.py
Last active May 25, 2016 15:11
Example of using report spec metadata
#!/usr/bin/env python
import json
from pbcommand.models.report import Attribute, Report
class MetaAttribute(object):
def __init__(self, id_, name, description, type_):
self.id = id_
import scopt.OptionParser
case class BaseConfig(host: String, port: Int)
trait BaseParser { self: OptionParser[BaseConfig] =>
opt[String]("host") action { (x, c) =>
c.copy(host = x)
} text "Hostname of smrt server"
{
"namespace": "com.pacbio.common.models.datastore",
"type": "record",
"name": "DataStoreViewRule",
"fields": [
{
"name": "id",
"type": "string",
"desc": "Corresponds to sourceId in datastore, e.g. pbalign.tasks.pbalign-
out-0"
import re
FS_RE = "{([GMkp]{0,1})(:)([\.,]{0,1})([0-9]*)([dfg]{1})}(.*)$"
def format_metric(format_str, value):
"""
Format a report metric (attribute or table column value) according to our
in-house rules. These resemble Python format strings (plus optional
suffix), but with the addition of optional scaling flags.
"""
if value is None: