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

vcf.to.sigs.input() Error arguments imply differing number of rows: 1, 0 #63

Open
alpreyes opened this issue Jun 15, 2020 · 4 comments
Open

Comments

@alpreyes
Copy link

Hello,

I am attempting to use deconstructSigs and I am encountering an error with the vcf.to.sigs.input() function, after running with the correct input format I get

Error in data.frame(sample = sample, chr = chr[alt1], pos = pos[alt1],  : 
  arguments imply differing number of rows: 1, 0

Do you have any insight as to what is causing this error? I am willing to share a subset of the example file if needed.

@raerose01
Copy link
Owner

Hi, I have not come across this error before. Could you share some of the offending file?
Thanks!

@alpreyes
Copy link
Author

Hi, thanks for your quick response I've attached a subset of the vcf file I am trying (the first 10 lines, no header)
vcf_to_sigs_input_ex_file.txt

I also attempted to run each step of the vcf.to.sigs.input() function separately, here are some of those outputs

> gt <- VariantAnnotation::readGT("./annotate_concatd_vcfs_output/16006-1083-2P_snp_con_concat_ANN.vcf", nucleotides = TRUE)
> gt

                                    NORMAL TUMOR
chr1:629274_G/A                     "G/A"  "G/G"
chr1:629488_T/C                     "T/C"  "T/T"
chr1:630317_A/G                     "A/G"  "A/A"
chr1:630750_C/T                     "C/T"  "C/C"
chr1:634229_A/C                     "A/A"  "A/C"
chr1:801702_G/C                     "G/C"  "G/G"
chr1:929037_G/C                     "G/C"  "G/G"
chr1:1139023_G/A                    "G/A"  "G/G"
chr1:1168098_G/T                    "G/G"  "G/T"
chr1:1782335_G/A                    "G/A"  "G/G"



> chr <- sub(":.+", "", rownames(gt))
> chr

[1] "chr1" "chr1" "chr1" "chr1" "chr1" "chr1" "chr1" "chr1" "chr1"

> pos <- as.numeric(sub("_.+", "", sub(".+:", "", rownames(gt))))
> pos
   [1]    629274    629488    630317    630750    634229    801702    929037   1139023   1168098   1782335 

> ref <- sub("[/|].+", "", sub(".+_", "", rownames(gt)))
> ref
   [1] "G" "T" "A" "C" "A" "G" "G" "G" "G" "G"



> mut <- data.frame()
>   for (sample in colnames(gt)) {
+     a1 <- sub("[/|].+", "", gt[, sample])
+     alt1 <- which(ref != a1)
+     mut <- rbind(mut, data.frame(sample = sample,
+                                  chr = chr[alt1],
+                                  pos = pos[alt1],
+                                  ref = ref[alt1],
+                                  alt = a1[alt1]))
+     a2 <- sub(".+[/|]", "", gt[, sample])
+     alt2 <- which(ref != a2 & a1 != a2)
+     mut <- rbind(mut, data.frame(sample = sample,
+                                  chr = chr[alt2],
+                                  pos = pos[alt2],
+                                  ref = ref[alt2],
+                                  alt = a2[alt2]))
+   }
Error in data.frame(sample = sample, chr = chr[alt1], pos = pos[alt1],  : 
  arguments imply differing number of rows: 1, 0


It is this last step that generates the error. any help is appreciated

Thank you!

@raerose01
Copy link
Owner

Hi, just checking, but do you get the same error when you use the example file you've sent?

@alpreyes
Copy link
Author

Yes I was, however I was able to fix the problem by making a small addition to the code

in this step alt1 <- which(ref != a1) i add a [[1]] making the command alt1 <- which(ref != a1[[1]]) and that seemed to fix the error for me

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

No branches or pull requests

2 participants