On Fri, Feb 7, 2014 at 12:09 AM, Julian Gehring <julian.gehring@embl.de>wrote:

> Hi,
>
> I got two more (with VariantAnnotation_1.9.35, Rsamtools_1.15.27).  They
> may be related to what we discussed before, so I'm leaving them in this
> thread.
>
> ** Some example data
>
> #+BEGIN_SRC R
>   library(VariantAnnotation)
>
>   example(VRanges) ## gives us 'vr' and 'vcf'
>
>   vr_small = vr
>   width(vr_small) = 1  ## widths > 1 can become ambiguous in the VCF
> #+END_SRC
>
>
> ** Convertion between VCF and VRanges
>
> #+BEGIN_SRC R
>   vcf_small = as(vr_small, "VCF")
>   vr_back = as(vcf_small, "VRanges") ## fails in devel
> #+END_SRC
>
>
The one above has been fixed. I rewrote the chunk of code that has been
causing all of these issues. Hopefully things will be smoother now. Added a
test. Version 1.9.37 in devel.


> #+BEGIN_EXAMPLE
> Error in ad[, , 1, drop = FALSE] : incorrect number of dimensions
> #+END_EXAMPLE
>
> In bioc-stable, this does not fail, but results in 4 variants (see below).
>  Maybe the latest patch will change this once it is out.
>
>
> ** Writing to VCF, reading, and converting
>
> Converting back and forth duplicates variants.
>
> #+BEGIN_SRC R
>   vr_small ## 2 variants
>
>   temp_file = tempfile()
>   writeVcf(vr_small, temp_file)
>
>   vr_read = readVcf(temp_file, "hg19")
>   rowData(vr_read) ## 2 variants
>
>   vr_conv = as(vr_read, "VRanges")
>   vr_conv ## "4" variants (duplicated)
> #+END_SRC
>
>

This is actually expected, depending on the specific result. Coercion to
VCF forces the geno components (like AD for the read depths) into a matrix
shape, filling NAs into the empty cells. Those are not dropped on the way
back to VRanges, so there are new rows.



>
> Best wishes
> Julian
>
>
>
> On 02/06/2014 01:58 PM, Michael Lawrence wrote:
>
>> Hi Julian,
>>
>> Thanks for this one. It was a bug in Rsamtools, now fixed in devel,
>> version
>> 1.15.27. I'll leave it to Martin/Val to OK it and push to release.
>>
>> Michael
>>
>>
>> On Thu, Feb 6, 2014 at 1:46 AM, Julian Gehring <julian.gehring@embl.de
>> >wrote:
>>
>>  Hi Michael,
>>>
>>> Thanks for the fast patching.  However, going a step further and trying
>>> to
>>> read the VCF again fails (with VariantAnnotation_1.9.35
>>> ).  I'm not sure if this is related to the same issue.
>>>
>>>
>>> #+BEGIN_SRC R
>>>
>>> library(VariantAnnotation)
>>> example(VRanges)
>>> writeVcf(vr, "out.vcf") ## works
>>> readVcf("out.vcf", "hg19") ## fails
>>>
>>> #+END_SRC
>>>
>>> Error in `rownames<-`(`*tmp*`, value = c("chr1", "chr2")) :
>>>    invalid rownames length
>>>
>>> Best wishes
>>> Julian
>>>
>>>
>>>
>>> On 02/05/2014 08:38 PM, Michael Lawrence wrote:
>>>
>>>  Thanks, fixed in 1.9.35/1.8.11.
>>>>
>>>>
>>>> On Wed, Feb 5, 2014 at 12:35 AM, Julian Gehring <julian.gehring@embl.de
>>>>
>>>>> wrote:
>>>>>
>>>>
>>>>   Hi,
>>>>
>>>>>
>>>>> I just stumbled over the fact that 'writeVcf' for a 'VRanges' fails if
>>>>> 'sampleNames' is a factor with unused levels.  Here a small example:
>>>>>
>>>>> #+BEGIN_SRC R
>>>>>
>>>>> library(VariantAnnotation)
>>>>> example(VRanges)
>>>>> writeVcf(vr, "out.vcf") ## works
>>>>>
>>>>> f = sampleNames(vr)
>>>>> f ## levels: a, b
>>>>> levels(f) = c("a", "b", "c") ## c in unused
>>>>> f ## levels: a, b, c
>>>>> sampleNames(vr) = f
>>>>> writeVcf(vr, "out.vcf")  ## fails
>>>>>
>>>>> #+END_SRC
>>>>>
>>>>> Error in writeVcf(as(obj, "VCF"), filename, ...) :
>>>>>     error in evaluating the argument 'obj' in selecting a method for
>>>>> function 'writeVcf': Error in ans[sampleToUniq] <- as.vector(v) :
>>>>> replacement has length zero
>>>>>
>>>>> This occurs both with the latest bioc-release and bioc-devel.  I don't
>>>>> know what exactly is causing this, but please let me know if I can be
>>>>> of
>>>>> any help.
>>>>>
>>>>> Best wishes
>>>>> Julian
>>>>>
>>>>> _______________________________________________
>>>>> Bioc-devel@r-project.org mailing list
>>>>> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>>>>>
>>>>>
>>>>>
>>>>
>>

	[[alternative HTML version deleted]]

