bpp-seq-omics  2.4.1
bpp::PlinkOutputMafIterator Class Reference

This iterator outputs all biallelic SNPs in the PLINK format (ped and map files). More...

#include <Bpp/Seq/Io/Maf/PlinkOutputMafIterator.h>

+ Inheritance diagram for bpp::PlinkOutputMafIterator:
+ Collaboration diagram for bpp::PlinkOutputMafIterator:

Public Member Functions

 PlinkOutputMafIterator (MafIterator *iterator, std::ostream *outPed, std::ostream *outMap, const std::vector< std::string > &species, const std::string &reference, bool map3=false, bool recodeChr=false)
 Build a new PlinkOutputMafIterator object. More...
 
MafBlockanalyseCurrentBlock_ ()
 
void setLogStream (std::shared_ptr< OutputStream > logstream)
 
void addIterationListener (IterationListener *listener)
 
MafBlocknextBlock ()
 Get the next available alignment block. More...
 
bool isVerbose () const
 
void setVerbose (bool yn)
 

Protected Member Functions

virtual void fireIterationStartSignal_ ()
 
virtual void fireIterationMoveSignal_ (const MafBlock &currentBlock)
 
virtual void fireIterationStopSignal_ ()
 

Protected Attributes

MafIteratoriterator_
 
MafBlockcurrentBlock_
 
std::shared_ptr< OutputStreamlogstream_
 
std::vector< IterationListener * > iterationListeners_
 
bool started_
 
bool verbose_
 

Private Member Functions

 PlinkOutputMafIterator (const PlinkOutputMafIterator &iterator)
 
PlinkOutputMafIteratoroperator= (const PlinkOutputMafIterator &iterator)
 
void init_ ()
 
void parseBlock_ (std::ostream &out, const MafBlock &block)
 
void writePedToFile_ (std::ostream &out)
 

Private Attributes

std::ostream * outputPed_
 
std::ostream * outputMap_
 
std::vector< std::string > species_
 
std::string refSpecies_
 
bool map3_
 
std::vector< std::string > ped_
 
std::string currentChr_
 
size_t lastPosition_
 
bool recodeChr_
 
std::map< std::string, unsigned int > chrCodes_
 
unsigned int currentCode_
 

Detailed Description

This iterator outputs all biallelic SNPs in the PLINK format (ped and map files).

Definition at line 55 of file PlinkOutputMafIterator.h.

Constructor & Destructor Documentation

◆ PlinkOutputMafIterator() [1/2]

bpp::PlinkOutputMafIterator::PlinkOutputMafIterator ( MafIterator iterator,
std::ostream *  outPed,
std::ostream *  outMap,
const std::vector< std::string > &  species,
const std::string &  reference,
bool  map3 = false,
bool  recodeChr = false 
)
inline

Build a new PlinkOutputMafIterator object.

Warning
In the current implementation, there is no way to deal with diploid individuals. Each sequence is therefore considered as a haploid genome and will be written has a homozygous SNP in the Ped file.
Parameters
iteratorThe input iterator.
outPedThe output stream where to write the Ped file.
outMapThe output stream where to write the Map file.
speciesA list of at least two species to compute SNPs. Only blocks containing at least these two species will be used. In case one species is duplicated in a block, the first sequence will be used.
referenceThe species to use as a reference for coordinates. It does not have to be one of the selected species on which SNPs are computed.
map3Tell if genetic distance column should be ommited in the map file. Otherwise set to 0.
recodeChrTell if chromosomes should be recoded to numbers.

Definition at line 90 of file PlinkOutputMafIterator.h.

References init_().

◆ PlinkOutputMafIterator() [2/2]

bpp::PlinkOutputMafIterator::PlinkOutputMafIterator ( const PlinkOutputMafIterator iterator)
inlineprivate

Definition at line 105 of file PlinkOutputMafIterator.h.

Member Function Documentation

◆ addIterationListener()

void bpp::AbstractMafIterator::addIterationListener ( IterationListener listener)
inlinevirtualinherited

Implements bpp::MafIterator.

Definition at line 99 of file MafIterator.h.

References bpp::AbstractMafIterator::iterationListeners_.

◆ analyseCurrentBlock_()

◆ fireIterationMoveSignal_()

void AbstractMafIterator::fireIterationMoveSignal_ ( const MafBlock currentBlock)
protectedvirtualinherited

Definition at line 57 of file MafIterator.cpp.

Referenced by bpp::AbstractMafIterator::nextBlock().

◆ fireIterationStartSignal_()

void AbstractMafIterator::fireIterationStartSignal_ ( )
protectedvirtualinherited

Definition at line 51 of file MafIterator.cpp.

Referenced by bpp::AbstractMafIterator::nextBlock().

◆ fireIterationStopSignal_()

void AbstractMafIterator::fireIterationStopSignal_ ( )
protectedvirtualinherited

Definition at line 63 of file MafIterator.cpp.

