#include <fastareader.h>
Definition at line 33 of file fastareader.h.
 
◆ FastaReader()
◆ ~FastaReader()
      
        
          | pappso::FastaReader::~FastaReader  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ parse() [1/2]
      
        
          | void pappso::FastaReader::parse  | 
          ( | 
          QFile & |           fastaFile | ) | 
           | 
        
      
 
Definition at line 39 of file fastareader.cpp.
   40{
   41  if(fastaFile.fileName().isEmpty())
   42    {
   43      throw PappsoException(QObject::tr("No FASTA file name specified"));
   44    }
   45  if(fastaFile.open(QIODevice::ReadOnly))
   46    {
   48      fastaFile.close();
   49    }
   50  else
   51    {
   52      throw PappsoException(QObject::tr("ERROR opening FASTA file %1 for read")
   53                              .arg(fastaFile.fileName()));
   54    }
   55}
void parse(QFile &fastaFile)
 
 
References parse().
Referenced by parse(), and pappso::cbor::psm::SageReader::readTsvFile().
 
 
◆ parse() [2/2]
      
        
          | void pappso::FastaReader::parse  | 
          ( | 
          QIODevice * |           p_inputstream | ) | 
           | 
        
      
 
Definition at line 58 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  
   68  
   69  QString 
line = p_in.readLine();
 
   70  while(!p_in.atEnd())
   71    {
   72      if(
line.startsWith(
">"))
 
   73        {
   74          if(!accession.isEmpty())
   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          
   85        }
   86      line = p_in.readLine();
 
   87    }
   88  if(!accession.isEmpty())
   89    {
   90      sequence.append(
line);
 
   91      m_handler.setSequence(accession, sequence);
 
   92    }
   93  
   94  qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
   95}
 
References line, and m_handler.
 
 
◆ parseOnlyOne()
  
  
      
        
          | void pappso::FastaReader::parseOnlyOne  | 
          ( | 
          QTextStream & |           p_in | ) | 
           | 
         
       
   | 
  
protected   | 
  
 
Definition at line 99 of file fastareader.cpp.
  100{
  101 
  102 
  103  qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
  104 
  105 
  106  QString accession = "";
  107  QString sequence  = "";
  108  
  109  
  110  QString 
line = p_in.readLine();
 
  111  while(!p_in.atEnd())
  112    {
  113      if(
line.startsWith(
">"))
 
  114        {
  115          if(!accession.isEmpty())
  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          
  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}
 
References line, and m_handler.
Referenced by pappso::FastaFileIndexer::getSequenceByIndex().
 
 
◆ FastaFileIndexer
  
  
      
        
          | friend pappso::FastaReader::FastaFileIndexer | 
         
       
   | 
  
private   | 
  
 
 
◆ m_handler
The documentation for this class was generated from the following files: