Skip to content

Commit

Permalink
Merge pull request #47 from EBI-IntAct/export-datasets-on-mitab-format
Browse files Browse the repository at this point in the history
Export datasets on mitab format
  • Loading branch information
jmedinaebi authored Sep 27, 2024
2 parents cd95a06 + 0da9d8a commit 5d7fb74
Show file tree
Hide file tree
Showing 33 changed files with 61 additions and 41 deletions.
2 changes: 1 addition & 1 deletion complex-go-export/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<artifactId>complex-go-export</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion complex-pdb-export/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<artifactId>complex-pdb-export</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion complex-tab-export/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>


Expand Down
2 changes: 1 addition & 1 deletion complex-uniprot-dr-export/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<artifactId>complex-uniprot-dr-export</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion cttv-exporter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion imex-id-update/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<groupId>uk.ac.ebi.intact.dataexchange.imex</groupId>
Expand Down
2 changes: 1 addition & 1 deletion intact-cvutils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion intact-db-importer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<artifactId>intact-db-importer</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion intact-enricher/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>intact-dataexchange-master</artifactId>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion intact-mi-cluster-score/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>intact-dataexchange-master</artifactId>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<artifactId>intact-mi-cluster-score</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion intact-mutation-export/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion intact-orthology-import/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<artifactId>intact-orthology-import</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion intact-pdbe-import/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion intact-tasks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package uk.ac.ebi.intact.task.mitab.pmid;

import java.util.Date;
import java.util.List;

