Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ONT_pilot_gitlab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ESB
ONT_pilot_gitlab
Commits
a12b69cc
Commit
a12b69cc
authored
4 years ago
by
Valentina Galata
Browse files
Options
Downloads
Patches
Plain Diff
crispr data/fig: filter casc results (issue
#19
)
parent
25b450c3
No related branches found
No related tags found
2 merge requests
!71
Master
,
!70
Add latest figure updates
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
figures/figures.smk
+3
-5
3 additions, 5 deletions
figures/figures.smk
figures/src/utils.py
+13
-0
13 additions, 0 deletions
figures/src/utils.py
with
16 additions
and
5 deletions
figures/figures.smk
+
3
−
5
View file @
a12b69cc
...
...
@@ -164,7 +164,7 @@ rule fig_crispr_data:
import os
import re
import pandas
from src.utils import parse_minced_report
from src.utils import parse_minced_report
, parse_casc_report
summary = []
for ifile_path in input:
ifile_df = None
...
...
@@ -177,11 +177,9 @@ rule fig_crispr_data:
asm_tool = os.path.basename(ifile_path).split(".")[0]
# file content
if crispr_tool == "minced":
ifile_df = parse_minced_report(ifile_path)
ifile_df = pandas.DataFrame(ifile_df)
ifile_df = pandas.DataFrame(parse_minced_report(ifile_path))
elif crispr_tool == "casc":
ifile_df = pandas.read_csv(ifile_path, sep="\t", header=0, usecols=["#seq_id", "spacers", "array_start", "array_stop"], comment=None)
ifile_df.rename(columns={"#seq_id": "seq_id"}, inplace=True)
ifile_df = parse_casc_report(ifile_path)
ifile_df = ifile_df.assign(crispr_tool=crispr_tool)
ifile_df = ifile_df.assign(asm_tool=asm_tool)
summary.append(ifile_df)
...
...
This diff is collapsed.
Click to expand it.
figures/src/utils.py
+
13
−
0
View file @
a12b69cc
#!/usr/bin/python
def
parse_casc_report
(
ifile_path
):
import
pandas
# read in
summary
=
pandas
.
read_csv
(
ifile_path
,
sep
=
"
\t
"
,
header
=
0
,
usecols
=
[
"
#seq_id
"
,
"
spacers
"
,
"
array_start
"
,
"
array_stop
"
,
"
bonafide
"
],
comment
=
None
)
# rename columns
summary
.
rename
(
columns
=
{
"
#seq_id
"
:
"
seq_id
"
},
inplace
=
True
)
# filter
summary
=
summary
[
summary
[
"
bonafide
"
]]
assert
all
(
summary
[
"
bonafide
"
])
# just a check
# drop columns
summary
.
drop
(
columns
=
[
"
bonafide
"
],
inplace
=
True
)
return
summary
def
parse_minced_report
(
ifile_path
):
"""
Parse the MINCED report: for each sequence and found CRISPR array, extract
...
...
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