Skip to content

Commit

Permalink
ex-269 (jebene/dkriti) began drafting architecture doc -- edited rst and
Browse files Browse the repository at this point in the history
created abstract methods file
  • Loading branch information
jebene committed May 21, 2015
1 parent f97f18d commit a59f173
Show file tree
Hide file tree
Showing 3 changed files with 171 additions and 0 deletions.
53 changes: 53 additions & 0 deletions doc/architecture.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Architectural Overview
======================
This overview is intended for contributers.

Coding Standards & Guidelines
-----------------------------
- Uses pylint to format the code.
- Uses '_' to separate the words both in variable and method names.
- Uses caps to separate the words in the class names.
- Uses absolute imports.
- Supports Python 2.7 and 3.x.

Commands
--------
Jacquard is a suite of Python command line tools. Each tool is contained in a
module of the same name and called in the jacquard module. Only jacquard.py
is aware of all of the possible commands.

Translate
^^^^^^^^^
Translate standardizes VCF files by adding Jacquard-specific format tags.

There are two main functions that Translate implements:

**1. Filter flags are added to anomalous VCF records.**
Translate initializes several private classes that label anomalous records
as such.

**2. New Jacquard-specific format tags are added to VCF records.**
Translate calls out to the variant_caller_factory.py, which then adds new
format tag values for each relevant variant caller. Only
variant_caller_factory.py is aware of all of the possible variant callers.


Merge
^^^^^



Summarize
^^^^^^^^^

Expand
^^^^^^

Transforms and Tags
-------------------

Utils
-----

Test Conventions
----------------
4 changes: 4 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ Contents:
Merge <merge>
Summarize <summarize>
Expand <expand>

FAQ <faq>

Architectural Overview <architecture>
Changelog <include_changelog>
Future Directions <include_todo>

License <license>


114 changes: 114 additions & 0 deletions doc/new_tag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#pylint: disable=pointless-string-statement
import abc


"""Abstract class outlining requirements for adding a new tag to Jacquard"""
class NewTag(object):
#pylint:disable=too-few-public-methods,abstract-class-not-used
__metaclass__ = abc.ABCMeta

@abc.abstractmethod
def add_tag_values(self, vcf_record):
"""Adds format tag and sample values to a VCF record"""



"""Abstract class outlining requirements for adding a new variant caller to
Jacquard."""
class NewVariantCaller(object):
#pylint:disable=too-few-public-methods,abstract-class-not-used
__metaclass__ = abc.ABCMeta

@abc.abstractmethod
def claim(self,file_readers):
"""Recognizes and claims MuTect VCFs form the set of all input VCFs.
Each defined caller has a chance to evaluate and claim all the incoming
files as something that it can process.
Args:
file_readers: the collection of currently unclaimed files
Returns:
A tuple of unclaimed readers and NewVariantCallerReaders.
"""



"""Abstract class outlining requirements for adding a new variant
caller-specific VcfReader object to Jacquard."""
class _NewVcfReader(object):
#pylint:disable=abstract-class-not-used
__metaclass__ = abc.ABCMeta

@abc.abstractmethod
@property
def caller_name(self):
"""returns the caller name"""

@abc.abstractmethod
@property
def file_name(self):
"""returns the file name"""

@abc.abstractmethod
def open(self):
"""opens the vcf reader"""

@abc.abstractmethod
def close(self):
"""closes the vcf reader"""

@abc.abstractmethod
@staticmethod
def expected_file_format():
"""returns a list of file groupings (eg ['snp', 'indel']) to be used
to later validate that the files are paired together correctly"""

@abc.abstractmethod
@property
def metaheaders(self):
"""adds and returns new metaheaders"""

@abc.abstractmethod
@property
def column_header(self):
"""returns column header"""

@abc.abstractmethod
def tagged_vcf_records(self):
"""yields tagged vcf_records"""

@abc.abstractmethod
def vcf_records(self):
"""yields vcf_records"""



"""Abstract methods outlining requirements for adding a new command to
Jacquard."""
#pylint: disable=unused-argument
@abc.abstractmethod
def validate_args(args):
"""validates command-line arguments"""

@abc.abstractmethod
def get_required_input_output_types():
"""Returns a tuple of input and output types.
Possible values are:
'file'
'directory'
"""

@abc.abstractmethod
def report_prediction(args):
"""returns a list of output file names be be created"""

@abc.abstractmethod
def add_subparser(subparser):
"""uses argparse to add a sub-parser"""

@abc.abstractmethod
def execute(args, execution_context):
"""executes private methods"""

0 comments on commit a59f173

Please sign in to comment.