/**
* The publication entry is an mitab inputstream with a few information about the publication. A publicationEntry only contains interactions of a same publication.
Expand Down Expand Up @@ -29,8 +30,14 @@ public class PublicationFileEntry implements Comparable<PublicationFileEntry>{
private boolean isNegative;

private String publicationDate;

public PublicationFileEntry(Date createdDate, String pubId, StringBuffer mitab, boolean isNegative, String publicationDate){
private List<String> datasets;

public PublicationFileEntry(Date createdDate,
String pubId,
StringBuffer mitab,
boolean isNegative,
String publicationDate,
List<String> datasets) {
super();
this.createdDate = createdDate;
this.entryName = pubId;
Expand All @@ -42,6 +49,7 @@ public PublicationFileEntry(Date createdDate, String pubId, StringBuffer mitab,
}
this.isNegative = isNegative;
this.publicationDate = publicationDate;
this.datasets = datasets;
}

public Date getCreatedDate() {
Expand Down Expand Up @@ -72,6 +80,14 @@ public void setPublicationDate(String publicationDate) {
this.publicationDate = publicationDate;
}

public List<String> getDatasets() {
return datasets;
}

public void setDatasets(List<String> datasets) {
this.datasets = datasets;
}

@Override
public int compareTo(PublicationFileEntry o) {
final int BEFORE = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
import uk.ac.ebi.intact.task.mitab.InteractionExpansionCompositeProcessor;
import uk.ac.ebi.intact.task.util.FileNameGenerator;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Pattern;

Expand Down Expand Up @@ -134,25 +132,30 @@ public SortedSet<PublicationFileEntry> process(Publication item) throws Exceptio
}

String publicationDate = null;
List<String> datasets = new ArrayList<>();
Collection<Annotation> pubAnnotations = AnnotatedObjectUtils.getPublicAnnotations(publication);
for (Annotation annot : pubAnnotations){
for (Annotation annot : pubAnnotations) {
if (annot.getCvTopic() != null){
// date
if (CvTopic.PUBLICATION_YEAR_MI_REF.equals(annot.getCvTopic().getIdentifier())) {
if (PUBLICATION_DATE_REGEX.matcher(annot.getAnnotationText()).matches()) {
publicationDate = annot.getAnnotationText();
}
}
// dataset
if (CvTopic.DATASET_MI_REF.equals(annot.getCvTopic().getIdentifier())) {
datasets.add(annot.getAnnotationText());
}
}
}

if (this.currentNegativeStringBuilder.length() > 0){
createPublicationEntry(
publicationEntries, publication.getCreated(), publication.getShortLabel(), this.currentNegativeStringBuilder, true, publicationDate);
publicationEntries, publication.getCreated(), publication.getShortLabel(), this.currentNegativeStringBuilder, true, publicationDate, datasets);
}
if (this.currentStringBuilder.length() > 0){
createPublicationEntry(
publicationEntries, publication.getCreated(), publication.getShortLabel(), this.currentStringBuilder, false, publicationDate);
publicationEntries, publication.getCreated(), publication.getShortLabel(), this.currentStringBuilder, false, publicationDate, datasets);
}

IntactContext.getCurrentInstance().getDaoFactory().getEntityManager().clear();
Expand Down Expand Up @@ -228,15 +231,16 @@ private void createPublicationEntry(Set<PublicationFileEntry> publicationEntries
String publicationName,
StringBuffer mitab,
boolean isNegative,
String publicationDate) {
String publicationDate,
List<String> datasets) {
log.info("create publication entry : " + publicationName);

// create a publication name
// name of the entry = publicationId_experimentLabel_chunkNumber
String entryName = publicationNameGenerator.createPublicationName(publicationName, null, isNegative);

// create a publication entry
PublicationFileEntry publicationEntry = new PublicationFileEntry(date, entryName, mitab, isNegative, publicationDate);
PublicationFileEntry publicationEntry = new PublicationFileEntry(date, entryName, mitab, isNegative, publicationDate, datasets);
// add the publication entry to the list of publication entries
publicationEntries.add(publicationEntry);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ public void test_write_publications() throws Exception {

PublicationFileEntry oldEntryWithNoPublicationDate = pubWithNoPublicationDateEntries.iterator().next();
PublicationFileEntry newEntryWithNoPublicationDate = new PublicationFileEntry(
dateFormatForEntry.parse(secondCreatedDate), "12345_10", oldEntryWithNoPublicationDate.getBinaryInteractions(), false, null);
dateFormatForEntry.parse(secondCreatedDate), "12345_10", oldEntryWithNoPublicationDate.getBinaryInteractions(), false, null, new ArrayList<>());
pubWithNoPublicationDateEntries2.add(newEntryWithNoPublicationDate);
PublicationFileEntry oldEntryWithPublicationDate = pubWithPublicationDateEntries.iterator().next();
PublicationFileEntry newEntryWithPublicationDate = new PublicationFileEntry(
dateFormatForEntry.parse(secondCreatedDate), "98765_10", oldEntryWithPublicationDate.getBinaryInteractions(), false, secondPublicationDate);
dateFormatForEntry.parse(secondCreatedDate), "98765_10", oldEntryWithPublicationDate.getBinaryInteractions(), false, secondPublicationDate, new ArrayList<>());
pubWithPublicationDateEntries2.add(newEntryWithPublicationDate);

DateFormat format = new SimpleDateFormat("yyyy");
Expand Down
2 changes: 1 addition & 1 deletion intact-uniprot-export/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<packaging>pom</packaging>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>

<name>IntAct Data Exchange</name>
<description>Data Exchange Master POM</description>
Expand Down
2 changes: 1 addition & 1 deletion psimi/intact-psimi-exporter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange.psimi</groupId>
<artifactId>intact-psimi-master</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<artifactId>intact-psimi-exporter</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion psimi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion psimi/psimitab/intact-calimocho-converters/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>psimitab-master</artifactId>
<groupId>uk.ac.ebi.intact.dataexchange.psimi</groupId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<artifactId>intact-calimocho-converters</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion psimi/psimitab/intact-jami-mitab/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange.psimi</groupId>
<artifactId>psimitab-master</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<artifactId>intact-jami-mitab</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion psimi/psimitab/intact-psimitab-converters/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>psimitab-master</artifactId>
<groupId>uk.ac.ebi.intact.dataexchange.psimi</groupId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion psimi/psimitab/intact-solr-home/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>psimitab-master</artifactId>
<groupId>uk.ac.ebi.intact.dataexchange.psimi</groupId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion psimi/psimitab/intact-solr/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>psimitab-master</artifactId>
<groupId>uk.ac.ebi.intact.dataexchange.psimi</groupId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion psimi/psimitab/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange.psimi</groupId>
<artifactId>intact-psimi-master</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion psimi/psixml/intact-jami-xml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange.psimi</groupId>
<artifactId>intact-psixml</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<artifactId>intact-jami-xml</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion psimi/psixml/intact-psixml-converters/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>intact-psixml</artifactId>
<groupId>uk.ac.ebi.intact.dataexchange.psimi</groupId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion psimi/psixml/intact-psixml-dbimporter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>intact-psixml</artifactId>
<groupId>uk.ac.ebi.intact.dataexchange.psimi</groupId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<artifactId>intact-psixml-dbimporter</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion psimi/psixml/intact-psixml-exchange/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange.psimi</groupId>
<artifactId>intact-psixml</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion psimi/psixml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange.psimi</groupId>
<artifactId>intact-psimi-master</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion structured-abstract/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.3.0-SNAPSHOT</version>
</parent>

<artifactId>structured-abstract</artifactId>
Expand Down

0 comments on commit 5d7fb74

Please sign in to comment.