VanLoo-lab / ascat

ASCAT R package
https://www.mdanderson.org/research/departments-labs-institutes/labs/van-loo-laboratory/resources.html#ASCAT
164 stars 85 forks source link

error in ascat.runAscat(ascat.bc) on chr. X Error in m[i, 2] : subscript out of bounds #41

Closed jazberna1 closed 5 years ago

jazberna1 commented 5 years ago

Hello,

I am getting this error

Error in m[i, 2] : subscript out of bounds

when running this command on the X chromosome:

ascat.runAscat(ascat.bc)

ASCAT works for me correctly for all the autosomes (I haven't tried Y yet).

I am using ascatngs 4.2.1 and the piece of code I'm running is:

ascat.bc =  ascat.loadData('tumour_logR.txt', 'tumour_BAF.txt', 'normal_logR.txt', 'normal_BAF.txt', gender ='XY')

ascat.bc = ascat.GCcorrect(ascat.bc, 'SnpGcCorrections.sorted.tsv')

ascat.plotRawData(ascat.bc)

ascat.plotRawData(ascat.bc)

ascat.bc = ascat.aspcf(ascat.bc)

ascat.plotSegmentedData(ascat.bc)

ascat.output = ascat.runAscat(ascat.bc)

Any help to determine the cause of the error will be much appreciated.

Thanks so much Jorge

jazberna1 commented 5 years ago

Hi,

From this line of the ASCAT code:

  SNPposhet = SNPpos[names(bafsegmented),]
  autoprobes = !(SNPposhet[,1]%in%sexchromosomes)

I gather X cannot be run on its own and needs to be accompained by autosome(s) in the input files. Am I right?

I added the chr 1 to the input files, then run ASCAT like this:

ascat.bc = ascat.loadData('tumour_logR.txt', 'tumour_BAF.txt', 'normal_logR.txt', 'normal_BAF.txt', gender ='XY', chrs=c(1,'X'))

That got me one ASCATprofile.png file containing chrs 1 an X. I guess my question is know whether the accompained by autosome(s) must not contain significant rearrangements or aberrations, and just be an ordinary diploid autosome.

Thanks so much Jorge

haasek commented 5 years ago

Hi Jorge,

ASCAT isn't really intended to be run for every chromosome individually. You can process all chromosomes at the same time, by either defining chrs=c(1:22,"X") or not defining the parameter.

ASCAT needs heterozygous SNPs to infer copy number and in a male patient the X chromosome is flagged as haploid and omitted from the analysis. The probes from the pseudo-autosomal region are added in the plot, as they can appear heterozygous. There is no minimum amount of rearrangement that is expected from a chromosome. But I would recommend to just run on all chromosomes simultaneously to get ideal results.

Best wishes, Kerstin

jazberna1 commented 5 years ago

Hi Kerstin,

Thanks so much for the advise. I will rerun on all the chrs. simultaneously.

Regards Jorge

FriederikeHanssen commented 4 years ago

Hi @haasek !

For our research we are interested in the CNA on the X and Y chromosomes only. To save compute time and resources we would like to avoid processing the whole genome. When running ASCAT we ran into the same issue as described above.

Do you have suggestion on how to use ASCAT here? Would it for example be feasible to run chr1 with X and Y or would that skew the results? Thank you for your help!

Best, Rike

tlesluyes commented 4 years ago

Hello,

ASCAT is using all the genomic information to get an accurate estimate of both tumour ploidy and purity. Then, this information allows for a copy-number estimate of each genomic segment. I wouldn’t recommend to run ASCAT on a few chromosomes because this is going to introduce an important bias.

Cheers,

Tom.

FriederikeHanssen commented 4 years ago

Hi @tlesluyes ,

that is unfortunate from a perspective of saving time and compute resources. But thank you for the reply and further explanation :)

Best, Rike

tlesluyes commented 4 years ago

If computation resource is a major limiting factor to you, what you can do is downsampling your SNPs to only consider a subset of them and then run ASCAT on those. Please note that this method could introduce a bias but it will definitely speed up the process. The number of SNP to consider is up to you but should be high enough and depend on the original number of data points.

Since ASCAT is really fast for SNP6 arrays (a few million SNPs; less than one hour), can I ask what platform are you using and how many samples you are trying to analyse?

Cheers, Tom.

FriederikeHanssen commented 4 years ago

Hi!

We are reanalysing a couple of hundred datasets. But since we have to map them all as well, ASCAT is not the bottleneck, but the upstream processes are. Using only reads mapping to our chromosomes of interest would have majorly speed up the analyse, but if it introduces a strong bias in ASCAT then of course this is not feasible.

Best, Rike

clersdom commented 3 years ago

Hi, I have the same error message as @jazberna1 "Error in m[i, 2] : subscript out of bounds" when running ascat.output = ascat.runAscat(ascat.bc) Before this step, I have run ascat.bc = ascat.aspcf(ascat.bc), but in the end it also dropped a message "Error in gg[, sample] : subscript out of bounds" but it still created the output ascat.bc I think.

I would like to obtain purity and ploidy, and I am running it in a paired mode. Any help with this error will be much appreciated, thanks!

tlesluyes commented 3 years ago

Hi clersdom,

If R raises an an error when running the ascat.aspcf function, then you should not run any downstream command. This seems very different from the original error described here that happened in the ascat.runAscat function when only providing a single chromosome (or are you trying to do the same thing?). Please review the original ascat.bc object right after it gets generated using ascat.loadData: are tumour/normal BAF and logR correctly stored in the R object? Do your input files contain multiple samples or just one (have you tried just one?). This thread has been closed more than a year ago, please create a new one if you need further assistance.

Cheers,

Tom.

clersdom commented 3 years ago

No, I am running it for the whole genome. The ascat.bc object seems to have all the data correctly stored. I am running it again without the ascat.GCcorrect step since I just want to get purity and ploidy at this stage- I assume that the GC correction step is more suitable for copy number calling purposes? I will open a new issue in case it does not work either. Thank you!