Package: craw
Counter RnAseq WindowThere are 3 ways to use craw:by install the standalone python scriptsby using docker imageby using singularity imageInstallationRequirementspython >= 3.5psutil >= 5.6pysam == 0.15.2pandas >= 0.24scipy >= 0.16.1numpy >= 1.16matplotlib >= 3.0pillow >= 5.4From packageusing pippip install crawif you use virtualenv do not forget to configure the matplotlib backendNotes for MacOSOn MacOS install python > 3 from image onhttp://python.org.
Then install craw using pippip3 install crawcraw will be installed in/Library/Framework/Python.Framework/Version/3.6/So if you want to use directly craw_coverage and craw_htmp just create a symbolic linc like thisln -s /Library/Framework/Python.Framework/Version/3.6/bin/craw_coverage /usr/local/bin/craw_coverage
ln -s /Library/Framework/Python.Framework/Version/3.6/bin/craw_htmp /usr/local/bin/craw_htmpThe craw documentation (html and pdf) is located in /Library/Framework/Python.Framework/Version/3.6/share/craw/From repositoryclone the project and install with the setup.pygit clone https://gitlab.pasteur.fr/bneron/craw.git

cd craw

python3 setup.py sdist
pip3 install dist/craw-master-devxxxxx.tar.gzTesting my installationThe release come from with some unit and functional tests.
to test if everything work fine.cd craw
python3 tests/run_tests.py -vvThis step is only available from the sources (acloneof the repository or atarballrelease).
Youcannotperform tests if you installed craw from pypi (pip install craw)Using Docker ImageDocker images are available. The two scripts are accessible through the sub-commandcoverageorhtmp.
For instance to use the latest version of craw_htmp::docker pull c3bi/craw
docker run -v$PWD:/root -it c3bi/craw coverage --bam foo.bam --annot foo.annot --ref-col 'Position' --before 3 --after 5 --out foo.cov
docker run -v$PWD:/root -it c3bi/craw htmp --size raw --out foo.png  foo.cov.. note::
In docker the interactive htmp output is not available.
So you must specify the --out optionUsing Singularity ImageSingularity images are available. The two scripts are accessible through the sub-commandcoverageorhtmp.
For instance to use the latest version of craw_htmp::singularity pull --name craw shub://c3bi/craw
./craw coverage --bam foo.bam --annot foo.annot --ref-col 'Position' --before 3 --after 5 --out foo.cov
./craw htmp --size raw --out foo.png  foo.cov.. note::
instead of Docker images, in Singularity images the interactive output is available.
QuickstartA detailed documentation is availableonline:installed along craw in INSTALL_DIR/share/craw/doc/(html|pdf)Inputs / Outputscraw_coverageInputsbam filecraw_coverageneed a file of alignment reads called bam file.
a bam file is a short DNA sequence read alignments in the Binary Alignment/Map format (.bam).craw_coverageneeds also the corresponding index file (bai). The index file must be located beside the bam file
with the same name instead to have the.bamextension it end by.baiextension.
If you have not  the index file you have to create it.To index a bam file you need samtools. The command line issamtools index file.bamFor more explanation seehttp://www.htslib.org/doc/.wig filecraw_coveragecan compute coverage also from wig file
seehttps://wiki.nci.nih.gov/display/tcga/wiggle+format+specificationandhttp://genome.ucsc.edu/goldenPath/help/wiggle.html.
for format specifications. Compare d to these specifications
craw support coverages on both strands. the positive coverages scores
are on the forward strand whereas the negative ones are on the reverse strand.track type=wiggle_0 name="demo" color=96,144,246 altColor=96,144,246 autoScale=on  graphType=bar
variableStep chrom=chrI span=1
72      12.0000
73      35.0000
74      70.0000
75      127.0000
...
72      -88.0000
73      -42.0000
74      -12.0000
75      -1.0000In the example above the coverage on the Chromosome I for the positions 72, 73, 74, 75
are 12, 35, 70, 127 on the forward strand and 88, 42, 12, 1 on the reverse strand.The --bam and --wig options are mutually exclusive but one of these option is required.annotation fileThe annotation file is atsvfile. It's mean that it is a text file with value separated by tabulation (not spaces).
The first line of the file must be the name of the columns
the other lines the values. Each line represent a row.name    gene    chromosome      strand  Position
YEL072W RMD6    chrV    +       14415
YEL071W DLD3    chrV    +       17845
YEL070W DSF1    chrV    +       21097All lines starting with '#' character will be ignored.# This is the annotation file for Wild type
# bla bla ...
name    gene    chromosome      strand  Position
YEL072W RMD6    chrV    +       14415
YEL071W DLD3    chrV    +       17845
YEL070W DSF1    chrV    +       21097mandatory columnsThere is 3 mandatory columns in the annotation file.columns with fixed nametwo with a fixed name:strandindicate on which strand is located the region of interest.
The authorized values for this columns are +/- , 1/-1 or for/rev.chromosomethe chromosome name where is located the region of interest.columns with variable nameIn addition of these two columns the column to define the position of reference is mandatory too, but the name of this
column can be specified by the user. If it's not craw_coverage will use a column name 'position'.If we want to compute coverage on variable window size, 2 extra columns whose name must be specified by the user by the following option:--start-col to define the beginning of the window (this position is included in the window)--stop-col to define the end of the window (this position is included in the window)name    gene    type    chromosome      strand  annotation_start        annotation_end  has_transcript  transcription_end       transcription_start
YEL072W RMD6    gene    chrV    1       13720   14415   1       14745   13569
YEL071W DLD3    gene    chrV    1       16355   17845   1       17881   16177
YEL070W DSF1    gene    chrV    1       19589   21097   1       21197   19539craw_coverage --bam file.bam --annot annot.txt --ref-col annotation_start --start-col annotation_start --stop-col annotation_endThe position of reference must be between start and end.
The authorized values are positive integers.The position of reference can be used to define the reference and the start ot the end of the window.craw_coverage --bam file.bam --annot annot.txt --ref-col annotation_start --start-col annotation_start --stop-col annotation_endAll other columns are not necessary but will be reported as is in the coverage file.Outputscoverage_fileIt's atsvfile with all columns found in annotation file plus the result of coverage position by position centered
on the reference position define for each line. for instancecraw_coverage -bam=../data/craw_data_test/WTE1.bam --annot=../data/craw_data_test/annotations.txt
--ref-col=annotation_start --before=0  --after=2000In the command line above, the column '0' correspond to the annotation_start position the column '1' to annotation_start + 1
on so on until '2000' (here we display only the first 3 columns of the coverage).# Running Counter RnAseq Window
# Version: craw NOT packaged, it should be a development version | Python 3.4
# With the following arguments:
# --after=2000
# --annot=../data/craw_data_test/annotations.txt
# --bam=../data/craw_data_test/WTE1.bam
# --before=0
# --output=WTE1_0+2000.new.cov
# --qual-thr=15
# --ref-col=annotation_start
# --suffix=cov
sense   name    gene    type    chromosome      strand  annotation_start        annotation_end  has_transcript  transcription_end       transcription_start     0       1       2
S       YEL072W RMD6    gene    chrV    +       13720   14415   1       14745   13569   7       7       7
AS      YEL072W RMD6    gene    chrV    +       13720   14415   1       14745   13569   0       0       0
S       YEL071W DLD3    gene    chrV    +       16355   17845   1       17881   16177   31      33      33The line starting with '#' are comments and will be ignored for further processing.
But in traceability/reproducibility concern, in the commentscraw_coverageindicate
the version of the program and the arguments used for this experiment.craw_htmpInputssee craw_coverage outputOutputsThe default output ofcraw_htmp(if --out is omitted) is graphical window on the screen.
The figure display on the screen can be saved using the window menu.
It is also possible to generate directly a image file in various format by specifying the --out option.
The output format will be deduced form the filename extension provide to --out option.--out foo.jpeg  for jpeg image or --out foo.png  for png imageThe supported format vary in function of the matplotlib backend used (see ).If --size raw is used 2 files will be generated one for the sense and the other for the antisense.
If --out is not specified it will be the name of the coverage file without extension and the format will be png.craw_htmp foo_bar.cov --size rawwill producefoo_bar.sense.pngandfoo_bar.antisense.pngcraw_htmp foo_bar.cov --size raw --out Xyzzy.jpegwill produceXyzzy.sense.jpegandXyzzy.antisense.jpegCommand line optionsThere is many options for each craw scripts to have an exhaustive list of options use --help option
or read the manual (html or pdf)