Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically generated vcf content #420

Merged
merged 6 commits into from
Jun 17, 2016

Conversation

piotr-gawron
Copy link
Contributor

@piotr-gawron piotr-gawron commented Jun 14, 2016

This pull request contains simple functionality that allows to visualize vcf files that were dynamically created in memory by javascript code.

Ideally it would be great to have possibility to create dynamic content for variant track. Here I provide a simple tool that allows it to some extend. When creating variant track there is possibility to intialize it with the content of vcf file instead of url.

Of course it should be used for small dynamic content.

Some technical comments:

  • I implemented LocalStringFile that has the same interface as RemoteFile. This class is initialized with content of the file in a String
  • There is "abstract" class that is a super class for LocalStringFile and RemoteFile. However, due to some lint and facebook/flow restrictions implementation of this class is not perfect (it allows instantiation, method signature doesn't contain return type)
  • There are tests for new functionalities
  • Implementation of LocalStringFile will probably break when input string contain characters that need more than one byte, but for VCF files it's enough

This change is Reviewable

…o attach dynamically generated data (instead from files it will be taken from a string source that represents content of the file)
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 91.574% when pulling c288d42 on piotr-gawron:string-virtual-file into afe2971 on hammerlab:master.

* AbstractFile is an abstract representation of a file. There are two implementation:
* 1. RemoteFile - representation of a file on a remote server which can be
* fetched in chunks, e.g. using a Range request.
* 2. LoclaStringFile is a representation of a file that was created from input string.
Copy link
Member

Choose a reason for hiding this comment

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

Locla -> Local

@armish
Copy link
Member

armish commented Jun 14, 2016

@piotr-gawron: again — this is great, thanks! I have a few comments and suggestions here and there before we merge this in. Let me know if you need more clarification on any of these.

@armish armish self-assigned this Jun 14, 2016
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 91.449% when pulling b7e0d6a on piotr-gawron:string-virtual-file into 943bcf7 on hammerlab:master.

@piotr-gawron
Copy link
Contributor Author

@armish I agree with all of them. Thanks for checking my code. I inlcuded your comments in the PR (I'm not sure if you wanted me to do it or not :)).

@armish
Copy link
Member

armish commented Jun 15, 2016

@piotr-gawron: cool - thanks for addressing those comments!

Two minor things to address before we call this a merge:

  • with the recent addition, looks like we ended up with two create functions within VcfDataSource.js. Can you remove the old one with the Object signature and leave only the recent addition?
  • the new create uses tabs for indents; would be great if you can convert them to spaces while at it.


return createFromVcfFile(new VcfFile(new RemoteFile(url)));
function create(data: {url?: string, content?: string}): VcfDataSource {
Copy link
Member

Choose a reason for hiding this comment

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

thanks for adding this implementation in. Can you remove the old one from the source code?

@piotr-gawron
Copy link
Contributor Author

@armish I hope I fixed it properly this time.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.08%) to 91.696% when pulling 95f6810 on piotr-gawron:string-virtual-file into 943bcf7 on hammerlab:master.

@armish
Copy link
Member

armish commented Jun 17, 2016

@piotr-gawron: 👍

@armish armish merged commit 125a232 into hammerlab:master Jun 17, 2016
@piotr-gawron piotr-gawron deleted the string-virtual-file branch June 21, 2016 13:21
@denisemauldin
Copy link

@piotr-gawron How is this functionality used? Can you add example code? I have a JSON file that I'd like to load into pileup.js and it seems like the easiest way is to transform the JSON into a VCF File and then load it into pileup.js in memory. Thanks!

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.

None yet

4 participants