Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
i2MassChroQ
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
A compter du 1er avril, attention à vos pipelines :
Nouvelles limitations de Docker Hub
Show more breadcrumbs
PAPPSO
i2MassChroQ
Commits
4de67483
Commit
4de67483
authored
11 years ago
by
Olivier Langella
Browse files
Options
Downloads
Patches
Plain Diff
XPIP file writer moved in output package with a writer
parent
4810cdc0
No related branches found
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/fr/inra/pappso/xtandempipeline/class_msms/XpipFile.java
+19
-4
19 additions, 4 deletions
src/fr/inra/pappso/xtandempipeline/class_msms/XpipFile.java
src/fr/inra/pappso/xtandempipeline/sax_parse/save_project.java
+0
-215
0 additions, 215 deletions
...r/inra/pappso/xtandempipeline/sax_parse/save_project.java
with
19 additions
and
219 deletions
src/fr/inra/pappso/xtandempipeline/class_msms/XpipFile.java
+
19
−
4
View file @
4de67483
...
...
@@ -23,8 +23,10 @@ package fr.inra.pappso.xtandempipeline.class_msms;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.net.URL
;
import
java.net.URLConnection
;
...
...
@@ -32,9 +34,9 @@ import org.apache.log4j.Logger;
import
fr.inra.pappso.xtandempipeline.XtandemPipelineSession
;
import
fr.inra.pappso.xtandempipeline.MsException.MSMSException
;
import
fr.inra.pappso.xtandempipeline.output.XpipOutput
;
import
fr.inra.pappso.xtandempipeline.sax_parse.load_project
;
import
fr.inra.pappso.xtandempipeline.sax_parse.parse_file
;
import
fr.inra.pappso.xtandempipeline.sax_parse.save_project
;
import
fr.inra.pappso.xtandempipeline.thread.process
;
public
class
XpipFile
{
...
...
@@ -88,8 +90,6 @@ public class XpipFile {
public
void
write
(
process
save_result_and_filtering
,
XtandemPipelineSession
session
)
throws
Exception
{
save_project
save
=
new
save_project
(
session
.
getIdentificationList
(),
session
.
getDataTypeBase
(),
save_result_and_filtering
);
if
(
xpipFile
==
null
)
{
String
message
=
"Unable to write XPIP data to an URL ("
+
urlOfXpipData
.
toString
()
...
...
@@ -97,7 +97,22 @@ public class XpipFile {
logger
.
debug
(
message
);
throw
new
MSMSException
(
message
);
}
save
.
write_data_to
(
xpipFile
);
XpipOutput
xpipOutput
=
new
XpipOutput
();
OutputStream
outputStream
=
new
FileOutputStream
(
this
.
xpipFile
);
xpipOutput
.
open
(
outputStream
);
xpipOutput
.
write
(
session
.
getIdentificationList
(),
session
.
getDataTypeBase
(),
save_result_and_filtering
);
xpipOutput
.
close
();
/*
* save_project save = new save_project(session.getIdentificationList(),
* session.getDataTypeBase(), save_result_and_filtering); if (xpipFile
* == null) { String message = "Unable to write XPIP data to an URL (" +
* urlOfXpipData.toString() + "). Try \"Save project as\" instead.";
* logger.debug(message); throw new MSMSException(message); }
* save.write_data_to(xpipFile);
*/
this
.
modified
=
false
;
}
...
...
This diff is collapsed.
Click to expand it.
src/fr/inra/pappso/xtandempipeline/sax_parse/save_project.java
deleted
100644 → 0
+
0
−
215
View file @
4810cdc0
package
fr.inra.pappso.xtandempipeline.sax_parse
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.OutputStreamWriter
;
import
java.util.ArrayList
;
import
javax.xml.stream.XMLOutputFactory
;
//import com.sun.xml.internal.txw2.output.IndentingXMLStreamWriter;
import
javax.xml.stream.XMLStreamWriter
;
import
org.apache.log4j.Logger
;
import
fr.inra.moulon.proticport.model.Controller
;
import
fr.inra.pappso.xtandempipeline.XtandemPipelineMain
;
import
fr.inra.pappso.xtandempipeline.XtandemPipelineSession
;
import
fr.inra.pappso.xtandempipeline.class_msms.Identification
;
import
fr.inra.pappso.xtandempipeline.class_msms.Match
;
import
fr.inra.pappso.xtandempipeline.class_msms.Modifs
;
import
fr.inra.pappso.xtandempipeline.class_msms.MsRun
;
import
fr.inra.pappso.xtandempipeline.class_msms.MapDb.Peptide
;
import
fr.inra.pappso.xtandempipeline.thread.DataType_Base
;
import
fr.inra.pappso.xtandempipeline.thread.process
;
public
class
save_project
{
private
static
final
Logger
logger
=
Logger
.
getLogger
(
save_project
.
class
);
private
ArrayList
<
Identification
>
idents
;
private
DataType_Base
datatype
;
private
XMLStreamWriter
writer
;
final
private
String
endline
=
System
.
getProperty
(
"line.separator"
);
private
process
pro
;
public
save_project
(
ArrayList
<
Identification
>
identifications
,
DataType_Base
datatype
,
process
p
)
{
this
.
idents
=
identifications
;
this
.
datatype
=
datatype
;
this
.
pro
=
p
;
}
public
void
write_data_to
(
File
save
)
throws
Exception
{
logger
.
info
(
"Save project ..."
);
XMLOutputFactory
outputFactory
=
XMLOutputFactory
.
newInstance
();
// FileWriter output = new FileWriter(save);
OutputStreamWriter
output
=
new
OutputStreamWriter
(
new
FileOutputStream
(
save
),
"UTF8"
);
writer
=
outputFactory
.
createXMLStreamWriter
(
output
);
// this.writer = outputFactory.createXMLStreamWriter(output);
writer
.
writeStartDocument
(
"UTF-8"
,
"1.0"
);
writer
.
writeCharacters
(
endline
);
writer
.
writeStartElement
(
"xtandem_pipeline"
);
writer
.
writeAttribute
(
"version"
,
XtandemPipelineMain
.
version
);
// <DataSource>
// <PROTICport
// url="http://uln.moulon.inra.fr/~langella/proticdev/web_view/proticport/"
// user="langella" />
// </DataSource>
if
(
XtandemPipelineSession
.
getInstance
().
isPROTICportDataSource
())
{
writer
.
writeStartElement
(
"DataSource"
);
writer
.
writeEmptyElement
(
"PROTICport"
);
Controller
ppc
=
XtandemPipelineSession
.
getInstance
()
.
getPROTICportController
();
writer
.
writeAttribute
(
"url"
,
ppc
.
getProticPortUrl
().
toString
());
writer
.
writeAttribute
(
"user"
,
ppc
.
getUser
().
getLogin
());
writer
.
writeEndElement
();
}
writer
.
writeEmptyElement
(
"information"
);
writer
.
writeAttribute
(
"Data_Type"
,
datatype
.
getType
());
int
count
=
0
;
for
(
Identification
ident
:
idents
)
count
+=
ident
.
get_protein_liste
().
size
();
writer
.
writeAttribute
(
"match_number"
,
""
+
count
);
writer
.
writeEmptyElement
(
"filter_params"
);
writer
.
writeAttribute
(
"pep_evalue"
,
""
+
datatype
.
getConf
().
get_peptide_evalue
());
writer
.
writeAttribute
(
"prot_evalue"
,
""
+
datatype
.
getConf
().
get_protein_evalue
());
writer
.
writeAttribute
(
"pep_number"
,
""
+
datatype
.
getConf
().
get_peptide_number
());
writer
.
writeAttribute
(
"filter_to_all"
,
""
+
datatype
.
getConf
().
get_protein_filter_to_complete
());
writer
.
writeAttribute
(
"database_filter"
,
datatype
.
getConf
()
.
get_database_filter
().
getPath
());
writer
.
writeCharacters
(
endline
);
writer
.
writeStartElement
(
"identifications"
);
writer
.
writeCharacters
(
endline
);
for
(
Identification
ident
:
idents
)
this
.
write_result_to
(
ident
);
writer
.
writeEndElement
();
// on ferme le root
writer
.
writeEndElement
();
writer
.
writeEndDocument
();
writer
.
flush
();
writer
.
close
();
output
.
close
();
logger
.
info
(
"Save project finish"
);
}
private
void
write_result_to
(
Identification
ident
)
throws
Exception
{
writer
.
writeStartElement
(
"identification"
);
writer
.
writeCharacters
(
endline
);
writer
.
writeStartElement
(
"modifs_list_mass"
);
for
(
Modifs
mod
:
ident
.
get_modifs_liste
().
get_modifs_order
())
{
writer
.
writeEmptyElement
(
"modifs_mass"
);
writer
.
writeAttribute
(
"modvalue"
,
""
+
mod
.
get_modvalue
());
writer
.
writeCharacters
(
endline
);
}
writer
.
writeEndElement
();
writer
.
writeStartElement
(
"samples"
);
for
(
MsRun
samp
:
ident
.
getMsRunSet
())
{
writer
.
writeEmptyElement
(
"sample"
);
writer
.
writeAttribute
(
"value"
,
samp
.
getSampleName
());
writer
.
writeCharacters
(
endline
);
}
writer
.
writeEndElement
();
writer
.
writeStartElement
(
"match_list"
);
for
(
Match
m
:
ident
.
get_protein_liste
().
getMatchOrder
())
this
.
write_match_to
(
m
,
ident
);
writer
.
writeEndElement
();
// on ferme l'ident
writer
.
writeEndElement
();
// writer.flush();
}
private
void
write_match_to
(
Match
m
,
Identification
ident
)
throws
Exception
{
writer
.
writeStartElement
(
"match"
);
writer
.
writeAttribute
(
"validate"
,
""
+
m
.
isIsvalidate
());
writer
.
writeAttribute
(
"PAI"
,
""
+
m
.
getPAI
());
writer
.
writeAttribute
(
"emPAI"
,
""
+
m
.
getEmPAI
());
writer
.
writeStartElement
(
"protein"
);
writer
.
writeAttribute
(
"peptide_number"
,
""
+
m
.
get_protein_match
().
get_peptides_numbers
());
writer
.
writeAttribute
(
"evalue"
,
""
+
m
.
get_protein_match
().
get_evalue
());
writer
.
writeAttribute
(
"URL"
,
m
.
get_protein_match
().
getDatabase
()
.
getDatabasePath
());
writer
.
writeAttribute
(
"description"
,
m
.
get_protein_match
()
.
get_description
());
// sample evalue
for
(
MsRun
sample
:
m
.
get_protein_match
().
get_hash_sample_evalue
()
.
keySet
())
{
writer
.
writeEmptyElement
(
"protein_evalue"
);
writer
.
writeAttribute
(
"evalue"
,
""
+
m
.
get_protein_match
().
get_hash_sample_evalue
()
.
get
(
sample
));
writer
.
writeAttribute
(
"sample"
,
sample
.
getSampleName
());
// writer.writeCharacters(endline);
}
writer
.
writeStartElement
(
"sequence"
);
writer
.
writeCharacters
(
m
.
get_protein_match
().
get_sequence
());
writer
.
writeEndElement
();
writer
.
writeEndElement
();
writer
.
writeStartElement
(
"peptide_list"
);
for
(
Peptide
pep
:
m
.
get_all_peptides
())
this
.
write_peptide_to
(
pep
);
writer
.
writeEndElement
();
// on ferme le match
writer
.
writeEndElement
();
// on compte les match
pro
.
add_current_progress
();
}
private
void
write_peptide_to
(
Peptide
pep
)
throws
Exception
{
writer
.
writeStartElement
(
"peptide"
);
writer
.
writeAttribute
(
"sample"
,
pep
.
get_sample
());
pep
.
getIdentificationDataSource
().
writeXpipPeptideSourceAttribute
(
writer
);
writer
.
writeAttribute
(
"scan"
,
""
+
pep
.
get_scan
());
writer
.
writeAttribute
(
"scan_in_xtandem"
,
""
+
pep
.
get_scan
());
writer
.
writeAttribute
(
"RT"
,
""
+
pep
.
get_RT_in_sec
());
writer
.
writeAttribute
(
"mhplus_obser"
,
""
+
pep
.
get_mhplus_obser
());
writer
.
writeAttribute
(
"mhplus_theo"
,
""
+
pep
.
get_mhplus_theo
());
writer
.
writeAttribute
(
"deltamass"
,
""
+
pep
.
get_deltamass
());
writer
.
writeAttribute
(
"sequence"
,
pep
.
getSequence
());
writer
.
writeAttribute
(
"pre"
,
pep
.
get_pre
());
writer
.
writeAttribute
(
"post"
,
pep
.
get_post
());
writer
.
writeAttribute
(
"start"
,
""
+
pep
.
get_start
());
writer
.
writeAttribute
(
"stop"
,
""
+
pep
.
get_stop
());
writer
.
writeAttribute
(
"charge"
,
""
+
pep
.
get_charge
());
writer
.
writeAttribute
(
"evalue"
,
""
+
pep
.
get_evalue
());
writer
.
writeAttribute
(
"hypercorr"
,
""
+
pep
.
get_hypercorr
());
writer
.
writeAttribute
(
"validate"
,
""
+
pep
.
isValidate
());
writer
.
writeCharacters
(
endline
);
writer
.
writeStartElement
(
"modifs"
);
for
(
Modifs
mod
:
pep
.
get_Modifs
())
{
writer
.
writeEmptyElement
(
"modif"
);
writer
.
writeAttribute
(
"aa"
,
""
+
mod
.
get_AA
());
writer
.
writeAttribute
(
"modvalue"
,
""
+
mod
.
get_modvalue
());
writer
.
writeAttribute
(
"posi"
,
""
+
mod
.
get_posi
());
writer
.
writeAttribute
(
"posi_in_prot"
,
""
+
mod
.
getPosi_in_prot
());
writer
.
writeCharacters
(
endline
);
}
writer
.
writeEndElement
();
// on ferme le peptide
writer
.
writeEndElement
();
}
}
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