Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
Downsampling
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Anne-Sophie Denommé-Pichon
Downsampling
Commits
3286a901
Commit
3286a901
authored
Sep 24, 2021
by
Anne-Sophie Denommé-Pichon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean file
parent
16a42095
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
bam_downsampling.py
bam_downsampling.py
+5
-5
No files found.
bam_downsampling.py
View file @
3286a901
#!/usr/bin/env python
# Yannis Duffourd
# Anne-Sophie Denommé-Pichon
import
sys
import
getopt
import
pysam
...
...
@@ -7,7 +10,6 @@ import logging
import
math
import
threading
import
random
# ~ import matplotlib.pyplot as plt
currentThread
=
0
nbThread
=
1
...
...
@@ -15,7 +17,6 @@ downSamplingRate = 0
inputFile
=
""
logFile
=
""
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'i:o:d:l:'
)
for
opt
,
arg
in
opts
:
if
opt
in
(
"-i"
):
...
...
@@ -33,13 +34,12 @@ for opt, arg in opts:
sys
.
stderr
.
write
(
"Parsing bam file :
%
s ..."
%
(
inputFile
)
)
bamIterRef
=
pysam
.
AlignmentFile
(
inputFile
,
"r"
)
bamCodonReference
=
{}
# samStream = open( samFile , "r" )
bamOutStream
=
pysam
.
AlignmentFile
(
outputFile
,
"wb"
,
template
=
bamIterRef
)
for
line
in
bamIterRef
:
#logging.info('########\nNew read to parse : ' + str(line) )
#
logging.info('########\nNew read to parse : ' + str(line) )
# pass bad alignements
if
(
line
.
is_unmapped
==
True
)
or
(
line
.
is_secondary
==
True
)
or
(
line
.
is_supplementary
==
True
)
:
#
~
logging.info('Passing sequence : bad quality ' )
# logging.info('Passing sequence : bad quality ' )
continue
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment