This file is indexed.

/usr/include/SeqLib/SeqPlot.h is in libseqlib-dev 1.1.1+dfsg-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
#ifndef SEQLIB_CONTIG_PLOT_H
#define SEQLIB_CONTIG_PLOT_H

#include "SeqLib/BamRecord.h"

namespace SeqLib {
  
  /** Object for creating ASCII alignment plots
   */
  class SeqPlot {

  public:
    
    /** Create an empty plotter object */
  SeqPlot() : m_pad(5) {}

    /** Plot aligned read by stacking them in an IGV-like view */
    std::string PlotAlignmentRecords(const BamRecordVector& brv) const;

    /** Set the view window 
     * @param g Window to view reads in. Reads that 
     * start or end outside of this window are not plotted
     */
    void SetView(const GenomicRegion& g) { m_view = g; }

    /** Set the padding between reads (default is 5) */
    void SetPadding(int p) { m_pad = p; }

  private: 

    // reads that align to the contig
    BamRecordVector m_reads;

    // view window
    GenomicRegion m_view;

    // padding when placing reads
    int m_pad;

  };

  /** A single plotted read */
struct PlottedRead {

  int pos;
  std::string seq;
  std::string info;
  
  PlottedRead(int p, const std::string& s, const std::string& i) : pos(p), seq(s), info(i) {}

  bool operator<(const PlottedRead& pr) const {
    return (pos < pr.pos);
  }

};

typedef std::vector<PlottedRead> PlottedReadVector;

/** A plotted line */
struct PlottedReadLine {

PlottedReadLine() : available(0), contig_len(0), pad(5) {}

  std::vector<PlottedRead*> read_vec;
  int available;
  int contig_len;
  
  int pad;

  void addRead(PlottedRead *r) {
    read_vec.push_back(r);
    available = r->pos + r->seq.length() + pad;
  }

  bool readFits(const PlottedRead &r) {
    return (r.pos >= available);
  }

  friend std::ostream& operator<<(std::ostream& out, const PlottedReadLine &r) {
    int last_loc = 0;
    for (std::vector<PlottedRead*>::const_iterator i = r.read_vec.begin(); i != r.read_vec.end(); ++i) {
      //    for (auto& i : r.read_vec) {
      assert((*i)->pos - last_loc >= 0);
      out << std::string((*i)->pos - last_loc, ' ') << (*i)->seq;
      last_loc = (*i)->pos + (*i)->seq.length();
    }
    int name_buff = r.contig_len - last_loc;
    assert(name_buff < 1e6);
    out << std::string(std::max(name_buff, 5), ' ');
    for (std::vector<PlottedRead*>::const_iterator i = r.read_vec.begin(); i != r.read_vec.end(); ++i) {
      //for (auto& i : r.read_vec) { // add the data
      out << (*i)->info << ",";
    }
    return out;
  }

};

typedef std::vector<PlottedReadLine> PlottedReadLineVector;


}



#endif