Skip to content

Conversation

@josemduarte
Copy link
Contributor

Adding _entity and _entity_poly to CIF output, so that some more metadata is available for consumers.

Also:

  • now adding seqres groups to Chains when no entity info is present in input file
  • upgrading to latest ciftools-java

@josemduarte josemduarte requested a review from sbittrich May 24, 2023 21:03
entityDescriptions[i] = e.getDescription() == null? "?" : e.getDescription();
}

String[] polyEntityIds = entityInfos.stream().filter(e -> e.getType() == EntityType.POLYMER).map(e -> Integer.toString(e.getMolId())).collect(Collectors.toList()).toArray(new String[]{});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Streams have a toArray method as well. .collect(Collectors.toList()).toArray(new String[]{}) can be simplified to .toArray(String[]::new), effectively skipping the creation of a List.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one, thanks. Added a commit.

And shame to IntelliJ for not suggesting this!

Copy link
Member

@sbittrich sbittrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, code looks good and should solve our problem.
There are 2 stream expressions that can be simplified.

}

String[] polyEntityIds = entityInfos.stream().filter(e -> e.getType() == EntityType.POLYMER).map(e -> Integer.toString(e.getMolId())).collect(Collectors.toList()).toArray(new String[]{});
String[] polyEntitySeqs = entityInfos.stream().filter(e -> e.getType() == EntityType.POLYMER).map(e -> e.getChains().get(0).getSeqResSequence()).collect(Collectors.toList()).toArray(new String[]{});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Copy link
Member

@sbittrich sbittrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@josemduarte josemduarte merged commit d09477e into biojava:master Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants