Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TDP Comparative Tools
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
MSBio
TDP Comparative Tools
Commits
7e58d4ae
Commit
7e58d4ae
authored
2 years ago
by
Karen DRUART
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
75ede96f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ProForma-Exporters/20210819-ProForma-formatter-MSPT.cs
+115
-0
115 additions, 0 deletions
ProForma-Exporters/20210819-ProForma-formatter-MSPT.cs
with
115 additions
and
0 deletions
ProForma-Exporters/20210819-ProForma-formatter-MSPT.cs
0 → 100644
+
115
−
0
View file @
7e58d4ae
using
System
;
using
System.IO
;
using
System.Data
;
using
System.Text
;
namespace
ProFormaFormatter
{
class
Program
{
static
void
Main
(
string
[]
args
)
{
if
(
args
.
Length
==
0
)
{
Console
.
WriteLine
(
"Supply the name of the _IcTarget.tsv file for processing."
);
Environment
.
Exit
(
1
);
}
DataTable
datatable
=
new
DataTable
();
string
FileString
=
args
[
0
];
StreamReader
streamreader
=
new
StreamReader
(
FileString
);
//skip the header
// for (int i=0; i<27; i++) {
// string Header=streamreader.ReadLine();
// Console.WriteLine(Header);
// }
char
[]
delimiter
=
new
char
[]
{
'\t'
};
char
[]
PathDelimiters
=
new
char
[]
{
'\\'
,
'/'
};
string
FNameTrailer
=
"_IcTarget.tsv"
;
string
[]
columnheaders
=
streamreader
.
ReadLine
().
Split
(
delimiter
);
foreach
(
string
columnheader
in
columnheaders
)
{
datatable
.
Columns
.
Add
(
columnheader
);
}
while
(
streamreader
.
Peek
()
>
0
)
{
DataRow
datarow
=
datatable
.
NewRow
();
datarow
.
ItemArray
=
streamreader
.
ReadLine
().
Split
(
delimiter
);
datatable
.
Rows
.
Add
(
datarow
);
}
foreach
(
DataRow
row
in
datatable
.
Rows
)
{
// string FName = Convert.ToString(row["Data file name"]);
string
OutScan
=
Convert
.
ToString
(
row
[
"Scan"
]);
string
OutProForma
=
Convert
.
ToString
(
row
[
"Sequence"
]);
string
OutSequence
=
OutProForma
;
string
OutCharge
=
Convert
.
ToString
(
row
[
"Charge"
]);
string
OutAccession
=
Convert
.
ToString
(
row
[
"ProteinName"
]);
int
OutMassAdded
=
0
;
string
PTMs
=
Convert
.
ToString
(
row
[
"Modifications"
]);
float
Probability
=
Convert
.
ToSingle
(
row
[
"Probability"
]);
float
Evalue
=
Convert
.
ToSingle
(
row
[
"EValue"
]);
double
OutEVal
=
-
Math
.
Log
(
Convert
.
ToDouble
(
row
[
"EValue"
]));
if
((
Probability
>
0.5
)
&&
(
Evalue
<
0.01
))
{
// string[] FNameChunks = FName.Split(PathDelimiters);
string
OutFile
=
FileString
;
if
(
OutFile
.
EndsWith
(
FNameTrailer
))
{
OutFile
=
OutFile
.
Substring
(
0
,
OutFile
.
Length
-
FNameTrailer
.
Length
);
}
// Parse out just the second bit of the UniProt accession
string
[]
AccessionArray
=
OutAccession
.
Split
(
'|'
);
OutAccession
=
AccessionArray
[
1
];
// Create a decorated sequence by incorporating PTM string data.
string
[]
PTMArray
=
PTMs
.
Split
(
','
);
int
CurrentOutProFormaPos
=
0
;
StringBuilder
DecoratedOutProForma
=
new
StringBuilder
();
foreach
(
string
ThisPTM
in
PTMArray
)
{
if
(
ThisPTM
.
Length
>
0
)
{
string
[]
PTMFields
=
ThisPTM
.
Split
(
' '
);
int
Pos
=
Convert
.
ToInt32
(
PTMFields
[
1
]);
string
PTMID
=
PTMFields
[
0
];
if
(
PTMID
==
"Oxidation"
)
OutMassAdded
+=
16
;
else
if
(
PTMID
==
"Methyl"
)
OutMassAdded
+=
14
;
else
if
(
PTMID
==
"Acetyl"
)
OutMassAdded
+=
42
;
else
if
(
PTMID
==
"Carbamidomethyl"
)
OutMassAdded
+=
57
;
else
if
(
PTMID
==
"Phospho"
)
OutMassAdded
+=
80
;
if
(
Pos
==
0
)
{
DecoratedOutProForma
.
Append
(
"["
);
DecoratedOutProForma
.
Append
(
Convert
.
ToString
(
PTMFields
[
0
]));
DecoratedOutProForma
.
Append
(
"]-"
);
DecoratedOutProForma
.
Append
(
OutProForma
.
Substring
(
CurrentOutProFormaPos
,
Pos
-
CurrentOutProFormaPos
));
}
else
{
DecoratedOutProForma
.
Append
(
OutProForma
.
Substring
(
CurrentOutProFormaPos
,
Pos
-
CurrentOutProFormaPos
));
DecoratedOutProForma
.
Append
(
"["
);
DecoratedOutProForma
.
Append
(
Convert
.
ToString
(
PTMFields
[
0
]));
DecoratedOutProForma
.
Append
(
"]"
);
}
CurrentOutProFormaPos
=
Pos
;
}
}
DecoratedOutProForma
.
Append
(
OutProForma
.
Substring
(
CurrentOutProFormaPos
));
OutProForma
=
Convert
.
ToString
(
DecoratedOutProForma
);
Console
.
Write
(
OutFile
);
Console
.
Write
(
"\t"
);
Console
.
Write
(
OutScan
);
Console
.
Write
(
"\t"
);
Console
.
Write
(
OutCharge
);
Console
.
Write
(
"\t"
);
Console
.
Write
(
OutAccession
);
Console
.
Write
(
"\t"
);
Console
.
Write
(
OutSequence
);
Console
.
Write
(
"\t"
);
Console
.
Write
(
OutMassAdded
);
Console
.
Write
(
"\t"
);
Console
.
Write
(
OutProForma
);
Console
.
Write
(
"\t"
);
Console
.
WriteLine
(
OutEVal
);
}
}
}
}
}
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