Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
magatt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
UMR GDEC
magatt
Commits
32c97e2e
Commit
32c97e2e
authored
5 years ago
by
Helene Rimbert
Browse files
Options
Downloads
Patches
Plain Diff
new feature in micromapping: deal with target length between 2 mapped ISBP markers
parent
614c7080
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/microMappingPipeline.py
+31
-12
31 additions, 12 deletions
bin/microMappingPipeline.py
with
31 additions
and
12 deletions
bin/microMappingPipeline.py
+
31
−
12
View file @
32c97e2e
...
...
@@ -26,6 +26,8 @@ blatResults = defaultdict()
outputTable_file
=
outputDir
+
'
/mappingSummary.csv
'
outputBlatFile
=
outputDir
+
'
/allBlat.csv
'
mappingResults
=
defaultdict
()
minTargetSize
=
500
# minimum size of the target genomique sequence: min 500bp
maxTargetSize
=
10000000
# maximum size of the target genomique sequence: max 1Mb
def
main
():
...
...
@@ -79,6 +81,7 @@ def main():
markerCoords
=
defaultdict
()
pairUsed
=
'
NA
'
markerPairStatus
=
0
targetLengthStatus
=
'
NA
'
### check if markers are mapped on same target chromosome
for
pair
in
markerPairs
:
...
...
@@ -167,7 +170,7 @@ def main():
This gene cannot be anchored
we move on to the next gene
"""
print
(
"
Could not identify a pair of marker to use to anchor the gene {}
.
"
.
format
(
gene
))
sys
.
stderr
.
write
(
"
Could not identify a pair of marker to use to anchor the gene {}
"
.
format
(
gene
))
print
(
"
going to next gene
"
)
flankingMarkersPerGenes
[
gene
][
'
markerPairStatus
'
]
=
'
noAnchorsOnTargetGenome
'
flankingMarkersPerGenes
[
gene
][
'
markerPairUsed
'
]
=
pairUsed
...
...
@@ -223,25 +226,40 @@ def main():
"""
run Blat of the genomic sequence on the target region on new assembly
only if the target sequence matches the min and max size
============================================================================================================
"""
blatResultFile
=
runBlat
(
db
=
targetFasta2blast
,
query
=
queryFasta2blast
,
blatResult
=
workingDir
+
'
/blat.txt
'
,
outFormat
=
'
ps
l
'
)
targetSeqLength
=
len
(
targetSeqRecord
.
seq
)
if
targetSeqLength
<
minTargetSize
:
print
(
"
The target genomic sequence is too small: {} inferior to {}
"
.
format
(
targetSeqLength
,
minTargetSize
))
markerCoords
[
'
targetLengthStatus
'
]
=
'
tooSmal
l
'
"""
check if the genomic align perfectly on the new reference
============================================================================================================
"""
blatresult
=
checkPerfectHit
(
blatresult
=
blatResultFile
,
workingDir
=
workingDir
,
maxhit
=
1
)
elif
targetSeqLength
>
maxTargetSize
:
print
(
"
The target genomic sequence is too long: {} supperior to {}
"
.
format
(
targetSeqLength
,
maxTargetSize
))
markerCoords
[
'
targetLengthStatus
'
]
=
'
tooLong
'
else
:
markerCoords
[
'
targetLengthStatus
'
]
=
'
OK
'
blatResultFile
=
runBlat
(
db
=
targetFasta2blast
,
query
=
queryFasta2blast
,
blatResult
=
workingDir
+
'
/blat.txt
'
,
outFormat
=
'
psl
'
)
"""
check if the genomic align perfectly on the new reference
============================================================================================================
"""
blatresult
=
checkPerfectHit
(
blatresult
=
blatResultFile
,
workingDir
=
workingDir
,
maxhit
=
1
)
if
blatresult
[
'
blatStatus
'
]
==
'
unmapped
'
:
print
(
"
No BLAT results found for gene {}
"
.
format
(
gene
))
outputSummaryLine
=
createOutputLine
(
blat
=
blatresult
,
gene
=
flankingMarkersPerGenes
[
gene
],
markers
=
markerCoords
)
elif
markerCoords
[
'
targetLengthStatus
'
]
!=
'
OK
'
:
print
(
"
Target sequence for gene {} is too long/small: {}
"
.
format
(
gene
,
markerCoords
[
'
targetLengthStatus
'
]))
outputSummaryLine
=
createOutputLine
(
blat
=
blatresult
,
gene
=
flankingMarkersPerGenes
[
gene
],
markers
=
markerCoords
)
else
:
print
(
"
BLAT result found for gene {} with status {}
"
.
format
(
gene
,
blatresult
[
'
blatStatus
'
]))
#print(blatresult)
...
...
@@ -267,6 +285,7 @@ def createOutputLine(blat,gene,markers):
outputArray
.
append
(
str
(
value
))
# loop over marker info
outputArray
.
append
(
str
(
markers
[
'
targetLengthStatus
'
]))
upstreamMarkerInfo
=
[
markers
[
'
upstream
'
][
'
id
'
],
markers
[
'
upstream
'
][
'
query
'
][
'
chrom
'
]
+
'
:
'
+
str
(
markers
[
'
upstream
'
][
'
query
'
][
'
start
'
])
+
'
-
'
+
str
(
markers
[
'
upstream
'
][
'
query
'
][
'
stop
'
]),
markers
[
'
upstream
'
][
'
target
'
][
'
chrom
'
]
+
'
:
'
+
str
(
markers
[
'
upstream
'
][
'
target
'
][
'
start
'
])
+
'
-
'
+
str
(
markers
[
'
upstream
'
][
'
target
'
][
'
stop
'
])]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment