Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
EffiCAZ
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PHIM
sravel
EffiCAZ
Commits
e43d477f
Commit
e43d477f
authored
2 years ago
by
SimonBache
Browse files
Options
Downloads
Patches
Plain Diff
add orthofinder parse script
parent
ca0706b9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/orthofinder_parse.py
+41
-0
41 additions, 0 deletions
scripts/orthofinder_parse.py
with
41 additions
and
0 deletions
scripts/orthofinder_parse.py
0 → 100644
+
41
−
0
View file @
e43d477f
import
pandas
as
pd
from
Bio
import
SeqIO
from
Bio.SeqRecord
import
SeqRecord
from
Bio.Seq
import
Seq
import
click
@click.command
(
context_settings
=
{
'
help_option_names
'
:
(
'
-h
'
,
'
--help
'
),
"
max_content_width
"
:
800
})
@click.option
(
'
--orthogroups_table
'
,
'
-t
'
,
default
=
None
,
type
=
click
.
Path
(
exists
=
True
,
file_okay
=
True
,
dir_okay
=
False
,
readable
=
True
,
resolve_path
=
True
),
required
=
True
,
show_default
=
True
,
help
=
'
Path to input orthogroups table file
'
)
@click.option
(
'
--strain_name
'
,
'
-n
'
,
default
=
None
,
type
=
click
.
STRING
,
required
=
True
)
@click.option
(
'
--output1
'
,
'
-f
'
,
default
=
None
,
type
=
click
.
Path
(
exists
=
False
,
file_okay
=
True
,
dir_okay
=
False
,
readable
=
True
,
resolve_path
=
True
),
required
=
True
,
show_default
=
True
,
help
=
'
Path to output specific proteins sequences fasta file
'
)
@click.option
(
'
--output2
'
,
'
-c
'
,
default
=
None
,
type
=
click
.
Path
(
exists
=
False
,
file_okay
=
True
,
dir_okay
=
False
,
readable
=
True
,
resolve_path
=
True
),
required
=
True
,
show_default
=
True
,
help
=
'
Path to output specific orthogroups csv file
'
)
@click.option
(
'
--path_seq
'
,
'
-p
'
,
default
=
None
,
type
=
click
.
STRING
,
help
=
'
path to orthogroup sequences
'
,
required
=
True
)
def
main
(
orthogroups_table
,
strain_name
,
path_seq
,
output1
,
output2
):
gene_counts
=
pd
.
read_table
(
orthogroups_table
,
sep
=
'
\t
'
)
specific
=
gene_counts
[
gene_counts
[
strain_name
]
!=
0
]
specific
=
specific
[
specific
[
"
Total
"
]
==
specific
[
strain_name
]]
file
=
""
list_record
=
[]
for
name
in
specific
[
"
Orthogroup
"
]:
file
=
str
(
path_seq
)
+
str
(
name
)
+
"
.fa
"
for
record
in
SeqIO
.
parse
(
file
,
"
fasta
"
):
list_record
.
append
(
record
)
SeqIO
.
write
(
list_record
,
str
(
output1
),
"
fasta
"
)
specific
.
to_csv
(
str
(
output2
))
if
__name__
==
'
__main__
'
:
main
()
\ No newline at end of file
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