## Orthologs.Blast.BaseBlastN


Base BlastN class.


Usage

``` python
Orthologs.Blast.BaseBlastN(
    project,
    method,
    acc_file,
    copy_from_package,
    ref_species,
    template=None,
    save_data=True,
    verbose=False,
    **kwargs
)
```


## Methods

| Name | Description |
|----|----|
| [__init__()](#__init__) | This class inherits from the ComparativeGenetics class. |
| [blastn_wrapper()](#blastn_wrapper) | Use NCBI's blastn wrapper to run blast. |
| [configure()](#configure) | Configure the BLAST workflow. |
| [create_maf()](#create_maf) | Create a master accessions file if the blast has completed. |
| [parse_xml()](#parse_xml) | Parse the blast XML record get the best hit accession number. |
| [runblast()](#runblast) | Run NCBI's blastn. |
| [select_method()](#select_method) | Select a method for running blastn. |

------------------------------------------------------------------------


#### \_\_init\_\_()


This class inherits from the ComparativeGenetics class.


Usage

``` python
__init__(
    project,
    method,
    acc_file,
    copy_from_package,
    ref_species,
    template=None,
    save_data=True,
    verbose=False,
    **kwargs
)
```


This class utilizes it's parent classes to search a standalone Blast database for specific orthologs of a gene using a query organism (usually human). The best hits from the Blast are filtered for the best option in order to get the most accuarate accession numbers for downstream analysis.


##### Parameters


`project`  
The project name.

`method`  
Method used for blasting. (1, 2, or None)

`acc_file`  
The name/path of the accession file.

`copy_from_package`  
Copy the acc_file from the package. (True or False)

`ref_species`  
A reference species or organism for the blast query.

`template=None`  
The accession file template.

`save_data=``True`  
A flag for saving the post_blast data to an excel file.

`verbose=``False`  
A flag for determining the level of logging verbosity.

`kwargs={}`  


------------------------------------------------------------------------


#### blastn_wrapper()


Use NCBI's blastn wrapper to run blast.


Usage

``` python
blastn_wrapper(gene, organism, parameters, xml_path, gene_path)
```


The function includes a try/except to ensure that errors are caught and that if a blast stops while blasting, incomplete files will be removed.


##### Parameters


`gene: str`  
The input gene for the blast run.

`organism: str`  
The organism to retrieve a hit for.

`parameters: dict`  
A dictionary of blastn parameters.

`xml_path: str`  
The path to the xml output file.

`gene_path: str`  
The path to the gene's directory.


------------------------------------------------------------------------


#### configure()


Configure the BLAST workflow.


Usage

``` python
configure(query_accessions, query_organism, auto_start=False)
```


It configures the accession file, which works with interrupted Blasts. It configures a gene_list for blasting the right genes.


##### Parameters


`query_accessions`  
A list of query accession numbers. Each gene needs one from the same organism.

`query_organism`  
The name of the query organism for post configuration.

`auto_start=``False`  
A flag that determines whether the blast starts automatically. (Default value = False)


##### Returns


------------------------------------------------------------------------


#### create_maf()


Create a master accessions file if the blast has completed.


Usage

``` python
create_maf()
```


------------------------------------------------------------------------


#### parse_xml()


Parse the blast XML record get the best hit accession number.


Usage

``` python
parse_xml(xml_path, gene, organism)
```


##### Parameters


`xml_path`  
Absolute path to the blast record.

`gene`  
The gene of interest.

`organism`  
The organism of interest.


##### Returns


Returns one accession number in the building accession file.


------------------------------------------------------------------------


#### runblast()


Run NCBI's blastn.


Usage

``` python
runblast(genes=None, query_organism=None, pre_configured=False)
```


This method actually performs NCBI's blastn. It requires configuring before it can be utilized.


##### Parameters


`genes=None`  
Gene of interest. (Default value = None)

`query_organism=None`  
Query organism. (Default value = None)

`pre_configured=``False`  
Determines if the blast needs configuring. (Default value = False)


##### Returns


------------------------------------------------------------------------


#### select_method()


Select a method for running blastn.


Usage

``` python
select_method(method=1)
```


##### Parameters


`method=``1`  
The blast method to use. Either 1, 2, or None.
