-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ex-269 (jebene/dkriti) began drafting architecture doc -- edited rst and
created abstract methods file
- Loading branch information
Showing
3 changed files
with
171 additions
and
0 deletions.
There are no files selected for viewing
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
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 | ||
---------------- |
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
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
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""" |