Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
IMP
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
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
IMP-dev
IMP
Commits
72cbd15e
Commit
72cbd15e
authored
9 years ago
by
Shaman Narayanasamy
Browse files
Options
Downloads
Patches
Plain Diff
Handle exceptions in R script; Robustification
parent
3fa64749
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
src/IMP_visualize_MGMT.R
+10
-4
10 additions, 4 deletions
src/IMP_visualize_MGMT.R
with
10 additions
and
4 deletions
src/IMP_visualize_MGMT.R
+
10
−
4
View file @
72cbd15e
...
...
@@ -172,27 +172,33 @@ annot.1 <- as.data.frame(
colnames
(
annot.1
)
<-
c
(
"contig"
,
"start"
,
"end"
,
"database"
)
# Remove rows with no start and stop positions
annot.1
<-
annot.1
[
-
is.na
(
annot.1
$
start
),]
annot.1
<-
annot.1
[
-
is.na
(
annot.1
$
end
),]
if
(
nrow
(
annot.1
[
is.na
(
annot.1
$
start
),])
!=
0
)
{
annot.1
<-
annot.1
[
-
is.na
(
annot.1
$
start
),]
}
else
if
(
nrow
(
annot.1
[
is.na
(
annot.1
$
end
),])
!=
0
)
{
annot.1
<-
annot.1
[
-
is.na
(
annot.1
$
end
),]
}
else
{
print
(
"Genes are OK!"
)
}
# Replace non-annotated gens with NA
annot.1
$
database
[
annot.1
$
database
==
""
]
=
NA
annot.1
[,
2
:
3
]
<-
sapply
(
annot.1
[
2
:
3
],
as.character
)
annot.1
[,
2
:
3
]
<-
sapply
(
annot.1
[
2
:
3
],
as.numeric
)
# calculate no. of gene length
print
(
"Calculating no. of genes per contig"
)
annot.2
<-
as.data.frame
(
table
(
annot.1
$
contig
))
colnames
(
annot.2
)[
1
:
ncol
(
annot.2
)]
<-
c
(
"contig"
,
"no_of_genes"
)
save.image
()
# calculate gene lengths
print
(
"Calculating length of genes from gff3 file"
)
annot.1
<-
as.data.frame
(
cbind
(
annot.1
,
annot.1
$
end
-
annot.1
$
start
+
1
))
colnames
(
annot.1
)[
ncol
(
annot.1
)]
<-
"gene_length"
# aggregate table and calculate total gene lengths within contig
save.image
(
name_plot
(
"MGMT_results.Rdat"
))
print
(
"Calculating coding density of contigs"
)
# Create temporary table
total_gene_length
<-
aggregate
(
gene_length
~
contig
,
data
=
annot.1
,
FUN
=
sum
)
...
...
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