pappsomspp
Library for mass spectrometry
pappso::FastaReader Class Reference

#include <fastareader.h>

Public Member Functions

 FastaReader (FastaHandlerInterface &handler)
 
 ~FastaReader ()
 
void parse (QFile &fastaFile)
 
void parse (QIODevice *p_inputstream)
 

Protected Member Functions

void parseOnlyOne (QTextStream &p_in)
 

Private Attributes

friend FastaFileIndexer
 
FastaHandlerInterfacem_handler
 

Detailed Description

Definition at line 49 of file fastareader.h.

Constructor & Destructor Documentation

◆ FastaReader()

pappso::FastaReader::FastaReader ( FastaHandlerInterface handler)

Definition at line 45 of file fastareader.cpp.

46  {
47  parse(&fastaFile);

References parse().

◆ ~FastaReader()

pappso::FastaReader::~FastaReader ( )

Definition at line 49 of file fastareader.cpp.

51  {

Member Function Documentation

◆ parse() [1/2]

void pappso::FastaReader::parse ( QFile &  fastaFile)

Definition at line 55 of file fastareader.cpp.

59 {
60 
61  qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
62  QTextStream p_in(p_inputstream);
63 
64 
65  QString accession = "";
66  QString sequence = "";
67  // Search accession conta
68  // QTextStream in(p_in);
69  QString line = p_in.readLine();
70  while(!p_in.atEnd())
71  {

Referenced by FastaReader().

◆ parse() [2/2]

void pappso::FastaReader::parse ( QIODevice *  p_inputstream)

Definition at line 74 of file fastareader.cpp.

75  {
76  m_handler.setSequence(accession, sequence);
77  }
78  sequence = "";
79  accession = line.remove(0, 1);
80  }
81  else
82  {
83  sequence.append(line);
84  // m_handler.setSequence(line);
85  }
86  line = p_in.readLine();
87  }
88  if(!accession.isEmpty())
89  {
90  sequence.append(line);
91  m_handler.setSequence(accession, sequence);
92  }
93  // p_in->close();
94  qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
95 }
96 
97 
98 void
99 FastaReader::parseOnlyOne(QTextStream &p_in)
100 {
101 
102 
103  qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
104 
105 
106  QString accession = "";
107  QString sequence = "";
108  // Search accession conta
109  // QTextStream in(p_in);
110  QString line = p_in.readLine();
111  while(!p_in.atEnd())

References m_handler, and pappso::FastaHandlerInterface::setSequence().

◆ parseOnlyOne()

void pappso::FastaReader::parseOnlyOne ( QTextStream &  p_in)
protected

Definition at line 115 of file fastareader.cpp.

116  {
117  m_handler.setSequence(accession, sequence);
118  return;
119  }
120  sequence = "";
121  accession = line.remove(0, 1);
122  }
123  else
124  {
125  sequence.append(line);
126  // m_handler.setSequence(line);
127  }
128  line = p_in.readLine();
129  }
130  if(!accession.isEmpty())
131  {
132  sequence.append(line);
133  m_handler.setSequence(accession, sequence);
134  }
135  qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
136 }
137 
138 } // namespace pappso

References m_handler, and pappso::FastaHandlerInterface::setSequence().

Member Data Documentation

◆ FastaFileIndexer

friend pappso::FastaReader::FastaFileIndexer
private

Definition at line 51 of file fastareader.h.

◆ m_handler

FastaHandlerInterface& pappso::FastaReader::m_handler
private

Definition at line 64 of file fastareader.h.

Referenced by parse(), and parseOnlyOne().


The documentation for this class was generated from the following files:
pappso::FastaReader::m_handler
FastaHandlerInterface & m_handler
Definition: fastareader.h:64
pappso::FastaReader::parseOnlyOne
void parseOnlyOne(QTextStream &p_in)
Definition: fastareader.cpp:115
pappso::FastaHandlerInterface::setSequence
virtual void setSequence(const QString &description, const QString &sequence)=0
pappso::FastaReader::parse
void parse(QFile &fastaFile)
Definition: fastareader.cpp:55