Referenced by bpp::AbstractMafIterator::nextBlock().

◆ init_()

void PlinkOutputMafIterator::init_ ( )
private

Definition at line 57 of file PlinkOutputMafIterator.cpp.

References bpp::TextTools::toString().

Referenced by PlinkOutputMafIterator().

◆ isVerbose()

bool bpp::AbstractMafIterator::isVerbose ( ) const
inlinevirtualinherited

Implements bpp::MafIterator.

Definition at line 116 of file MafIterator.h.

References bpp::AbstractMafIterator::verbose_.

◆ nextBlock()

MafBlock* bpp::AbstractMafIterator::nextBlock ( )
inlinevirtualinherited

Get the next available alignment block.

Returns
A maf alignment block, or a null pointer if no more block is available.

Implements bpp::MafIterator.

Definition at line 103 of file MafIterator.h.

References bpp::AbstractMafIterator::analyseCurrentBlock_(), bpp::AbstractMafIterator::fireIterationMoveSignal_(), bpp::AbstractMafIterator::fireIterationStartSignal_(), bpp::AbstractMafIterator::fireIterationStopSignal_(), and bpp::AbstractMafIterator::started_.

◆ operator=()

PlinkOutputMafIterator& bpp::PlinkOutputMafIterator::operator= ( const PlinkOutputMafIterator iterator)
inlineprivate

◆ parseBlock_()

◆ setLogStream()

void bpp::AbstractFilterMafIterator::setLogStream ( std::shared_ptr< OutputStream logstream)
inlineinherited

Definition at line 178 of file MafIterator.h.

References bpp::AbstractFilterMafIterator::logstream_.

◆ setVerbose()

void bpp::AbstractMafIterator::setVerbose ( bool  yn)
inlinevirtualinherited

Implements bpp::MafIterator.

Definition at line 117 of file MafIterator.h.

References bpp::AbstractMafIterator::verbose_.

◆ writePedToFile_()

void PlinkOutputMafIterator::writePedToFile_ ( std::ostream &  out)
private

Definition at line 132 of file PlinkOutputMafIterator.cpp.

Referenced by analyseCurrentBlock_().

Member Data Documentation

◆ chrCodes_

std::map<std::string, unsigned int> bpp::PlinkOutputMafIterator::chrCodes_
private

Definition at line 68 of file PlinkOutputMafIterator.h.

Referenced by operator=().

◆ currentBlock_

◆ currentChr_

std::string bpp::PlinkOutputMafIterator::currentChr_
private

Definition at line 65 of file PlinkOutputMafIterator.h.

Referenced by operator=().

◆ currentCode_

unsigned int bpp::PlinkOutputMafIterator::currentCode_
private

Definition at line 69 of file PlinkOutputMafIterator.h.

Referenced by operator=().

◆ iterationListeners_

std::vector<IterationListener*> bpp::AbstractMafIterator::iterationListeners_
protectedinherited

Definition at line 89 of file MafIterator.h.

Referenced by bpp::AbstractMafIterator::addIterationListener().

◆ iterator_

◆ lastPosition_

size_t bpp::PlinkOutputMafIterator::lastPosition_
private

Definition at line 66 of file PlinkOutputMafIterator.h.

Referenced by operator=().

◆ logstream_

◆ map3_

bool bpp::PlinkOutputMafIterator::map3_
private

Definition at line 63 of file PlinkOutputMafIterator.h.

Referenced by operator=().

◆ outputMap_

std::ostream* bpp::PlinkOutputMafIterator::outputMap_
private

Definition at line 60 of file PlinkOutputMafIterator.h.

Referenced by analyseCurrentBlock_(), and operator=().

◆ outputPed_

std::ostream* bpp::PlinkOutputMafIterator::outputPed_
private

Definition at line 59 of file PlinkOutputMafIterator.h.

Referenced by analyseCurrentBlock_(), and operator=().

◆ ped_

std::vector<std::string> bpp::PlinkOutputMafIterator::ped_
private

Definition at line 64 of file PlinkOutputMafIterator.h.

Referenced by operator=().

◆ recodeChr_

bool bpp::PlinkOutputMafIterator::recodeChr_
private

Definition at line 67 of file PlinkOutputMafIterator.h.

Referenced by operator=().

◆ refSpecies_

std::string bpp::PlinkOutputMafIterator::refSpecies_
private

Definition at line 62 of file PlinkOutputMafIterator.h.

Referenced by operator=().

◆ species_

std::vector<std::string> bpp::PlinkOutputMafIterator::species_
private

Definition at line 61 of file PlinkOutputMafIterator.h.

Referenced by operator=().

◆ started_

bool bpp::AbstractMafIterator::started_
protectedinherited

Definition at line 90 of file MafIterator.h.

Referenced by bpp::AbstractMafIterator::nextBlock().

◆ verbose_

bool bpp::AbstractMafIterator::verbose_
protectedinherited

The documentation for this class was generated from the following files: