Skip to content

Commit

Permalink
Made VCF export thru BrAPI also able to include sequence lengths
Browse files Browse the repository at this point in the history
  • Loading branch information
GuilhemSempere committed Sep 2, 2021
1 parent 0b7e01a commit fb5d806
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<groupId>fr.cirad</groupId>
<artifactId>Mgdb2BrapiV2Impl</artifactId>
<packaging>jar</packaging>
<version>2.0-RELEASE</version>
<version>2.0.1-RELEASE</version>
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<Gigwa2ServiceImpl.version>2.4-RELEASE</Gigwa2ServiceImpl.version>
<Gigwa2ServiceImpl.version>2.4.1-RELEASE</Gigwa2ServiceImpl.version>
</properties>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
Expand All @@ -17,7 +17,7 @@
<dependency>
<groupId>fr.cirad</groupId>
<artifactId>Mgdb2BrapiImpl</artifactId>
<version>1.1-RELEASE</version>
<version>1.1.1-RELEASE</version>
</dependency>
<dependency>
<groupId>fr.cirad</groupId>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/brapi/v2/api/VariantsetsApiController.java
Original file line number Diff line number Diff line change
Expand Up @@ -703,14 +703,14 @@ public void run() {
VariantContextWriter writer = null;
List<String> distinctSequenceNames = new ArrayList<String>();

for (Object chr : mongoTemplate.getCollection(mongoTemplate.getCollectionName(VariantData.class)).distinct(VariantData.FIELDNAME_REFERENCE_POSITION + "." + ReferencePosition.FIELDNAME_SEQUENCE, varQuery, String.class)) // find out distinctSequenceNames by looking at exported variant list
for (Object chr : mongoTemplate.getCollection(mongoTemplate.getCollectionName(VariantRunData.class)).distinct(VariantData.FIELDNAME_REFERENCE_POSITION + "." + ReferencePosition.FIELDNAME_SEQUENCE, varQuery, String.class)) // find out distinctSequenceNames by looking at exported variant list
if (chr != null)
distinctSequenceNames.add(chr.toString());

Collections.sort(distinctSequenceNames, new AlphaNumericComparator());
SAMSequenceDictionary dict = exportHandler.createSAMSequenceDictionary(module, distinctSequenceNames);
writer = new CustomVCFWriter(null, os, dict, false, false, true);
exportHandler.writeGenotypeFile(module, new ArrayList<>(), new ArrayList<>(), progress, varColl.getNamespace().getCollectionName(), varQuery, (long) variantSet.getVariantCount(), null, null, null, samplesToExport, samplesToExport.stream().map(gs -> gs.getIndividual()).distinct().sorted(new AlphaNumericComparator<String>()).collect(Collectors.toList()), distinctSequenceNames, null, writer);
exportHandler.writeGenotypeFile(module, new ArrayList<>(), new ArrayList<>(), progress, varColl.getNamespace().getCollectionName(), varQuery, (long) variantSet.getVariantCount(), null, null, null, samplesToExport, samplesToExport.stream().map(gs -> gs.getIndividual()).distinct().sorted(new AlphaNumericComparator<String>()).collect(Collectors.toList()), distinctSequenceNames, dict, null, writer);

exportThreads.remove(exportId);
} catch (Exception ex) {
Expand Down

0 comments on commit fb5d806

Please sign in to comment.