Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
########################################################################### # # # This file is part of Counter RNAseq Window (craw) package. # # # # Authors: Bertrand Neron # # Copyright (c) 2017-2019 Institut Pasteur (Paris). # # see COPYRIGHT file for details. # # # # craw is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # craw is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # See the GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with craw (see COPYING file). # # If not, see <http://www.gnu.org/licenses/>. # # # ###########################################################################
"""Handle one entry (One line) of annotation file """
"""
:param values: the values parsed from one line of the annotation file :type values: list of string """
len(self._fields), values)) "between {start_col}: {start} and {stop_col}: {stop}".format( line=self, start=self.start, start_col=self._fields_idx['start'].col_name, ref=self.ref, ref_col=self._fields_idx['ref'].col_name, stop=self.stop, stop_col=self._fields_idx['stop'].col_name) ) "on forward strand".format( line=self, start=self.start, start_col=self._fields_idx['start'].col_name, stop=self.stop, stop_col=self._fields_idx['stop'].col_name ) )
""" Convert field parsed from annotation file in Entry internal value
:param field: the field name associated to the value. :type field: string :param value: the value to convert :type value: string :return: the converted value :rtype: any :raise: RuntimeError or value Error if a value cannot be converted """ else:
""" Switch start and stop value if self.start > self.stop This situation can occur if annotation regards the reverse strand """
def chromosome(self): """The name of the Chromosome"""
def ref(self): """The position of reference"""
def strand(self): """the strand +/-"""
def start(self): """The Position to start the coverage computation""" else:
def stop(self): """The position to end the coverage computation (included)""" else:
def header(self): """The header of the annotation file"""
strand_col='strand', chr_col='chromosome', start_col=None, stop_col=None): """ From the header of the annotation line create a new Entry Class inherited from Entry Class
:param name: The name of the new class of entry. :type name: str :param fields: The fields constituting the new type of entry. :type fields: list of string :param ref_col: The name of the column representing the position of reference (default is 'position'). :type ref_col: string :param strand_col: The name of the column representing the strand (default is 'strand'). :type strand_col: string :param chr_col: The name of the column representing the name of chromosome (default is 'chromosome'). :type chr_col: string :param start_col: The name of the column representing the position of the first base to compute the coverage (inclusive). :type start_col: string :param stop_col: The name of the column representing the position of the last base to compute the coverage (inclusive). :type stop_col: string :return: a new class child of :class:`Entry` which is able to store information corresponding to the header. """ "You must specify the '--ref-col' option".format(ref_col, ', '.join(fields))) from None "You must specify the '--chr-col' option".format(chr_col, ', '.join(fields))) from None
""" Parse the annotation file - create new type of Entry according to the header - create one Entry object for each line of the file """
start_col=None, stop_col=None, sep='\t'): """
:param path: the path to the annotation file to parse. :type path: string :param ref_col: the name of the column for the reference position :type ref_col: string :param chr_col: the name of the column for the chromosome :type chr_col: string :param strand_col: the name of the column for the strand :type strand_col: string :param start_col: the name of the column for start position :type start_col: string :param stop_col: the name of the column for the stop position :type stop_col: string :param sep: The separator tu use to split fields :type sep: string """
""" Parse an annotation file and yield a :class:`Entry` for each line of the file.
:return: a generator on a annotation file. """ strand_col=self.strand_col, chr_col=self.chr_col, start_col=self.start_col, stop_col=self.stop_col)
""" :return: the maximum of bases to take in count before and after the reference position. :rtype: tuple of 2 int """ # for coverages on reverse strand the sense of scores # must be reversed, so the computation of padding must be too else: |